当前位置: 首页>>代码示例>>Java>>正文


Java DefaultColumnFilter.includedColumnsTable方法代码示例

本文整理汇总了Java中org.dbunit.dataset.filter.DefaultColumnFilter.includedColumnsTable方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultColumnFilter.includedColumnsTable方法的具体用法?Java DefaultColumnFilter.includedColumnsTable怎么用?Java DefaultColumnFilter.includedColumnsTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.dbunit.dataset.filter.DefaultColumnFilter的用法示例。


在下文中一共展示了DefaultColumnFilter.includedColumnsTable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compareDbToDataSet

import org.dbunit.dataset.filter.DefaultColumnFilter; //导入方法依赖的package包/类
private void compareDbToDataSet(String filename) throws Exception
{
	
	IDataSet afterActualDataSet = getDbUnitconnection().createDataSet(); 
	IDataSet afterExpectedDataSet = loadDataSet(filename);
	
	
	ITableIterator iter = afterActualDataSet.iterator();
	while (iter.next()) {
		ITable actualTable = iter.getTable();
		ITable expectedTable = afterExpectedDataSet.getTable(actualTable.getTableMetaData().getTableName());
		Column[] expectedColumns = expectedTable.getTableMetaData().getColumns();
		//Expected table will be sorted by the columns present on expected file
		ITable sortedExpectedTable = new SortedTable(expectedTable, expectedColumns); 

		//Actual table will be sorted by the columns present on *expected* file.
		//It will be also filtered to only include tables present on expected file
		ITable filteredActualTable = DefaultColumnFilter.includedColumnsTable(actualTable, expectedColumns);
		ITable sortedFilteredActualTable = new SortedTable(filteredActualTable, expectedColumns);
		
	    Assertion.assertEquals(sortedExpectedTable, sortedFilteredActualTable); 
	}
}
 
开发者ID:daniel-a-melo,项目名称:jorm-unit,代码行数:24,代码来源:JPATest.java

示例2: assertDatabaseState

import org.dbunit.dataset.filter.DefaultColumnFilter; //导入方法依赖的package包/类
/**
    * Asserts that the database is in a given state.
    * 
    * @param expectedState file name of dataset holding the expected state
    */
   @SuppressWarnings("deprecation")
protected void assertDatabaseState(String expectedState) throws Exception {
	// Fetch database data after executing your code
       IDataSet databaseDataSet = getConnection().createDataSet();
       IDataSet initialDataSet = new FlatXmlDataSet(new File(expectedState), false, true);
       
       // compare tables
       for (ITable table: initialDataSet.getTables()) {
       	ITable actualTable = databaseDataSet.getTable(table.getTableMetaData().getTableName());
       	ITable filteredTable = DefaultColumnFilter.includedColumnsTable(actualTable, 
                   table.getTableMetaData().getColumns());
       	Assertion.assertEquals(new SortedTable(table), new SortedTable(filteredTable));
       }
}
 
开发者ID:P15,项目名称:jailer,代码行数:20,代码来源:DbmsAwareTestCase.java

示例3: assertTableEquals

import org.dbunit.dataset.filter.DefaultColumnFilter; //导入方法依赖的package包/类
protected void assertTableEquals( Class peristentClass, String[] includedFields, IDataSet dataset ) throws Exception
{
    // Fetch database data after executing your code
    IDataSet databaseDataSet = getConnection().createDataSet();
    ITable actualTable = databaseDataSet.getTable( getTableName( peristentClass ) );
    ITable actualData = DefaultColumnFilter.includedColumnsTable( actualTable, getColumnNames( peristentClass, includedFields ) );

    // Load expected data from an XML dataset
    ITable expectedTable = dataset.getTable( getTableName( peristentClass ) );
    ITable expectedData = DefaultColumnFilter.includedColumnsTable( expectedTable, getColumnNames( peristentClass, includedFields ) );

    // Assert actual database table match expected table
    Assertion.assertEquals( expectedData, actualData );
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:15,代码来源:AbstractDBUnitHibernateMemoryTest.java

示例4: assertTableEquals

import org.dbunit.dataset.filter.DefaultColumnFilter; //导入方法依赖的package包/类
protected void assertTableEquals(Class<?> peristentClass, String[] includedFields, IDataSet dataset) throws Exception {
    // Fetch database data after executing your code
    IDataSet databaseDataSet = getConnection().createDataSet();
    ITable actualTable = databaseDataSet.getTable(getTableName(peristentClass));
    ITable actualData =
        DefaultColumnFilter.includedColumnsTable(actualTable, getColumnNames(peristentClass, includedFields));

    // Load expected data from an XML dataset
    ITable expectedTable = dataset.getTable(getTableName(peristentClass));
    ITable expectedData =
        DefaultColumnFilter.includedColumnsTable(expectedTable, getColumnNames(peristentClass, includedFields));

    // Assert actual database table match expected table
    Assertion.assertEquals(expectedData, actualData);
}
 
开发者ID:testIT-LivingDoc,项目名称:livingdoc-confluence,代码行数:16,代码来源:AbstractDBUnitHibernateMemoryTest.java

示例5: assertEquals

import org.dbunit.dataset.filter.DefaultColumnFilter; //导入方法依赖的package包/类
/**
 * Convenience method for asserting equality between two tables, only considering the columns in the expected
 * dataset.
 * 
 * @param expected
 *            the expected dataset
 * @param actual
 *            the actual dataset
 * @throws DatabaseUnitException
 *             on DbUnit exceptions
 */
public void assertEquals(ITable expected, ITable actual) throws DatabaseUnitException {
    ITable actualFiltered = DefaultColumnFilter.includedColumnsTable(actual, expected.getTableMetaData().getColumns());
    Assertion.assertEquals(expected, actualFiltered);
}
 
开发者ID:mhaglind,项目名称:jee-exercises,代码行数:16,代码来源:DbUnitHelper.java


注:本文中的org.dbunit.dataset.filter.DefaultColumnFilter.includedColumnsTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。