org.dbunit.dataset.ITableIterator Java Examples

The following examples show how to use org.dbunit.dataset.ITableIterator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractSQLAssertTest.java    From sharding-jdbc-1.5.1 with Apache License 2.0 5 votes vote down vote up
private void assertResult(final Connection connection, final File file) throws MalformedURLException, SQLException, DatabaseUnitException {
    ITableIterator expectedTableIterator = new FlatXmlDataSetBuilder().build(file).iterator();
    try (Connection conn = connection) {
        while (expectedTableIterator.next()) {
            ITable expectedTable = expectedTableIterator.getTable();
            String actualTableName = expectedTable.getTableMetaData().getTableName();
            String verifySql = "SELECT * FROM " + actualTableName + " WHERE status = '" + getStatus(file) + "'";
            ITable actualTable = DBUnitUtil.getConnection(new DataBaseEnvironment(DatabaseType.valueFrom(conn.getMetaData().getDatabaseProductName())), conn)
                    .createQueryTable(actualTableName, verifySql);
            assertEquals(expectedTable, actualTable);
        }
    }
}
 
Example #2
Source File: XlsDataSet.java    From Leo with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected ITableIterator createIterator(boolean reversed)
        throws DataSetException {
    if (logger.isDebugEnabled())
        logger.debug("createIterator(reversed={}) - start", String.valueOf(reversed));

    ITable[] tables = (ITable[]) _tables.orderedValues().toArray(new ITable[0]);
    return new DefaultTableIterator(tables, reversed);
}
 
Example #3
Source File: ScriptableDataSet.java    From database-rider with Apache License 2.0 4 votes vote down vote up
@Override
protected ITableIterator createIterator(boolean reversed) throws DataSetException {
    return new ScriptableDataSetIterator(reversed ? delegate.reverseIterator() : delegate.iterator());
}
 
Example #4
Source File: ScriptableDataSetIterator.java    From database-rider with Apache License 2.0 4 votes vote down vote up
public ScriptableDataSetIterator(ITableIterator delegate) {
    this.delegate = delegate;
}