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


Java DefaultColumnFilter.excludedColumnsTable方法代码示例

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


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

示例1: assertTableContent

import org.dbunit.dataset.filter.DefaultColumnFilter; //导入方法依赖的package包/类
protected void assertTableContent(IDataSet expectedDataSet, String tableName, String[] excludedColumns) throws SQLException, Exception {
	IDataSet actualDataSet = getConnection().createDataSet();

	ITable expectedTable = expectedDataSet.getTable(tableName);
	ITable actualTable = actualDataSet.getTable(tableName);

	if (excludedColumns != null) {
		expectedTable = DefaultColumnFilter.excludedColumnsTable(expectedTable, excludedColumns);
		actualTable = DefaultColumnFilter.excludedColumnsTable(actualTable, excludedColumns);
	}

	Assertion.assertEquals(expectedTable, actualTable);
}
 
开发者ID:Jardo-51,项目名称:user_module,代码行数:14,代码来源:UMDatabaseTestCase.java

示例2: compareExpectedWithActual

import org.dbunit.dataset.filter.DefaultColumnFilter; //导入方法依赖的package包/类
/**
 * Vergelijkt een actuele dataset met de verwachte dataset. Alle records in de verwachte dataset dienen ook voor te
 * komen in de actuele dataset. Tabellen die niet in de expected set voorkomen worden genegeerd.
 * <p>
 * @param expected De expected dataset.
 * @throws DatabaseUnitException on error
 * @throws SQLException on error
 */
protected void compareExpectedWithActual(final IDataSet expected) throws SQLException, DatabaseUnitException {
    if (expected == null) {
        throw new IllegalArgumentException("Argument 'expected' is null");
    }

    final IDatabaseConnection connection = createConnection();
    try {
        final IDataSet actual = createActualSet(connection);
        final String[] expTableNames = expected.getTableNames();
        for (final String currentTableName : expTableNames) {
            // prepareer verwachtte tabel
            final ITable expTable = expected.getTable(currentTableName);
            final Column[] columnsExp = expTable.getTableMetaData().getColumns();
            // Zoek naar kolommen met waarde: [NOTNULLCHECK] zodat deze geexclude worden. Deze worden later per rij
            // gecontroleerd
            final Set<String> excludeButNotEmptyColumnsSet = new HashSet<>();
            final Map<Integer, String> excludeButNotEmptyColumns = new HashMap<>();
            for (final Column column : columnsExp) {
                for (int i = 0; i < expTable.getRowCount(); i++) {
                    final Object value = expTable.getValue(i, column.getColumnName());
                    if (value != null && value.toString().equals("[NOTNULLCHECK]")) {
                        excludeButNotEmptyColumnsSet.add(column.getColumnName());
                        excludeButNotEmptyColumns.put(i, column.getColumnName());
                    }
                }
            }
            final String[] excludeButNotEmptyColumnsArray = excludeButNotEmptyColumnsSet.toArray(new String[0]);
            final ITable filteredTableExp = DefaultColumnFilter.excludedColumnsTable(expTable, excludeButNotEmptyColumnsArray);
            final ITable sortedExp = new SortedTable(filteredTableExp);
            final ITable currentTimestampColumnFilteredExp = new ColumnFilterTable(sortedExp, new CurrentTimestampColumnFilter());

            // prepareer actuele tabel
            final ITable actTable = actual.getTable(currentTableName);
            final ITable filteredTable = DefaultColumnFilter.excludedColumnsTable(actTable, excludeButNotEmptyColumnsArray);
            final ITable sortedActTable = new SortedTable(filteredTable);
            final ITable primaryKeyFilteredActTable = new RowFilterTable(sortedActTable, new PrimaryKeyRowFilter(expTable));
            final ITable currentTimestampRowFilteredActTable = new RowFilterTable(primaryKeyFilteredActTable, new CurrentTimestampRowFilter(expTable));
            final ITable currentTimestampColumnFilteredActTable =
                    new ColumnFilterTable(currentTimestampRowFilteredActTable, new CurrentTimestampColumnFilter());

            try {
                ASSERT.assertEquals(currentTimestampColumnFilteredExp, currentTimestampColumnFilteredActTable);
                if (excludeButNotEmptyColumns.size() > 0) {
                    for (int rij = 0; rij < actTable.getRowCount(); rij++) {
                        final String excludeColumName = excludeButNotEmptyColumns.get(rij);
                        if (excludeColumName != null && actTable.getValue(rij, excludeColumName) == null) {
                            LOG.error("****** NotNullCheck column was leeg in actual result: " + excludeColumName);
                            throw new AssertionFailedError();
                        }
                    }
                }
            } catch (final AssertionFailedError assertionError) {
                LOG.error("****** De volgende records zijn aangetroffen in de database:");
                LOG.error(FORMATTER.format(sortedActTable));
                LOG.error("****** Terwijl minimaal de volgende EXPECTED records verwacht worden:");
                LOG.error(FORMATTER.format(sortedExp));
                throw assertionError;
            }
        }
    } finally {
        connection.close();
    }
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:72,代码来源:AbstractDBUnitUtil.java

示例3: filter

import org.dbunit.dataset.filter.DefaultColumnFilter; //导入方法依赖的package包/类
private ITable filter(final ITable table, final String[] columnsToFilter) throws DataSetException {
    final ITable filteredTable = DefaultColumnFilter.excludedColumnsTable(table, columnsToFilter);
    return applyCustomFilters(filteredTable);
}
 
开发者ID:dadrus,项目名称:jpa-unit,代码行数:5,代码来源:DataSetComparator.java


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