Search in sources :

Example 1 with TpchPlugin

use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.

the class TestJdbcExternalAuthentication method setup.

@BeforeClass
public void setup() throws Exception {
    Logging.initialize();
    server = TestingTrinoServer.builder().setAdditionalModule(new DummyExternalAuthModule(() -> server.getAddress().getPort())).setProperties(ImmutableMap.<String, String>builder().put("http-server.authentication.type", "dummy-external").put("http-server.https.enabled", "true").put("http-server.https.keystore.path", new File(getResource("localhost.keystore").toURI()).getPath()).put("http-server.https.keystore.key", "changeit").put("web-ui.enabled", "false").buildOrThrow()).build();
    server.installPlugin(new TpchPlugin());
    server.createCatalog(TEST_CATALOG, "tpch");
    server.waitForNodeRefresh(Duration.ofSeconds(10));
}
Also used : TpchPlugin(io.trino.plugin.tpch.TpchPlugin) File(java.io.File) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with TpchPlugin

use of io.trino.plugin.tpch.TpchPlugin 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 TpchPlugin

use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.

the class TestTrinoDriverAuth method setup.

@BeforeClass
public void setup() throws Exception {
    Logging.initialize();
    URL resource = getClass().getClassLoader().getResource("33.privateKey");
    assertNotNull(resource, "key directory not found");
    File keyDir = new File(resource.getFile()).getAbsoluteFile().getParentFile();
    defaultKey = hmacShaKeyFor(getMimeDecoder().decode(asCharSource(new File(keyDir, "default-key.key"), US_ASCII).read().getBytes(US_ASCII)));
    hmac222 = hmacShaKeyFor(getMimeDecoder().decode(asCharSource(new File(keyDir, "222.key"), US_ASCII).read().getBytes(US_ASCII)));
    privateKey33 = PemReader.loadPrivateKey(new File(keyDir, "33.privateKey"), Optional.empty());
    server = TestingTrinoServer.builder().setProperties(ImmutableMap.<String, String>builder().put("http-server.authentication.type", "JWT").put("http-server.authentication.jwt.key-file", new File(keyDir, "${KID}.key").getPath()).put("http-server.https.enabled", "true").put("http-server.https.keystore.path", new File(getResource("localhost.keystore").toURI()).getPath()).put("http-server.https.keystore.key", "changeit").buildOrThrow()).build();
    server.installPlugin(new TpchPlugin());
    server.createCatalog(TEST_CATALOG, "tpch");
    server.waitForNodeRefresh(Duration.ofSeconds(10));
}
Also used : TpchPlugin(io.trino.plugin.tpch.TpchPlugin) File(java.io.File) URL(java.net.URL) BeforeClass(org.testng.annotations.BeforeClass)

Example 4 with TpchPlugin

use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.

the class CassandraQueryRunner method createCassandraQueryRunner.

public static DistributedQueryRunner createCassandraQueryRunner(CassandraServer server, Map<String, String> extraProperties, Iterable<TpchTable<?>> tables) throws Exception {
    DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(createCassandraSession("tpch")).setExtraProperties(extraProperties).build();
    queryRunner.installPlugin(new TpchPlugin());
    queryRunner.createCatalog("tpch", "tpch");
    queryRunner.installPlugin(new CassandraPlugin());
    queryRunner.createCatalog("cassandra", "cassandra", ImmutableMap.of("cassandra.contact-points", server.getHost(), "cassandra.native-protocol-port", Integer.toString(server.getPort()), "cassandra.allow-drop-table", "true"));
    createKeyspace(server.getSession(), "tpch");
    copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createCassandraSession("tpch"), tables);
    for (TpchTable<?> table : tables) {
        server.refreshSizeEstimates("tpch", table.getTableName());
    }
    return queryRunner;
}
Also used : DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) TpchPlugin(io.trino.plugin.tpch.TpchPlugin)

Example 5 with TpchPlugin

use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.

the class ScyllaQueryRunner method createScyllaQueryRunner.

public static DistributedQueryRunner createScyllaQueryRunner(TestingScyllaServer server, Map<String, String> extraProperties, Map<String, String> connectorProperties, Iterable<TpchTable<?>> tables) throws Exception {
    DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(createSession("tpch")).setExtraProperties(extraProperties).build();
    try {
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch");
        connectorProperties = new HashMap<>(ImmutableMap.copyOf(connectorProperties));
        connectorProperties.putIfAbsent("cassandra.contact-points", server.getHost());
        connectorProperties.putIfAbsent("cassandra.native-protocol-port", Integer.toString(server.getPort()));
        connectorProperties.putIfAbsent("cassandra.allow-drop-table", "true");
        queryRunner.installPlugin(new CassandraPlugin());
        queryRunner.createCatalog("cassandra", "cassandra", connectorProperties);
        createKeyspace(server.getSession(), "tpch");
        copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession("tpch"), tables);
        for (TpchTable<?> table : tables) {
            server.refreshSizeEstimates("tpch", table.getTableName());
        }
        return queryRunner;
    } catch (Throwable e) {
        closeAllSuppress(e, queryRunner);
        throw e;
    }
}
Also used : DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) TpchPlugin(io.trino.plugin.tpch.TpchPlugin)

Aggregations

TpchPlugin (io.trino.plugin.tpch.TpchPlugin)49 DistributedQueryRunner (io.trino.testing.DistributedQueryRunner)39 Session (io.trino.Session)16 BeforeClass (org.testng.annotations.BeforeClass)8 ImmutableList (com.google.common.collect.ImmutableList)7 ImmutableMap (com.google.common.collect.ImmutableMap)7 QueryRunner (io.trino.testing.QueryRunner)7 TestingSession.testSessionBuilder (io.trino.testing.TestingSession.testSessionBuilder)7 File (java.io.File)7 ImmutableSet (com.google.common.collect.ImmutableSet)6 SchemaTableName (io.trino.spi.connector.SchemaTableName)6 AbstractTestQueryFramework (io.trino.testing.AbstractTestQueryFramework)6 Optional (java.util.Optional)6 Test (org.testng.annotations.Test)6 MockConnectorFactory (io.trino.connector.MockConnectorFactory)5 Plugin (io.trino.spi.Plugin)5 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)4 MockConnectorTableHandle (io.trino.connector.MockConnectorTableHandle)3 BlackHolePlugin (io.trino.plugin.blackhole.BlackHolePlugin)3 BIGINT (io.trino.spi.type.BigintType.BIGINT)3