Search in sources :

Example 21 with Plugin

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

the class TestDeltaLakePlugin method testAlluxioMetastore.

/**
 * Verify the Alluxio metastore is not supported for Delta. Delta connector extends Hive connector and Hive connector supports Alluxio metastore.
 * We explicitly disallow Alluxio metastore use with Delta.
 */
@Test
public void testAlluxioMetastore() {
    Plugin plugin = new TestingDeltaLakePlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    assertThatThrownBy(() -> factory.create("test", ImmutableMap.of("hive.metastore", "alluxio"), new TestingConnectorContext())).hasMessageMatching("(?s)Unable to create injector, see the following errors:.*" + "Explicit bindings are required and HiveMetastoreFactory .* is not explicitly bound.*");
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Plugin(io.trino.spi.Plugin) Test(org.testng.annotations.Test)

Example 22 with Plugin

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

the class TestHivePlugin method testCreateConnectorLegacyName.

@Test
public void testCreateConnectorLegacyName() {
    Plugin plugin = new HivePlugin();
    ConnectorFactory factory = stream(plugin.getConnectorFactories()).filter(x -> x.getName().equals("hive-hadoop2")).collect(toOptional()).orElseThrow();
    // simplest possible configuration
    factory.create("test", ImmutableMap.of("hive.metastore.uri", "thrift://foo:1234"), 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 23 with Plugin

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

the class TestSheetsPlugin method testCreateConnector.

@Test
public void testCreateConnector() throws Exception {
    Plugin plugin = new SheetsPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    ImmutableMap.Builder<String, String> propertiesMap = ImmutableMap.<String, String>builder().put("credentials-path", getTestCredentialsPath()).put("metadata-sheet-id", TEST_METADATA_SHEET_ID);
    Connector connector = factory.create(GOOGLE_SHEETS, propertiesMap.buildOrThrow(), new TestingConnectorContext());
    assertNotNull(connector);
    connector.shutdown();
}
Also used : Connector(io.trino.spi.connector.Connector) ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) ImmutableMap(com.google.common.collect.ImmutableMap) Plugin(io.trino.spi.Plugin) Test(org.testng.annotations.Test)

Example 24 with Plugin

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

the class TestMySqlPlugin method testCreateConnector.

@Test
public void testCreateConnector() {
    Plugin plugin = new MySqlPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    factory.create("test", ImmutableMap.of("connection-url", "jdbc:mysql://test"), new TestingConnectorContext()).shutdown();
    assertThatThrownBy(() -> factory.create("test", ImmutableMap.of("connection-url", "test"), new TestingConnectorContext())).hasMessageContaining("Invalid JDBC URL for MySQL connector");
    assertThatThrownBy(() -> factory.create("test", ImmutableMap.of("connection-url", "jdbc:mysql://test/abc"), new TestingConnectorContext())).hasMessageContaining("Database (catalog) must not be specified in JDBC URL for MySQL connector");
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Plugin(io.trino.spi.Plugin) Test(org.testng.annotations.Test)

Example 25 with Plugin

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

the class TestOraclePlugin method testCreateConnector.

@Test
public void testCreateConnector() {
    Plugin plugin = new OraclePlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    factory.create("test", ImmutableMap.of("connection-url", "jdbc:oracle:thin//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)

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