• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IColumnFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.dbunit.dataset.filter.IColumnFilter的典型用法代码示例。如果您正苦于以下问题:Java IColumnFilter类的具体用法?Java IColumnFilter怎么用?Java IColumnFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IColumnFilter类属于org.dbunit.dataset.filter包,在下文中一共展示了IColumnFilter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setUpDatabaseConfig

import org.dbunit.dataset.filter.IColumnFilter; //导入依赖的package包/类
/**
 * Configure database.
 *
 * @param config the database-config.
 */
private void setUpDatabaseConfig(DatabaseConfig config) {
    config.setProperty(DatabaseConfig.PROPERTY_BATCH_SIZE, BATCH_SIZE);
    config.setProperty(DatabaseConfig.FEATURE_BATCHED_STATEMENTS,
            Boolean.TRUE);
    config.setProperty(DatabaseConfig.PROPERTY_PRIMARY_KEY_FILTER,
            new IColumnFilter() {

                @Override
                public boolean accept(String tableName, Column column) {
                    if (tableToPrimaryKey.containsKey(tableName)) {
                        return Arrays.asList(
                                tableToPrimaryKey.get(tableName)).contains(
                                column.getColumnName());
                    } else {
                        return column.getColumnName()
                                .equalsIgnoreCase("id");
                    }
                }
            });
}
 
开发者ID:opensource21,项目名称:fuwesta,代码行数:26,代码来源:FuWeStaSampleDatabase.java


示例2: DataSetComparator

import org.dbunit.dataset.filter.IColumnFilter; //导入依赖的package包/类
public DataSetComparator(final String[] orderBy, final String[] toExclude, final boolean isStrict,
        final Set<Class<? extends IColumnFilter>> columnFilters) {
    this.toExclude = new ColumnsHolder(toExclude, ID_MAPPER);
    this.orderBy = new ColumnsHolder(orderBy, ID_MAPPER);
    this.isStrict = isStrict;
    this.columnFilters = columnFilters;
}
 
开发者ID:dadrus,项目名称:jpa-unit,代码行数:8,代码来源:DataSetComparator.java


示例3: applyCustomFilters

import org.dbunit.dataset.filter.IColumnFilter; //导入依赖的package包/类
private ITable applyCustomFilters(final ITable table) throws DataSetException {
    ITable compositeTable = table;
    for (final Class<? extends IColumnFilter> columnFilter : columnFilters) {
        IColumnFilter customColumnFilter;
        try {
            customColumnFilter = columnFilter.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new JpaUnitException("Could not instanciate custom column filter", e);
        }
        final FilteredTableMetaData metaData = new FilteredTableMetaData(compositeTable.getTableMetaData(), customColumnFilter);
        compositeTable = new CompositeTable(metaData, compositeTable);
    }
    return compositeTable;
}
 
开发者ID:dadrus,项目名称:jpa-unit,代码行数:15,代码来源:DataSetComparator.java


示例4: testCurrentDataSetContainsDataAndExpectedDataSetIsEmpty

import org.dbunit.dataset.filter.IColumnFilter; //导入依赖的package包/类
@Test
public void testCurrentDataSetContainsDataAndExpectedDataSetIsEmpty() throws Exception {
    // GIVEN
    final String[] orderBy = new String[] {};
    final String[] toExclude = new String[] {};
    final Set<Class<? extends IColumnFilter>> columnFilters = Collections.emptySet();
    final DataSetComparator comparator = new DataSetComparator(orderBy, toExclude, false, columnFilters);

    when(currentDataSet.getTableNames()).thenReturn(new String[] {
            TABLE_1_NAME
    });
    when(currentDataSet.getTable(any(String.class))).thenAnswer((final InvocationOnMock invocation) -> {
        final String tableName = (String) invocation.getArguments()[0];
        if (tableName == TABLE_1_NAME) {
            return table1;
        } else {
            throw new NoSuchTableException(tableName);
        }
    });

    when(expectedDataSet.getTableNames()).thenReturn(new String[] {});
    when(expectedDataSet.getTable(any(String.class))).thenThrow(new NoSuchTableException());

    // WHEN
    comparator.compare(currentDataSet, expectedDataSet, errorCollector);

    // THEN
    assertThat(errorCollector.amountOfErrors(), equalTo(1));

    try {
        errorCollector.report();
        fail("AssertionError expected");
    } catch (final AssertionError e) {
        assertThat(e.getMessage(), containsString("failed in 1 case"));
        assertThat(e.getMessage(),
                containsString(TABLE_1_NAME + " was expected to be empty, but has <" + TABLE_1_ENTRIES + "> entries"));
    }
}
 
开发者ID:dadrus,项目名称:jpa-unit,代码行数:39,代码来源:DataSetComparatorTest.java


示例5: testCurrentDataSetIsEmptyAndExpectedDataContainsData

import org.dbunit.dataset.filter.IColumnFilter; //导入依赖的package包/类
@Test
public void testCurrentDataSetIsEmptyAndExpectedDataContainsData() throws Exception {
    // GIVEN
    final String[] orderBy = new String[] {};
    final String[] toExclude = new String[] {};
    final Set<Class<? extends IColumnFilter>> columnFilters = Collections.emptySet();
    final DataSetComparator comparator = new DataSetComparator(orderBy, toExclude, false, columnFilters);

    when(currentDataSet.getTableNames()).thenReturn(new String[] {});
    when(currentDataSet.getTable(any(String.class))).thenThrow(new NoSuchTableException());

    when(expectedDataSet.getTableNames()).thenReturn(new String[] {
            TABLE_1_NAME
    });
    when(expectedDataSet.getTable(any(String.class))).thenAnswer((final InvocationOnMock invocation) -> {
        final String tableName = (String) invocation.getArguments()[0];
        if (tableName == TABLE_1_NAME) {
            return table1;
        } else {
            throw new NoSuchTableException(tableName);
        }
    });

    // WHEN
    comparator.compare(currentDataSet, expectedDataSet, errorCollector);

    // THEN
    assertThat(errorCollector.amountOfErrors(), equalTo(1));

    try {
        errorCollector.report();
        fail("AssertionError expected");
    } catch (final AssertionError e) {
        assertThat(e.getMessage(), containsString("failed in 1 case"));
        assertThat(e.getMessage(), containsString(
                TABLE_1_NAME + " was expected to be present and to contain <" + TABLE_1_ENTRIES + "> entries, but not found"));
    }
}
 
开发者ID:dadrus,项目名称:jpa-unit,代码行数:39,代码来源:DataSetComparatorTest.java


示例6: getColumnFilter

import org.dbunit.dataset.filter.IColumnFilter; //导入依赖的package包/类
private HashSet<Class<? extends IColumnFilter>> getColumnFilter(final ExpectedDataSets expectedDataSets) {
    final Class<? extends IColumnFilter>[] filter = (Class<? extends IColumnFilter>[]) expectedDataSets.filter();
    return filter == null ? new HashSet<>() : new HashSet<>(Arrays.asList(filter));
}
 
开发者ID:dadrus,项目名称:jpa-unit,代码行数:5,代码来源:SqlDbFeatureExecutor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IInformationProvider类代码示例发布时间:2022-05-22
下一篇:
Java ItemDye类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap