Search in sources :

Example 56 with TestingConnectorContext

use of io.trino.testing.TestingConnectorContext in project trino by trinodb.

the class TestKafkaPlugin method testSslKeystoreMissingFileSpindown.

@Test
public void testSslKeystoreMissingFileSpindown() throws IOException {
    KafkaPlugin plugin = new KafkaPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    assertInstanceOf(factory, KafkaConnectorFactory.class);
    Path truststorePath = 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", "/not/a/real/path").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())).hasMessageContaining("Error: Invalid configuration property kafka.ssl.keystore.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 57 with TestingConnectorContext

use of io.trino.testing.TestingConnectorContext in project trino by trinodb.

the class TestKafkaPlugin method testSpinup.

@Test
public void testSpinup() {
    KafkaPlugin plugin = new KafkaPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    assertInstanceOf(factory, KafkaConnectorFactory.class);
    Connector connector = factory.create("test-connector", ImmutableMap.<String, String>builder().put("kafka.table-names", "test").put("kafka.nodes", "localhost:9092").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) Test(org.testng.annotations.Test)

Example 58 with TestingConnectorContext

use of io.trino.testing.TestingConnectorContext in project trino by trinodb.

the class TestSqlServerPlugin method testCreateConnector.

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

use of io.trino.testing.TestingConnectorContext in project trino by trinodb.

the class TestUtils method createConnector.

public static KinesisConnector createConnector(KinesisPlugin plugin, Map<String, String> properties, boolean withMockClient) {
    requireNonNull(plugin, "Plugin instance should not be null");
    requireNonNull(properties, "Properties map should not be null (can be empty)");
    ConnectorFactory factory = plugin.getConnectorFactories().iterator().next();
    assertNotNull(factory);
    Connector connector = factory.create("kinesis", properties, new TestingConnectorContext());
    return (KinesisConnector) connector;
}
Also used : KinesisConnector(io.trino.plugin.kinesis.KinesisConnector) Connector(io.trino.spi.connector.Connector) TestingKinesisConnectorFactory(io.trino.plugin.kinesis.TestingKinesisConnectorFactory) KinesisConnectorFactory(io.trino.plugin.kinesis.KinesisConnectorFactory) ConnectorFactory(io.trino.spi.connector.ConnectorFactory) KinesisConnector(io.trino.plugin.kinesis.KinesisConnector) TestingConnectorContext(io.trino.testing.TestingConnectorContext)

Example 60 with TestingConnectorContext

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

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