Search in sources :

Example 16 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

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.connection-url", connectionString), new TestingConnectorContext());
    Type type = getOnlyElement(plugin.getTypes());
    assertEquals(type, OBJECT_ID);
    connector.shutdown();
}
Also used : Connector(io.trino.spi.connector.Connector) Type(io.trino.spi.type.Type) ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 17 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestRaptorPlugin method testPlugin.

@Test
public void testPlugin() throws Exception {
    Plugin plugin = new RaptorPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    assertInstanceOf(factory, RaptorConnectorFactory.class);
    File tmpDir = Files.createTempDir();
    try {
        Map<String, String> config = ImmutableMap.<String, String>builder().put("metadata.db.type", "h2").put("metadata.db.filename", tmpDir.getAbsolutePath()).put("storage.data-directory", tmpDir.getAbsolutePath()).buildOrThrow();
        factory.create("test", config, new TestingConnectorContext()).shutdown();
    } finally {
        deleteRecursively(tmpDir.toPath(), ALLOW_INSECURE);
    }
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) File(java.io.File) Plugin(io.trino.spi.Plugin) Test(org.testng.annotations.Test)

Example 18 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestSingleStorePlugin method testCreateConnector.

@Test
public void testCreateConnector() {
    Plugin plugin = new SingleStorePlugin();
    ConnectorFactory factory = stream(plugin.getConnectorFactories()).filter(connectorFactory -> connectorFactory.getName().equals("singlestore")).collect(toOptional()).orElseThrow();
    factory.create("test", ImmutableMap.of("connection-url", "jdbc:singlestore://test"), new TestingConnectorContext()).shutdown();
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Plugin(io.trino.spi.Plugin) Test(org.testng.annotations.Test)

Example 19 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestIcebergConnectorFactory method createConnector.

private static void createConnector(Map<String, String> config) {
    ConnectorFactory factory = new IcebergConnectorFactory();
    factory.create("test", config, new TestingConnectorContext());
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext)

Example 20 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestIcebergPlugin method testCreateConnector.

@Test
public void testCreateConnector() {
    ConnectorFactory factory = getConnectorFactory();
    // simplest possible configuration
    factory.create("test", Map.of("hive.metastore.uri", "thrift://foo:1234"), new TestingConnectorContext()).shutdown();
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Aggregations

ConnectorFactory (io.trino.spi.connector.ConnectorFactory)66 Test (org.testng.annotations.Test)61 TestingConnectorContext (io.trino.testing.TestingConnectorContext)56 Plugin (io.trino.spi.Plugin)29 Connector (io.trino.spi.connector.Connector)13 ImmutableList (com.google.common.collect.ImmutableList)7 ImmutableMap (com.google.common.collect.ImmutableMap)7 Session (io.trino.Session)7 DistributedQueryRunner (io.trino.testing.DistributedQueryRunner)7 MockConnectorFactory (io.trino.connector.MockConnectorFactory)6 TestingSession.testSessionBuilder (io.trino.testing.TestingSession.testSessionBuilder)6 SchemaTableName (io.trino.spi.connector.SchemaTableName)5 AbstractTestQueryFramework (io.trino.testing.AbstractTestQueryFramework)5 List (java.util.List)5 Optional (java.util.Optional)5 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)5 QueryRunner (io.trino.testing.QueryRunner)4 Path (java.nio.file.Path)4 ResourceGroupManagerPlugin (io.trino.plugin.resourcegroups.ResourceGroupManagerPlugin)3 ColumnMetadata (io.trino.spi.connector.ColumnMetadata)3