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");
}
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();
}
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();
}
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");
}
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();
}
Aggregations