Search in sources :

Example 21 with TestingConnectorContext

use of io.trino.testing.TestingConnectorContext 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 TestingConnectorContext

use of io.trino.testing.TestingConnectorContext 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 TestingConnectorContext

use of io.trino.testing.TestingConnectorContext 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 TestingConnectorContext

use of io.trino.testing.TestingConnectorContext 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 TestingConnectorContext

use of io.trino.testing.TestingConnectorContext 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

TestingConnectorContext (io.trino.testing.TestingConnectorContext)64 ConnectorFactory (io.trino.spi.connector.ConnectorFactory)56 Test (org.testng.annotations.Test)53 Plugin (io.trino.spi.Plugin)22 Connector (io.trino.spi.connector.Connector)14 HdfsEnvironment (io.trino.plugin.hive.HdfsEnvironment)5 TypeManager (io.trino.spi.type.TypeManager)5 File (java.io.File)4 Path (java.nio.file.Path)4 BeforeClass (org.testng.annotations.BeforeClass)4 TransactionLogAccess (io.trino.plugin.deltalake.transactionlog.TransactionLogAccess)3 CheckpointSchemaManager (io.trino.plugin.deltalake.transactionlog.checkpoint.CheckpointSchemaManager)3 FileFormatDataSourceStats (io.trino.plugin.hive.FileFormatDataSourceStats)3 HdfsConfig (io.trino.plugin.hive.HdfsConfig)3 HdfsConfiguration (io.trino.plugin.hive.HdfsConfiguration)3 HdfsConfigurationInitializer (io.trino.plugin.hive.HdfsConfigurationInitializer)3 HiveHdfsConfiguration (io.trino.plugin.hive.HiveHdfsConfiguration)3 NodeVersion (io.trino.plugin.hive.NodeVersion)3 NoHdfsAuthentication (io.trino.plugin.hive.authentication.NoHdfsAuthentication)3 ParquetReaderConfig (io.trino.plugin.hive.parquet.ParquetReaderConfig)3