@Override public Collection<Schema> getSchemas() { return catalog.getSchemas(); }
@Override public Collection<Schema> getSchemas() { return catalog.getSchemas(); }
@Test public void catalogSerialization(final Connection connection) throws Exception { final SchemaCrawlerOptions schemaCrawlerOptions = DatabaseTestUtility.schemaCrawlerOptionsWithMaximumSchemaInfoLevel; final Catalog catalog = getCatalog(connection, schemaCrawlerOptions); assertThat("Could not obtain catalog", catalog, notNullValue()); assertThat("Could not find any schemas", catalog.getSchemas(), is(not(empty()))); final Schema schema = catalog.lookupSchema("PUBLIC.BOOKS").orElse(null); assertThat("Could not obtain schema", schema, notNullValue()); assertThat("Unexpected number of tables in the schema", catalog.getTables(schema), hasSize(10)); final Catalog clonedCatalog = SerializationUtils.clone(catalog); assertThat(catalog, equalTo(clonedCatalog)); assertThat("Could not obtain catalog", clonedCatalog, notNullValue()); assertThat("Could not find any schemas", clonedCatalog.getSchemas(), is(not(empty()))); final Schema clonedSchema = clonedCatalog.lookupSchema("PUBLIC.BOOKS") .orElse(null); assertThat("Could not obtain schema", clonedSchema, notNullValue()); assertThat("Unexpected number of tables in the schema", clonedCatalog.getTables(clonedSchema), hasSize(10)); }
options); for (final Schema schema: catalog.getSchemas())
@Override public Collection<Schema> getSchemas() { return catalog.getSchemas(); }
@Override public Collection<Schema> getSchemas() { return catalog.getSchemas(); }
final Schema[] schemas = catalog.getSchemas().toArray(new Schema[0]); assertThat("Schema count does not match", schemas, arrayWithSize(5)); final Schema schema = schemas[0];
schemaRetrievalOptions, schemaCrawlerOptions); final Schema[] schemas = catalog.getSchemas().toArray(new Schema[0]); assertThat("Schema count does not match", schemas, arrayWithSize(5)); for (final Schema schema: schemas)
schemaCrawlerOptionsBuilder .toOptions()); final Schema[] schemas = catalog.getSchemas().toArray(new Schema[0]); assertThat("Schema count does not match", schemas, arrayWithSize(5)); for (final Schema schema: schemas)
final Schema[] schemas = catalog.getSchemas().toArray(new Schema[0]); assertThat("Schema count does not match", schemas, arrayWithSize(6)); for (final Schema schema: schemas)
schemaRetrievalOptions, schemaCrawlerOptions); final Schema[] schemas = catalog.getSchemas().toArray(new Schema[0]); assertThat("Schema count does not match", schemas, arrayWithSize(5)); for (final Schema schema: schemas)
final Schema[] schemas = catalog.getSchemas().toArray(new Schema[0]); assertThat("Schema count does not match", schemas, arrayWithSize(6)); for (final Schema schema: schemas)
final Schema[] schemas = catalog.getSchemas().toArray(new Schema[0]); assertThat("Schema count does not match", schemas, arrayWithSize(6)); for (final Schema schema: schemas)
@Override public void validateDatabase(Catalog database, PhysicalSchema physicalSchema) { if (database.getSchemas().size() != 1) { throw new IllegalArgumentException("Should find 1 schema only for schema " + physicalSchema + "; found " + CollectionAdapter.adapt(database.getSchemas()).makeString(", ")); } }
schemaRetrievalOptions, schemaCrawlerOptions); final Schema[] schemas = catalog.getSchemas().toArray(new Schema[0]); assertThat("Schema count does not match", schemas, arrayWithSize(5)); for (final Schema schema: schemas)
final Schema[] schemas = catalog.getSchemas().toArray(new Schema[0]); assertThat("Schema count does not match", schemas, arrayWithSize(6)); for (final Schema schema: schemas)
final Schema[] schemas = catalog.getSchemas().toArray(new Schema[0]); assertThat("Schema count does not match", schemas, arrayWithSize(6)); for (final Schema schema: schemas)
final Schema[] schemas = catalog.getSchemas().toArray(new Schema[0]); assertThat("Schema count does not match", schemas, arrayWithSize(5)); for (final Schema schema: schemas)
schemaRetrievalOptions, schemaCrawlerOptions); final Schema[] schemas = catalog.getSchemas().toArray(new Schema[0]); assertThat("Schema count does not match", schemas, arrayWithSize(6)); for (final Schema schema: schemas)
@Override public void validateDatabase(Catalog database, final PhysicalSchema physicalSchema) { MutableCollection<Schema> schemasWithIncorrectCatalog = CollectionAdapter.adapt(database.getSchemas()).reject(new Predicate<Schema>() { @Override public boolean accept(Schema each) { return each.getCatalogName().equals(physicalSchema.getPhysicalName()); } }); if (schemasWithIncorrectCatalog.notEmpty()) { throw new IllegalArgumentException("Returned ASE schemas should be in " + physicalSchema.getPhysicalName() + " catalog; however, these were not: " + schemasWithIncorrectCatalog); } }