Search in sources :

Example 1 with IncludeTableFilter

use of org.apache.cayenne.dbsync.reverse.filters.IncludeTableFilter in project cayenne by apache.

the class DbImporterMojoConfigurationTest method testLoadSchema2.

@Test
public void testLoadSchema2() throws Exception {
    FiltersConfig filters = getCdbImport("pom-schema-2.xml").createConfig(mock(Logger.class)).getDbLoaderConfig().getFiltersConfig();
    TreeSet<IncludeTableFilter> includes = new TreeSet<>();
    includes.add(new IncludeTableFilter(null, new PatternFilter().exclude("^ETL_.*")));
    TreeSet<Pattern> excludes = new TreeSet<>(PatternFilter.PATTERN_COMPARATOR);
    excludes.add(PatternFilter.pattern("^ETL_.*"));
    assertEquals(filters.tableFilter(null, "NHL_STATS"), new TableFilter(includes, excludes));
}
Also used : Pattern(java.util.regex.Pattern) PatternFilter(org.apache.cayenne.dbsync.reverse.filters.PatternFilter) IncludeTableFilter(org.apache.cayenne.dbsync.reverse.filters.IncludeTableFilter) TableFilter(org.apache.cayenne.dbsync.reverse.filters.TableFilter) TreeSet(java.util.TreeSet) FiltersConfig(org.apache.cayenne.dbsync.reverse.filters.FiltersConfig) IncludeTableFilter(org.apache.cayenne.dbsync.reverse.filters.IncludeTableFilter) Logger(org.slf4j.Logger) Test(org.junit.Test)

Example 2 with IncludeTableFilter

use of org.apache.cayenne.dbsync.reverse.filters.IncludeTableFilter in project cayenne by apache.

the class DbImporterOldMojoConfigurationTest method testLoadSchema2.

public void testLoadSchema2() throws Exception {
    FiltersConfig filters = getCdbImport("pom-schema-2.xml").createConfig(mock(Logger.class)).getDbLoaderConfig().getFiltersConfig();
    TreeSet<IncludeTableFilter> includes = new TreeSet<>();
    includes.add(new IncludeTableFilter(null, new PatternFilter().exclude("^ETL_.*")));
    TreeSet<Pattern> excludes = new TreeSet<>(PatternFilter.PATTERN_COMPARATOR);
    excludes.add(PatternFilter.pattern("^ETL_.*"));
    assertEquals(filters.tableFilter(null, "NHL_STATS"), new TableFilter(includes, excludes));
}
Also used : Pattern(java.util.regex.Pattern) PatternFilter(org.apache.cayenne.dbsync.reverse.filters.PatternFilter) IncludeTableFilter(org.apache.cayenne.dbsync.reverse.filters.IncludeTableFilter) TableFilter(org.apache.cayenne.dbsync.reverse.filters.TableFilter) TreeSet(java.util.TreeSet) FiltersConfig(org.apache.cayenne.dbsync.reverse.filters.FiltersConfig) IncludeTableFilter(org.apache.cayenne.dbsync.reverse.filters.IncludeTableFilter) Logger(org.slf4j.Logger)

Aggregations

TreeSet (java.util.TreeSet)2 Pattern (java.util.regex.Pattern)2 FiltersConfig (org.apache.cayenne.dbsync.reverse.filters.FiltersConfig)2 IncludeTableFilter (org.apache.cayenne.dbsync.reverse.filters.IncludeTableFilter)2 PatternFilter (org.apache.cayenne.dbsync.reverse.filters.PatternFilter)2 TableFilter (org.apache.cayenne.dbsync.reverse.filters.TableFilter)2 Logger (org.slf4j.Logger)2 Test (org.junit.Test)1