Search in sources :

Example 1 with BlackHolePlugin

use of io.trino.plugin.blackhole.BlackHolePlugin in project trino by trinodb.

the class TestJdbcWarnings method setupServer.

@BeforeClass
public void setupServer() throws Exception {
    server = TestingTrinoServer.builder().setProperties(ImmutableMap.<String, String>builder().put("testing-warning-collector.add-warnings", "true").put("testing-warning-collector.preloaded-warnings", String.valueOf(PRELOADED_WARNINGS)).buildOrThrow()).build();
    server.installPlugin(new BlackHolePlugin());
    server.createCatalog("blackhole", "blackhole");
    server.waitForNodeRefresh(Duration.ofSeconds(10));
    try (Connection connection = createConnection();
        Statement statement = connection.createStatement()) {
        statement.execute("CREATE SCHEMA blackhole.blackhole");
        statement.executeUpdate("" + "CREATE TABLE slow_table (x int) " + "WITH (" + "   split_count = 1, " + "   pages_per_split = 5, " + "   rows_per_page = 3, " + "   page_processing_delay = '1s'" + ")");
    }
}
Also used : BlackHolePlugin(io.trino.plugin.blackhole.BlackHolePlugin) Statement(java.sql.Statement) Connection(java.sql.Connection) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with BlackHolePlugin

use of io.trino.plugin.blackhole.BlackHolePlugin in project trino by trinodb.

the class TestTrinoDriver method setup.

@BeforeClass
public void setup() 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.waitForNodeRefresh(java.time.Duration.ofSeconds(10));
    setupTestTables();
    executorService = newCachedThreadPool(daemonThreadsNamed(getClass().getSimpleName() + "-%s"));
}
Also used : BlackHolePlugin(io.trino.plugin.blackhole.BlackHolePlugin) TpchPlugin(io.trino.plugin.tpch.TpchPlugin) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with BlackHolePlugin

use of io.trino.plugin.blackhole.BlackHolePlugin 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");
        }
    }
}
Also used : CountingMockConnector(io.trino.testing.CountingMockConnector) BlackHolePlugin(io.trino.plugin.blackhole.BlackHolePlugin) TpchPlugin(io.trino.plugin.tpch.TpchPlugin) HivePlugin(io.trino.plugin.hive.HivePlugin) Statement(java.sql.Statement) Connection(java.sql.Connection) BeforeClass(org.testng.annotations.BeforeClass)

Example 4 with BlackHolePlugin

use of io.trino.plugin.blackhole.BlackHolePlugin in project trino by trinodb.

the class TestJdbcConnection method setupServer.

@BeforeClass
public void setupServer() throws Exception {
    Logging.initialize();
    Module systemTables = binder -> newSetBinder(binder, SystemTable.class).addBinding().to(ExtraCredentialsSystemTable.class).in(Scopes.SINGLETON);
    server = TestingTrinoServer.builder().setAdditionalModule(systemTables).build();
    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());
    server.installPlugin(new BlackHolePlugin());
    server.createCatalog("blackhole", "blackhole", ImmutableMap.of());
    try (Connection connection = createConnection();
        Statement statement = connection.createStatement()) {
        statement.execute("SET ROLE admin IN hive");
        statement.execute("CREATE SCHEMA default");
        statement.execute("CREATE SCHEMA fruit");
        statement.execute("CREATE TABLE blackhole.default.devzero(dummy bigint) " + "WITH (split_count = 100000, pages_per_split = 100000, rows_per_page = 10000)");
        statement.execute("CREATE TABLE blackhole.default.delay(dummy bigint) " + "WITH (split_count = 1, pages_per_split = 1, rows_per_page = 1, page_processing_delay = '60s')");
    }
}
Also used : TableMetadataBuilder.tableMetadataBuilder(io.trino.metadata.MetadataUtil.TableMetadataBuilder.tableMetadataBuilder) Module(com.google.inject.Module) ALL_NODES(io.trino.spi.connector.SystemTable.Distribution.ALL_NODES) Connection(java.sql.Connection) IntStream.range(java.util.stream.IntStream.range) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Test(org.testng.annotations.Test) Closeables.closeAll(io.airlift.testing.Closeables.closeAll) BlackHolePlugin(io.trino.plugin.blackhole.BlackHolePlugin) Future(java.util.concurrent.Future) ResultSet(java.sql.ResultSet) ClientSelectedRole(io.trino.client.ClientSelectedRole) Map(java.util.Map) Multibinder.newSetBinder(com.google.inject.multibindings.Multibinder.newSetBinder) TestingTrinoServer(io.trino.server.testing.TestingTrinoServer) Assert.assertFalse(org.testng.Assert.assertFalse) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) DataProviders(io.trino.testing.DataProviders) BeforeClass(org.testng.annotations.BeforeClass) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) Set(java.util.Set) PreparedStatement(java.sql.PreparedStatement) SchemaTableName(io.trino.spi.connector.SchemaTableName) String.format(java.lang.String.format) List(java.util.List) Optional(java.util.Optional) VARCHAR(java.sql.Types.VARCHAR) SystemTable(io.trino.spi.connector.SystemTable) Joiner(com.google.common.base.Joiner) VarcharType.createUnboundedVarcharType(io.trino.spi.type.VarcharType.createUnboundedVarcharType) Assert.assertEquals(org.testng.Assert.assertEquals) ConnectorTableMetadata(io.trino.spi.connector.ConnectorTableMetadata) SQLException(java.sql.SQLException) ImmutableList(com.google.common.collect.ImmutableList) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) Threads.daemonThreadsNamed(io.airlift.concurrent.Threads.daemonThreadsNamed) Logging(io.airlift.log.Logging) ExecutorService(java.util.concurrent.ExecutorService) AfterClass(org.testng.annotations.AfterClass) RecordCursor(io.trino.spi.connector.RecordCursor) Assert.fail(org.testng.Assert.fail) ConnectorSession(io.trino.spi.connector.ConnectorSession) TupleDomain(io.trino.spi.predicate.TupleDomain) Scopes(com.google.inject.Scopes) InMemoryRecordSet(io.trino.spi.connector.InMemoryRecordSet) UUID.randomUUID(java.util.UUID.randomUUID) Assert.assertEventually(io.trino.testing.assertions.Assert.assertEventually) Executors.newCachedThreadPool(java.util.concurrent.Executors.newCachedThreadPool) Statement(java.sql.Statement) HivePlugin(io.trino.plugin.hive.HivePlugin) Assert.assertTrue(org.testng.Assert.assertTrue) DriverManager(java.sql.DriverManager) ConnectorTransactionHandle(io.trino.spi.connector.ConnectorTransactionHandle) BlackHolePlugin(io.trino.plugin.blackhole.BlackHolePlugin) HivePlugin(io.trino.plugin.hive.HivePlugin) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) Connection(java.sql.Connection) SystemTable(io.trino.spi.connector.SystemTable) Module(com.google.inject.Module) BeforeClass(org.testng.annotations.BeforeClass)

Example 5 with BlackHolePlugin

use of io.trino.plugin.blackhole.BlackHolePlugin in project trino by trinodb.

the class TestJdbcPreparedStatement method setup.

@BeforeClass
public void setup() throws Exception {
    Logging.initialize();
    server = TestingTrinoServer.builder().setProperties(ImmutableMap.<String, String>builder().put("http-server.max-request-header-size", format("%sB", HEADER_SIZE_LIMIT)).put("http-server.max-response-header-size", format("%sB", HEADER_SIZE_LIMIT)).buildOrThrow()).build();
    server.installPlugin(new BlackHolePlugin());
    server.installPlugin(new MemoryPlugin());
    server.createCatalog("blackhole", "blackhole");
    server.createCatalog("memory", "memory");
    server.waitForNodeRefresh(Duration.ofSeconds(10));
    try (Connection connection = createConnection();
        Statement statement = connection.createStatement()) {
        statement.executeUpdate("CREATE SCHEMA blackhole.blackhole");
    }
}
Also used : BlackHolePlugin(io.trino.plugin.blackhole.BlackHolePlugin) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) Connection(java.sql.Connection) MemoryPlugin(io.trino.plugin.memory.MemoryPlugin) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

BlackHolePlugin (io.trino.plugin.blackhole.BlackHolePlugin)7 BeforeClass (org.testng.annotations.BeforeClass)6 TpchPlugin (io.trino.plugin.tpch.TpchPlugin)4 Connection (java.sql.Connection)4 Statement (java.sql.Statement)4 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 HivePlugin (io.trino.plugin.hive.HivePlugin)2 SchemaTableName (io.trino.spi.connector.SchemaTableName)2 String.format (java.lang.String.format)2 PreparedStatement (java.sql.PreparedStatement)2 Optional (java.util.Optional)2 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)2 Test (org.testng.annotations.Test)2 Joiner (com.google.common.base.Joiner)1 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)1 Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1 Scopes (com.google.inject.Scopes)1