Search in sources :

Example 1 with Plugin

use of io.prestosql.spi.Plugin 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());
}
Also used : ConnectorFactory(io.prestosql.spi.connector.ConnectorFactory) TestingConnectorContext(io.prestosql.testing.TestingConnectorContext) Plugin(io.prestosql.spi.Plugin) Test(org.testng.annotations.Test)

Example 2 with Plugin

use of io.prestosql.spi.Plugin 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());
}
Also used : ConnectorFactory(io.prestosql.spi.connector.ConnectorFactory) TestingConnectorContext(io.prestosql.testing.TestingConnectorContext) Plugin(io.prestosql.spi.Plugin) Test(org.testng.annotations.Test)

Example 3 with Plugin

use of io.prestosql.spi.Plugin in project hetu-core by openlookeng.

the class TestingPrestoServerLauncher method run.

public void run() throws Exception {
    try (TestingPrestoServer server = new TestingPrestoServer()) {
        for (String pluginClass : options.getPluginClassNames()) {
            Plugin plugin = (Plugin) Class.forName(pluginClass).getConstructor().newInstance();
            server.installPlugin(plugin);
        }
        for (Catalog catalog : options.getCatalogs()) {
            server.createCatalog(catalog.getCatalogName(), catalog.getConnectorName());
        }
        System.out.println(server.getAddress());
        waitForInterruption();
    }
}
Also used : Catalog(io.prestosql.server.testing.TestingPrestoServerLauncherOptions.Catalog) Plugin(io.prestosql.spi.Plugin)

Example 4 with Plugin

use of io.prestosql.spi.Plugin 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());
}
Also used : ConnectorFactory(io.prestosql.spi.connector.ConnectorFactory) TestingConnectorContext(io.prestosql.testing.TestingConnectorContext) Plugin(io.prestosql.spi.Plugin) Test(org.testng.annotations.Test)

Example 5 with Plugin

use of io.prestosql.spi.Plugin in project hetu-core by openlookeng.

the class TestHetuEventListenerPlugin method testCreateConnector4.

@Test
public void testCreateConnector4() {
    Plugin plugin = new io.hetu.core.eventlistener.HetuEventListenerPlugin();
    EventListenerFactory factory = getOnlyElement(plugin.getEventListenerFactories());
    EventListener listener = factory.create(ImmutableMap.of("hetu.event.listener.type", "LOGGER", "hetu.event.listener.listen.query.creation", "true"));
}
Also used : EventListenerFactory(io.prestosql.spi.eventlistener.EventListenerFactory) BaseEventListener(io.hetu.core.eventlistener.listeners.BaseEventListener) EventListener(io.prestosql.spi.eventlistener.EventListener) Plugin(io.prestosql.spi.Plugin) Test(org.testng.annotations.Test)

Aggregations

Plugin (io.prestosql.spi.Plugin)17 Test (org.testng.annotations.Test)13 ConnectorFactory (io.prestosql.spi.connector.ConnectorFactory)9 TestingConnectorContext (io.prestosql.testing.TestingConnectorContext)8 BaseEventListener (io.hetu.core.eventlistener.listeners.BaseEventListener)4 EventListener (io.prestosql.spi.eventlistener.EventListener)4 EventListenerFactory (io.prestosql.spi.eventlistener.EventListenerFactory)4 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 TEST_SESSION (io.prestosql.SessionTestUtils.TEST_SESSION)1 MockConnectorFactory (io.prestosql.connector.MockConnectorFactory)1 DispatchManager (io.prestosql.dispatcher.DispatchManager)1 FAILED (io.prestosql.execution.QueryState.FAILED)1 RUNNING (io.prestosql.execution.QueryState.RUNNING)1 TestingSessionContext (io.prestosql.execution.TestingSessionContext)1 MetadataManager (io.prestosql.metadata.MetadataManager)1 TpchPlugin (io.prestosql.plugin.tpch.TpchPlugin)1 BasicQueryInfo (io.prestosql.server.BasicQueryInfo)1 Catalog (io.prestosql.server.testing.TestingPrestoServerLauncherOptions.Catalog)1 PrestoException (io.prestosql.spi.PrestoException)1