Search in sources :

Example 1 with DatabaseSequenceFilter

use of org.dbunit.database.DatabaseSequenceFilter in project cia by Hack23.

the class DataSetConnectionFactory method getDataSet.

/**
 * Gets the data set.
 *
 * @param connection
 *            the connection
 * @return the data set
 * @throws DatasetFactoryException
 *             the dataset factory exception
 */
public IDataSet getDataSet(final Connection connection) throws DatasetFactoryException {
    DatabaseConnection databaseConnection;
    try {
        databaseConnection = new DatabaseConnection(connection);
        final ITableFilter filter = new DatabaseSequenceFilter(databaseConnection);
        return new FilteredDataSet(filter, databaseConnection.createDataSet());
    } catch (DatabaseUnitException | SQLException e) {
        throw new DatasetFactoryException(e);
    }
}
Also used : SQLException(java.sql.SQLException) ITableFilter(org.dbunit.dataset.filter.ITableFilter) DatabaseUnitException(org.dbunit.DatabaseUnitException) DatabaseConnection(org.dbunit.database.DatabaseConnection) DatabaseSequenceFilter(org.dbunit.database.DatabaseSequenceFilter) FilteredDataSet(org.dbunit.dataset.FilteredDataSet)

Aggregations

SQLException (java.sql.SQLException)1 DatabaseUnitException (org.dbunit.DatabaseUnitException)1 DatabaseConnection (org.dbunit.database.DatabaseConnection)1 DatabaseSequenceFilter (org.dbunit.database.DatabaseSequenceFilter)1 FilteredDataSet (org.dbunit.dataset.FilteredDataSet)1 ITableFilter (org.dbunit.dataset.filter.ITableFilter)1