use of org.apache.ignite.spi.systemview.view.SqlSchemaView in project ignite by apache.
the class SqlViewExporterSpiTest method testSchemas.
/**
*/
@Test
public void testSchemas() throws Exception {
try (IgniteEx g = startGrid(new IgniteConfiguration().setSqlConfiguration(new SqlConfiguration().setSqlSchemas("MY_SCHEMA", "ANOTHER_SCHEMA")))) {
SystemView<SqlSchemaView> schemasSysView = g.context().systemView().view(SQL_SCHEMA_VIEW);
Set<String> schemaFromSysView = new HashSet<>();
schemasSysView.forEach(v -> schemaFromSysView.add(v.schemaName()));
HashSet<String> expSchemas = new HashSet<>(asList("MY_SCHEMA", "ANOTHER_SCHEMA", "SYS", "PUBLIC"));
assertEquals(schemaFromSysView, expSchemas);
List<List<?>> schemas = execute(g, "SELECT * FROM SYS.SCHEMAS");
schemaFromSysView.clear();
schemas.forEach(s -> schemaFromSysView.add(s.get(0).toString()));
assertEquals(schemaFromSysView, expSchemas);
}
}
Aggregations