@Test
public void grepColumnsAndIncludeChildTables(final Connection connection)
throws Exception
{
SchemaCrawlerOptions schemaCrawlerOptions = SchemaCrawlerOptionsBuilder
.builder()
.includeGreppedColumns(new RegularExpressionInclusionRule(".*\\.BOOKAUTHORS\\..*"))
.toOptions();
Catalog catalog;
Schema schema;
Table table;
catalog = getCatalog(connection, schemaCrawlerOptions);
schema = catalog.lookupSchema("PUBLIC.BOOKS").get();
assertThat("Schema PUBLIC.BOOKS not found", schema, notNullValue());
assertThat(catalog.getTables(schema), hasSize(1));
table = catalog.lookupTable(schema, "BOOKAUTHORS").get();
assertThat("Table BOOKAUTHORS not found", table, notNullValue());
schemaCrawlerOptions = SchemaCrawlerOptionsBuilder.builder()
.fromOptions(schemaCrawlerOptions).parentTableFilterDepth(1).toOptions();
catalog = getCatalog(connection, schemaCrawlerOptions);
schema = catalog.lookupSchema("PUBLIC.BOOKS").get();
assertThat("Schema PUBLIC.BOOKS not found", schema, notNullValue());
assertThat(catalog.getTables(schema).size(), is(3));
table = catalog.lookupTable(schema, "BOOKAUTHORS").get();
assertThat("Table BOOKAUTHORS not found", table, notNullValue());
table = catalog.lookupTable(schema, "BOOKS").get();
assertThat("Table BOOKS not found", table, notNullValue());
table = catalog.lookupTable(schema, "AUTHORS").get();
assertThat("Table AUTHORS not found", table, notNullValue());
}