Search in sources :

Example 31 with Plugin

use of io.trino.spi.Plugin in project trino by trinodb.

the class TestPhoenixPlugin method testCreateConnector.

@Test
public void testCreateConnector() {
    Plugin plugin = new PhoenixPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    factory.create("test", ImmutableMap.of("phoenix.connection-url", "jdbc:phoenix:test"), new TestingConnectorContext()).shutdown();
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Plugin(io.trino.spi.Plugin) Test(org.testng.annotations.Test)

Example 32 with Plugin

use of io.trino.spi.Plugin in project trino by trinodb.

the class TestSingleStorePlugin method testCreateConnectorLegacyName.

@Test
public void testCreateConnectorLegacyName() {
    Plugin plugin = new SingleStorePlugin();
    ConnectorFactory factory = stream(plugin.getConnectorFactories()).filter(connectorFactory -> connectorFactory.getName().equals("memsql")).collect(toOptional()).orElseThrow();
    factory.create("test", ImmutableMap.of("connection-url", "jdbc:singlestore://test"), new TestingConnectorContext()).shutdown();
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Plugin(io.trino.spi.Plugin) Test(org.testng.annotations.Test)

Example 33 with Plugin

use of io.trino.spi.Plugin in project trino by trinodb.

the class TestPostgreSqlPlugin method testCreateConnector.

@Test
public void testCreateConnector() {
    Plugin plugin = new PostgreSqlPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    factory.create("test", ImmutableMap.of("connection-url", "jdbc:postgresql:test"), new TestingConnectorContext()).shutdown();
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Plugin(io.trino.spi.Plugin) Test(org.testng.annotations.Test)

Example 34 with Plugin

use of io.trino.spi.Plugin in project trino by trinodb.

the class TestThriftPlugin method testPlugin.

@Test
public void testPlugin() {
    Plugin plugin = new ThriftPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    assertInstanceOf(factory, ThriftConnectorFactory.class);
    Map<String, String> config = ImmutableMap.of("trino.thrift.client.addresses", "localhost:7779");
    Connector connector = factory.create("test", config, new TestingConnectorContext());
    assertNotNull(connector);
    assertInstanceOf(connector, ThriftConnector.class);
    connector.shutdown();
}
Also used : Connector(io.trino.spi.connector.Connector) ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Plugin(io.trino.spi.Plugin) Test(org.testng.annotations.Test)

Aggregations

Plugin (io.trino.spi.Plugin)34 ConnectorFactory (io.trino.spi.connector.ConnectorFactory)29 Test (org.testng.annotations.Test)28 TestingConnectorContext (io.trino.testing.TestingConnectorContext)22 ImmutableList (com.google.common.collect.ImmutableList)8 ImmutableMap (com.google.common.collect.ImmutableMap)8 DistributedQueryRunner (io.trino.testing.DistributedQueryRunner)8 Session (io.trino.Session)7 TestingSession.testSessionBuilder (io.trino.testing.TestingSession.testSessionBuilder)7 MockConnectorFactory (io.trino.connector.MockConnectorFactory)6 List (java.util.List)6 Optional (java.util.Optional)6 SchemaTableName (io.trino.spi.connector.SchemaTableName)5 AbstractTestQueryFramework (io.trino.testing.AbstractTestQueryFramework)5 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)5 TpchPlugin (io.trino.plugin.tpch.TpchPlugin)4 QueryRunner (io.trino.testing.QueryRunner)4 ColumnMetadata (io.trino.spi.connector.ColumnMetadata)3 Connector (io.trino.spi.connector.Connector)3 BIGINT (io.trino.spi.type.BigintType.BIGINT)3