use of io.prestosql.testing.TestingConnectorContext in project hetu-core by openlookeng.
the class TestPostgreSqlPlugin method testCreateConnector.
@Test
public void testCreateConnector() {
Plugin plugin = new PostgreSqlPlugin();
ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
factory.create("test", ImmutableMap.of("connection-url", "test"), new TestingConnectorContext());
}
use of io.prestosql.testing.TestingConnectorContext in project hetu-core by openlookeng.
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());
}
use of io.prestosql.testing.TestingConnectorContext in project hetu-core by openlookeng.
the class TestThriftPlugin method testPlugin.
@Test
public void testPlugin() {
ThriftPlugin plugin = loadPlugin(ThriftPlugin.class);
ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
assertInstanceOf(factory, ThriftConnectorFactory.class);
Map<String, String> config = ImmutableMap.of("presto.thrift.client.addresses", "localhost:7779");
Connector connector = factory.create("test", config, new TestingConnectorContext());
assertNotNull(connector);
assertInstanceOf(connector, ThriftConnector.class);
}
use of io.prestosql.testing.TestingConnectorContext in project hetu-core by openlookeng.
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", "test"), new TestingConnectorContext());
}
use of io.prestosql.testing.TestingConnectorContext in project hetu-core by openlookeng.
the class TestTransactionManager method testAbortedTransactionWorkflow.
@Test
public void testAbortedTransactionWorkflow() {
try (IdleCheckExecutor executor = new IdleCheckExecutor()) {
CatalogManager catalogManager = new CatalogManager();
TransactionManager transactionManager = InMemoryTransactionManager.create(new TransactionManagerConfig(), executor.getExecutor(), catalogManager, finishingExecutor);
Connector c1 = new TpchConnectorFactory().create(CATALOG, ImmutableMap.of(), new TestingConnectorContext());
registerConnector(catalogManager, transactionManager, CATALOG, CATALOG_NAME, c1);
TransactionId transactionId = transactionManager.beginTransaction(false);
assertEquals(transactionManager.getAllTransactionInfos().size(), 1);
TransactionInfo transactionInfo = transactionManager.getTransactionInfo(transactionId);
assertFalse(transactionInfo.isAutoCommitContext());
assertTrue(transactionInfo.getCatalogNames().isEmpty());
assertFalse(transactionInfo.getWrittenConnectorId().isPresent());
ConnectorMetadata metadata = transactionManager.getOptionalCatalogMetadata(transactionId, CATALOG).get().getMetadata();
metadata.listSchemaNames(TEST_SESSION.toConnectorSession(CATALOG_NAME));
transactionInfo = transactionManager.getTransactionInfo(transactionId);
assertEquals(transactionInfo.getCatalogNames(), ImmutableList.of(CATALOG_NAME, INFORMATION_SCHEMA_ID, SYSTEM_TABLES_ID));
assertFalse(transactionInfo.getWrittenConnectorId().isPresent());
getFutureValue(transactionManager.asyncAbort(transactionId));
assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
}
}
Aggregations