use of org.apache.ignite.configuration.SqlConfiguration in project ignite by apache.
the class SystemViewCommandTest method testSchemas.
/**
*/
@Test
public void testSchemas() throws Exception {
try (IgniteEx g = startGrid(getConfiguration(getTestIgniteInstanceName(3)).setSqlConfiguration(new SqlConfiguration().setSqlSchemas("MY_SCHEMA", "ANOTHER_SCHEMA")))) {
Set<String> schemaNames = new HashSet<>();
HashSet<String> expSchemas = new HashSet<>(asList("MY_SCHEMA", "ANOTHER_SCHEMA", "SYS", "PUBLIC"));
List<List<String>> sqlSchemaView = systemView(g, SQL_SCHEMA_VIEW);
// name
sqlSchemaView.forEach(row -> schemaNames.add(row.get(0)));
assertEquals(schemaNames, expSchemas);
}
}
use of org.apache.ignite.configuration.SqlConfiguration in project ignite by apache.
the class SqlSystemViewsSelfTest method testSchemasView.
/**
* Test schemas system view.
* @throws Exception in case of failure.
*/
@Test
public void testSchemasView() throws Exception {
IgniteEx srv = startGrid(getConfiguration().setSqlConfiguration(new SqlConfiguration().setSqlSchemas("PREDIFINED_SCHEMA_1")));
IgniteEx client = startClientGrid(getConfiguration().setIgniteInstanceName("CLIENT").setSqlConfiguration(new SqlConfiguration().setSqlSchemas("PREDIFINED_SCHEMA_2")));
srv.createCache(cacheConfiguration("TST1"));
String schemasSql = "SELECT * FROM " + systemSchemaName() + ".SCHEMAS";
List<List<?>> srvNodeSchemas = execSql(schemasSql);
List<List<?>> clientNodeSchemas = execSql(client, schemasSql);
Set expSchemasSrv = Sets.newHashSet("PREDIFINED_SCHEMA_1", "PUBLIC", "TST1", systemSchemaName());
Set schemasSrv = srvNodeSchemas.stream().map(f -> f.get(0)).map(String.class::cast).collect(toSet());
Assert.assertEquals(expSchemasSrv, schemasSrv);
Set expSchemasCli = Sets.newHashSet("PREDIFINED_SCHEMA_2", "PUBLIC", "TST1", systemSchemaName());
Set schemasCli = clientNodeSchemas.stream().map(f -> f.get(0)).map(String.class::cast).collect(toSet());
Assert.assertEquals(expSchemasCli, schemasCli);
}
use of org.apache.ignite.configuration.SqlConfiguration in project ignite by apache.
the class SqlQueryHistorySelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
cfg.setCacheConfiguration(configureCache("A"), configureCache("B"));
cfg.setSqlConfiguration(new SqlConfiguration().setSqlQueryHistorySize(QUERY_HISTORY_SIZE));
return cfg;
}
use of org.apache.ignite.configuration.SqlConfiguration 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);
}
}
use of org.apache.ignite.configuration.SqlConfiguration in project ignite by apache.
the class Schemas method config.
@Test
void config() {
// tag::custom-schemas[]
IgniteConfiguration cfg = new IgniteConfiguration();
SqlConfiguration sqlCfg = new SqlConfiguration();
sqlCfg.setSqlSchemas("MY_SCHEMA", "MY_SECOND_SCHEMA");
cfg.setSqlConfiguration(sqlCfg);
// end::custom-schemas[]
}
Aggregations