Search in sources :

Example 21 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestIcebergPlugin method testGlueMetastore.

@Test
public void testGlueMetastore() {
    ConnectorFactory factory = getConnectorFactory();
    factory.create("test", Map.of("iceberg.catalog.type", "glue", "hive.metastore.glue.region", "us-east-1"), new TestingConnectorContext()).shutdown();
    assertThatThrownBy(() -> factory.create("test", Map.of("iceberg.catalog.type", "glue", "hive.metastore.uri", "thrift://foo:1234"), new TestingConnectorContext())).hasMessageContaining("Error: Configuration property 'hive.metastore.uri' was not used");
    assertThatThrownBy(() -> factory.create("test", Map.of("iceberg.catalog.type", "glue", "hive.metastore.glue.catalogid", "123", "hive.metastore.glue.region", "us-east-1"), new TestingConnectorContext())).hasMessageContaining("catalogId configuration is not supported");
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 22 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestIcebergPlugin method testReadOnlyAllAccessControl.

@Test
public void testReadOnlyAllAccessControl() {
    ConnectorFactory connectorFactory = getConnectorFactory();
    connectorFactory.create("test", ImmutableMap.<String, String>builder().put("iceberg.catalog.type", "HIVE_METASTORE").put("hive.metastore.uri", "thrift://foo:1234").put("iceberg.security", "read-only").buildOrThrow(), new TestingConnectorContext()).shutdown();
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 23 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestKafkaPlugin method testSslSpinup.

@Test
public void testSslSpinup() throws IOException {
    KafkaPlugin plugin = new KafkaPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    assertInstanceOf(factory, KafkaConnectorFactory.class);
    String secret = "confluent";
    Path keystorePath = Files.createTempFile("keystore", ".jks");
    Path truststorePath = Files.createTempFile("truststore", ".jks");
    writeToFile(keystorePath, secret);
    writeToFile(truststorePath, secret);
    Connector connector = factory.create("test-connector", ImmutableMap.<String, String>builder().put("kafka.table-names", "test").put("kafka.nodes", "localhost:9092").put("kafka.security-protocol", "SSL").put("kafka.ssl.keystore.type", "JKS").put("kafka.ssl.keystore.location", keystorePath.toString()).put("kafka.ssl.keystore.password", "keystore-password").put("kafka.ssl.key.password", "key-password").put("kafka.ssl.truststore.type", "JKS").put("kafka.ssl.truststore.location", truststorePath.toString()).put("kafka.ssl.truststore.password", "truststore-password").put("kafka.ssl.endpoint-identification-algorithm", "https").buildOrThrow(), new TestingConnectorContext());
    assertNotNull(connector);
    connector.shutdown();
}
Also used : Path(java.nio.file.Path) Connector(io.trino.spi.connector.Connector) ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 24 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestKafkaPlugin method testSslTruststoreMissingFileSpindown.

@Test
public void testSslTruststoreMissingFileSpindown() throws IOException {
    KafkaPlugin plugin = new KafkaPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    assertInstanceOf(factory, KafkaConnectorFactory.class);
    Path keystorePath = Files.createTempFile("test", ".jks");
    assertThatThrownBy(() -> factory.create("test-connector", ImmutableMap.<String, String>builder().put("kafka.table-names", "test").put("kafka.nodes", "localhost:9092").put("kafka.security-protocol", "SSL").put("kafka.ssl.keystore.type", "JKS").put("kafka.ssl.keystore.location", keystorePath.toString()).put("kafka.ssl.keystore.password", "keystore-password").put("kafka.ssl.key.password", "key-password").put("kafka.ssl.truststore.type", "JKS").put("kafka.ssl.truststore.location", "/not/a/real/path").put("kafka.ssl.truststore.password", "truststore-password").put("kafka.ssl.endpoint-identification-algorithm", "https").buildOrThrow(), new TestingConnectorContext())).hasMessageContaining("Error: Invalid configuration property kafka.ssl.truststore.location: file does not exist: /not/a/real/path");
}
Also used : Path(java.nio.file.Path) ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 25 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestRedshiftPlugin method testCreateConnector.

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

ConnectorFactory (io.trino.spi.connector.ConnectorFactory)66 Test (org.testng.annotations.Test)61 TestingConnectorContext (io.trino.testing.TestingConnectorContext)56 Plugin (io.trino.spi.Plugin)29 Connector (io.trino.spi.connector.Connector)13 ImmutableList (com.google.common.collect.ImmutableList)7 ImmutableMap (com.google.common.collect.ImmutableMap)7 Session (io.trino.Session)7 DistributedQueryRunner (io.trino.testing.DistributedQueryRunner)7 MockConnectorFactory (io.trino.connector.MockConnectorFactory)6 TestingSession.testSessionBuilder (io.trino.testing.TestingSession.testSessionBuilder)6 SchemaTableName (io.trino.spi.connector.SchemaTableName)5 AbstractTestQueryFramework (io.trino.testing.AbstractTestQueryFramework)5 List (java.util.List)5 Optional (java.util.Optional)5 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)5 QueryRunner (io.trino.testing.QueryRunner)4 Path (java.nio.file.Path)4 ResourceGroupManagerPlugin (io.trino.plugin.resourcegroups.ResourceGroupManagerPlugin)3 ColumnMetadata (io.trino.spi.connector.ColumnMetadata)3