use of io.trino.testing.CountingMockConnector in project trino by trinodb.
the class TestTrinoDatabaseMetaData method setupServer.
@BeforeClass
public void setupServer() throws Exception {
Logging.initialize();
server = TestingTrinoServer.create();
server.installPlugin(new TpchPlugin());
server.createCatalog(TEST_CATALOG, "tpch");
server.installPlugin(new BlackHolePlugin());
server.createCatalog("blackhole", "blackhole");
server.installPlugin(new HivePlugin());
server.createCatalog("hive", "hive", ImmutableMap.<String, String>builder().put("hive.metastore", "file").put("hive.metastore.catalog.dir", server.getBaseDataDir().resolve("hive").toAbsolutePath().toString()).put("hive.security", "sql-standard").buildOrThrow());
countingMockConnector = new CountingMockConnector();
server.installPlugin(countingMockConnector.getPlugin());
server.createCatalog(COUNTING_CATALOG, "mock", ImmutableMap.of());
server.waitForNodeRefresh(Duration.ofSeconds(10));
try (Connection connection = createConnection();
Statement statement = connection.createStatement()) {
statement.executeUpdate("CREATE SCHEMA blackhole.blackhole");
}
try (Connection connection = createConnection()) {
connection.setCatalog("hive");
try (Statement statement = connection.createStatement()) {
statement.execute("SET ROLE admin IN hive");
statement.execute("CREATE SCHEMA default");
statement.execute("CREATE TABLE default.test_table (a varchar)");
statement.execute("CREATE VIEW default.test_view AS SELECT * FROM hive.default.test_table");
}
}
}
Aggregations