Java Code Examples for com.facebook.presto.spi.connector.ConnectorFactory#create()
The following examples show how to use
com.facebook.presto.spi.connector.ConnectorFactory#create() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestUtils.java From presto-kinesis with Apache License 2.0 | 6 votes |
/** * Build a connector instance from the plug in, supplying the given properties. * * This can build a connector with the mock client which is normally done in testing. * The plug in is created first with createPluginInstance. * * @param plugin * @param properties * @param withMockClient * @return */ 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)"); if (withMockClient) { plugin.setAltProviderClass(KinesisTestClientManager.class); } ConnectorFactory factory = plugin.getConnectorFactories().iterator().next(); assertNotNull(factory); Connector connector = factory.create("kinesis", properties, new TestingConnectorContext() {}); assertTrue(connector instanceof KinesisConnector); return (KinesisConnector) connector; }
Example 2
Source File: TestKuduPlugin.java From presto-kudu with Apache License 2.0 | 5 votes |
@Test public void testCreateConnector() throws Exception { Plugin plugin = new KuduPlugin(); ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories()); factory.create("test", ImmutableMap.of("kudu.client.master-addresses", "localhost:8050"), new TestingConnectorContext()); }
Example 3
Source File: TestKinesisPlugin.java From presto-kinesis with Apache License 2.0 | 5 votes |
@Parameters({ "kinesis.awsAccessKey", "kinesis.awsSecretKey" }) @Test public void testSpinUp(String awsAccessKey, String awsSecretKey) { ConnectorFactory factory = testConnectorExists(); // Important: this has to be created before we setup the injector in the factory: assertNotNull(factory.getHandleResolver()); Connector c = factory.create("kinesis.test-connector", ImmutableMap.<String, String>builder() .put("kinesis.hide-internal-columns", "false") .put("kinesis.access-key", TestUtils.noneToBlank(awsAccessKey)) .put("kinesis.secret-key", TestUtils.noneToBlank(awsSecretKey)) .build(), 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(KinesisTransactionHandle.INSTANCE); assertNotNull(md); ConnectorTransactionHandle handle = c.beginTransaction(READ_COMMITTED, true); assertTrue(handle != null && handle instanceof KinesisTransactionHandle); }