Search in sources :

Example 11 with ConnectorFactory

use of com.facebook.presto.spi.connector.ConnectorFactory in project presto by prestodb.

the class ConnectorManager method createConnection.

public synchronized ConnectorId createConnection(String catalogName, String connectorName, Map<String, String> properties) {
    requireNonNull(connectorName, "connectorName is null");
    ConnectorFactory connectorFactory = connectorFactories.get(connectorName);
    checkArgument(connectorFactory != null, "No factory for connector %s", connectorName);
    return createConnection(catalogName, connectorFactory, properties);
}
Also used : ConnectorFactory(com.facebook.presto.spi.connector.ConnectorFactory)

Example 12 with ConnectorFactory

use of com.facebook.presto.spi.connector.ConnectorFactory in project presto by prestodb.

the class TestMongoPlugin method testCreateConnector.

@Test
public void testCreateConnector() {
    MongoPlugin plugin = new MongoPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    Connector connector = factory.create("test", ImmutableMap.of("mongodb.seeds", seed), new TestingConnectorContext());
    Type type = getOnlyElement(plugin.getTypes());
    assertEquals(type, OBJECT_ID);
    connector.shutdown();
}
Also used : Connector(com.facebook.presto.spi.connector.Connector) Type(com.facebook.presto.common.type.Type) ConnectorFactory(com.facebook.presto.spi.connector.ConnectorFactory) TestingConnectorContext(com.facebook.presto.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 13 with ConnectorFactory

use of com.facebook.presto.spi.connector.ConnectorFactory in project presto by prestodb.

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 = new ImmutableMap.Builder<String, String>().put("credentials-path", getTestCredentialsPath()).put("metadata-sheet-id", TEST_METADATA_SHEET_ID);
    Connector connector = factory.create(GOOGLE_SHEETS, propertiesMap.build(), new TestingConnectorContext());
    assertNotNull(connector);
    connector.shutdown();
}
Also used : Connector(com.facebook.presto.spi.connector.Connector) ConnectorFactory(com.facebook.presto.spi.connector.ConnectorFactory) TestingConnectorContext(com.facebook.presto.testing.TestingConnectorContext) ImmutableMap(com.google.common.collect.ImmutableMap) Plugin(com.facebook.presto.spi.Plugin) Test(org.testng.annotations.Test)

Example 14 with ConnectorFactory

use of com.facebook.presto.spi.connector.ConnectorFactory 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);
}
Also used : Connector(com.facebook.presto.spi.connector.Connector) ConnectorFactory(com.facebook.presto.spi.connector.ConnectorFactory) TestingConnectorContext(com.facebook.presto.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 15 with ConnectorFactory

use of com.facebook.presto.spi.connector.ConnectorFactory in project presto by prestodb.

the class TestKuduPlugin method testCreateConnector.

@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:7051"), new TestingConnectorContext());
}
Also used : ConnectorFactory(com.facebook.presto.spi.connector.ConnectorFactory) TestingConnectorContext(com.facebook.presto.testing.TestingConnectorContext) Plugin(com.facebook.presto.spi.Plugin) Test(org.testng.annotations.Test)

Aggregations

ConnectorFactory (com.facebook.presto.spi.connector.ConnectorFactory)20 Test (org.testng.annotations.Test)14 TestingConnectorContext (com.facebook.presto.testing.TestingConnectorContext)12 Plugin (com.facebook.presto.spi.Plugin)8 Connector (com.facebook.presto.spi.connector.Connector)6 Session (com.facebook.presto.Session)3 Type (com.facebook.presto.common.type.Type)2 MetadataManager (com.facebook.presto.metadata.MetadataManager)2 ConnectorId (com.facebook.presto.spi.ConnectorId)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 Logger (com.facebook.airlift.log.Logger)1 NodeInfo (com.facebook.airlift.node.NodeInfo)1 TEST_SESSION (com.facebook.presto.SessionTestUtils.TEST_SESSION)1 IGNORE_STATS_CALCULATOR_FAILURES (com.facebook.presto.SystemSessionProperties.IGNORE_STATS_CALCULATOR_FAILURES)1 BlockEncoding (com.facebook.presto.common.block.BlockEncoding)1 BlockEncodingSerde (com.facebook.presto.common.block.BlockEncodingSerde)1 ParametricType (com.facebook.presto.common.type.ParametricType)1 TypeManager (com.facebook.presto.common.type.TypeManager)1 MockConnectorFactory (com.facebook.presto.connector.MockConnectorFactory)1 InformationSchemaConnector (com.facebook.presto.connector.informationSchema.InformationSchemaConnector)1