use of com.facebook.presto.testing.TestingConnectorContext in project presto by prestodb.
the class TestTransactionManager method testAbortedTransactionWorkflow.
@Test
public void testAbortedTransactionWorkflow() throws Exception {
try (IdleCheckExecutor executor = new IdleCheckExecutor()) {
CatalogManager catalogManager = new CatalogManager();
TransactionManager transactionManager = TransactionManager.create(new TransactionManagerConfig(), executor.getExecutor(), catalogManager, finishingExecutor);
Connector c1 = new TpchConnectorFactory().create(CATALOG_NAME, ImmutableMap.of(), new TestingConnectorContext());
registerConnector(catalogManager, transactionManager, CATALOG_NAME, CONNECTOR_ID, c1);
TransactionId transactionId = transactionManager.beginTransaction(false);
assertEquals(transactionManager.getAllTransactionInfos().size(), 1);
TransactionInfo transactionInfo = transactionManager.getTransactionInfo(transactionId);
assertFalse(transactionInfo.isAutoCommitContext());
assertTrue(transactionInfo.getConnectorIds().isEmpty());
assertFalse(transactionInfo.getWrittenConnectorId().isPresent());
ConnectorMetadata metadata = transactionManager.getOptionalCatalogMetadata(transactionId, CATALOG_NAME).get().getMetadata();
metadata.listSchemaNames(TEST_SESSION.toConnectorSession(CONNECTOR_ID));
transactionInfo = transactionManager.getTransactionInfo(transactionId);
assertEquals(transactionInfo.getConnectorIds(), ImmutableList.of(CONNECTOR_ID, INFORMATION_SCHEMA_ID, SYSTEM_TABLES_ID));
assertFalse(transactionInfo.getWrittenConnectorId().isPresent());
getFutureValue(transactionManager.asyncAbort(transactionId));
assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
}
}
use of com.facebook.presto.testing.TestingConnectorContext in project presto by prestodb.
the class TestJdbcConnectorFactory method test.
@Test
public void test() throws Exception {
JdbcConnectorFactory connectorFactory = new JdbcConnectorFactory("test", new TestingH2JdbcModule(), getClass().getClassLoader());
connectorFactory.create("test", TestingH2JdbcModule.createProperties(), new TestingConnectorContext());
}
use of com.facebook.presto.testing.TestingConnectorContext in project presto by prestodb.
the class TestKafkaPlugin method testSpinup.
@Test
public void testSpinup() {
KafkaPlugin plugin = new KafkaPlugin();
ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
assertInstanceOf(factory, KafkaConnectorFactory.class);
Connector c = factory.create("test-connector", ImmutableMap.<String, String>builder().put("kafka.table-names", "test").put("kafka.nodes", "localhost:9092").build(), new TestingConnectorContext());
assertNotNull(c);
}
Aggregations