use of io.trino.testing.TestingConnectorContext 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();
}
use of io.trino.testing.TestingConnectorContext in project trino by trinodb.
the class TestKinesisPlugin method testCreateConnector.
@Test
public void testCreateConnector() {
KinesisPlugin plugin = new KinesisPlugin();
ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
String accessKey = "kinesis.accessKey";
String secretKey = "kinesis.secretKey";
Connector c = factory.create("kinesis.test-connector", ImmutableMap.<String, String>builder().put("kinesis.hide-internal-columns", "false").put("kinesis.access-key", TestUtils.noneToBlank(accessKey)).put("kinesis.secret-key", TestUtils.noneToBlank(secretKey)).buildOrThrow(), new TestingConnectorContext());
assertNotNull(c);
// Verify that the key objects have been created on the connector
assertNotNull(c.getRecordSetProvider());
assertNotNull(c.getSplitManager());
ConnectorMetadata md = c.getMetadata(SESSION, KinesisTransactionHandle.INSTANCE);
assertNotNull(md);
ConnectorTransactionHandle handle = c.beginTransaction(READ_COMMITTED, true, true);
assertTrue(handle instanceof KinesisTransactionHandle);
c.shutdown();
}
use of io.trino.testing.TestingConnectorContext 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");
}
use of io.trino.testing.TestingConnectorContext 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();
}
use of io.trino.testing.TestingConnectorContext in project trino by trinodb.
the class TestRedisPlugin method testStartup.
@Test
public void testStartup() {
RedisPlugin plugin = new RedisPlugin();
ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
assertInstanceOf(factory, RedisConnectorFactory.class);
Connector connector = factory.create("test-connector", ImmutableMap.<String, String>builder().put("redis.table-names", "test").put("redis.nodes", "localhost:6379").buildOrThrow(), new TestingConnectorContext());
assertNotNull(connector);
connector.shutdown();
}
Aggregations