it.openutils.testing
Class DbUnitUtils

java.lang.Object
  extended by it.openutils.testing.DbUnitUtils

public final class DbUnitUtils
extends java.lang.Object

Version:
$Id: DbUnitUtils.java 581 2008-01-31 22:19:56Z fgiust $
Author:
fgiust

Method Summary
static void exportDataset(org.dbunit.database.IDatabaseConnection connection, java.lang.String[] tableNames, java.io.File file)
          Exports a list of table to an xml/xsl file
 void exportTablesToDir(org.dbunit.database.IDatabaseConnection connection, java.io.File directory, boolean xls, org.dbunit.dataset.filter.ITableFilter tableFilter)
          Exports a full db saving a dataset for each table.
static org.dbunit.dataset.IDataSet loadDataset(java.net.URL url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

exportDataset

public static void exportDataset(org.dbunit.database.IDatabaseConnection connection,
                                 java.lang.String[] tableNames,
                                 java.io.File file)
                          throws java.sql.SQLException,
                                 java.io.IOException,
                                 org.dbunit.dataset.DataSetException
Exports a list of table to an xml/xsl file

Parameters:
file - The file name we save the dataset to
connection - connection to use
tableNames - optional list of table names
Throws:
java.io.IOException - An IO Exception.
org.dbunit.dataset.DataSetException - A dataset exception.
java.sql.SQLException - A SQL Exception.

exportTablesToDir

public void exportTablesToDir(org.dbunit.database.IDatabaseConnection connection,
                              java.io.File directory,
                              boolean xls,
                              org.dbunit.dataset.filter.ITableFilter tableFilter)
                       throws java.sql.SQLException,
                              org.dbunit.dataset.DataSetException,
                              java.io.IOException
Exports a full db saving a dataset for each table.

Parameters:
connection - dbunit connection
directory - export directory
xls - if true export will be done using excel datasets
tableFilter - optional table filter
Throws:
java.sql.SQLException - sql exception
org.dbunit.dataset.DataSetException - dbunit exception
java.io.IOException - IO exception

loadDataset

public static org.dbunit.dataset.IDataSet loadDataset(java.net.URL url)
                                               throws java.io.IOException,
                                                      org.dbunit.dataset.DataSetException
Parameters:
url - dataset url (can be an xml or excel file)
Returns:
loaded dataset
Throws:
java.io.IOException - error reading the file
org.dbunit.dataset.DataSetException - error loading the dataset


Copyright © 2008 Openmind. All Rights Reserved.