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 1301 2009-08-25 09:41:04Z mmunaretto $
Author:
fgiust

Method Summary
static void exportDataset(org.dbunit.database.IDatabaseConnection connection, java.lang.String[] tableNames, java.io.File file)
          Deprecated. use exportTablesToDir(IDatabaseConnection, File, DatasetType, ITableFilter)
static void exportDataset(org.dbunit.database.IDatabaseConnection connection, java.lang.String[] tableNames, java.io.File file, DatasetType datasetType)
          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)
          Deprecated. use exportTablesToDir(IDatabaseConnection, File, DatasetType, ITableFilter)
 void exportTablesToDir(org.dbunit.database.IDatabaseConnection connection, java.io.File directory, DatasetType datasetType, 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)
          Deprecated. use loadDataset(URL, DatasetType)
static org.dbunit.dataset.IDataSet loadDataset(java.net.URL url, DatasetType datasetType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

exportDataset

@Deprecated
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
Deprecated. use exportTablesToDir(IDatabaseConnection, File, DatasetType, ITableFilter)

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.

exportDataset

public static void exportDataset(org.dbunit.database.IDatabaseConnection connection,
                                 java.lang.String[] tableNames,
                                 java.io.File file,
                                 DatasetType datasetType)
                          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
datasetType - dataset Type
Throws:
java.io.IOException - An IO Exception.
org.dbunit.dataset.DataSetException - A dataset exception.
java.sql.SQLException - A SQL Exception.

exportTablesToDir

@Deprecated
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
Deprecated. use exportTablesToDir(IDatabaseConnection, File, DatasetType, ITableFilter)

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

exportTablesToDir

public void exportTablesToDir(org.dbunit.database.IDatabaseConnection connection,
                              java.io.File directory,
                              DatasetType datasetType,
                              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
datasetType - dbunit dataset type
tableFilter - optional table filter
Throws:
java.sql.SQLException - sql exception
org.dbunit.dataset.DataSetException - dbunit exception
java.io.IOException - IO exception

loadDataset

@Deprecated
public static org.dbunit.dataset.IDataSet loadDataset(java.net.URL url)
                                               throws java.io.IOException,
                                                      org.dbunit.dataset.DataSetException
Deprecated. use loadDataset(URL, DatasetType)

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

loadDataset

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


Copyright © 2005-2009 Openmind. All Rights Reserved.