Search in sources :

Example 1 with Plugin

use of com.facebook.presto.spi.Plugin in project presto by prestodb.

the class TestQueues method getSimpleQueryRunner.

static DistributedQueryRunner getSimpleQueryRunner() throws Exception {
    String dbConfigUrl = getDbConfigUrl();
    H2ResourceGroupsDao dao = getDao(dbConfigUrl);
    ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
    builder.put("experimental.resource-groups-enabled", "true");
    Map<String, String> properties = builder.build();
    DistributedQueryRunner queryRunner = TpchQueryRunner.createQueryRunner(properties);
    Plugin h2ResourceGroupManagerPlugin = new H2ResourceGroupManagerPlugin();
    queryRunner.installPlugin(h2ResourceGroupManagerPlugin);
    queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager(NAME, ImmutableMap.of("resource-groups.config-db-url", dbConfigUrl));
    setup(queryRunner, dao);
    return queryRunner;
}
Also used : DistributedQueryRunner(com.facebook.presto.tests.DistributedQueryRunner) H2ResourceGroupsDao(com.facebook.presto.resourceGroups.db.H2ResourceGroupsDao) ImmutableMap(com.google.common.collect.ImmutableMap) TpchPlugin(com.facebook.presto.tpch.TpchPlugin) Plugin(com.facebook.presto.spi.Plugin)

Example 2 with Plugin

use of com.facebook.presto.spi.Plugin in project presto by prestodb.

the class TestOraclePlugin method testCreateConnector.

@Test
public void testCreateConnector() {
    Plugin plugin = new OraclePlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    factory.create("test", ImmutableMap.of("connection-url", "jdbc:oracle:thin//test"), 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)

Example 3 with Plugin

use of com.facebook.presto.spi.Plugin in project presto by prestodb.

the class H2TestUtil method createQueryRunner.

public static DistributedQueryRunner createQueryRunner(String dbConfigUrl, H2ResourceGroupsDao dao, String environment, Map<String, String> coordinatorProperties, int coordinatorCount) throws Exception {
    DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(testSessionBuilder().setCatalog("tpch").setSchema("tiny").build()).setNodeCount(2).setCoordinatorCount(coordinatorCount).setEnvironment(environment).setResourceManagerEnabled(true).setCoordinatorProperties(coordinatorProperties).build();
    try {
        Plugin h2ResourceGroupManagerPlugin = new H2ResourceGroupManagerPlugin();
        queryRunner.installPlugin(h2ResourceGroupManagerPlugin);
        for (int coordinator = 0; coordinator < coordinatorCount; coordinator++) {
            queryRunner.getCoordinator(coordinator).getResourceGroupManager().get().setConfigurationManager(CONFIGURATION_MANAGER_TYPE, ImmutableMap.of("resource-groups.config-db-url", dbConfigUrl, "node.environment", environment));
        }
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch");
        setup(queryRunner, dao, environment);
        queryRunner.waitForClusterToGetReady();
        return queryRunner;
    } catch (Exception e) {
        queryRunner.close();
        throw e;
    }
}
Also used : DistributedQueryRunner(com.facebook.presto.tests.DistributedQueryRunner) TpchPlugin(com.facebook.presto.tpch.TpchPlugin) PrestoException(com.facebook.presto.spi.PrestoException) TpchPlugin(com.facebook.presto.tpch.TpchPlugin) Plugin(com.facebook.presto.spi.Plugin)

Example 4 with Plugin

use of com.facebook.presto.spi.Plugin in project presto by prestodb.

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(com.facebook.presto.spi.connector.ConnectorFactory) TestingConnectorContext(com.facebook.presto.testing.TestingConnectorContext) Plugin(com.facebook.presto.spi.Plugin) Test(org.testng.annotations.Test)

Example 5 with Plugin

use of com.facebook.presto.spi.Plugin in project presto by prestodb.

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(com.facebook.presto.spi.connector.ConnectorFactory) TestingConnectorContext(com.facebook.presto.testing.TestingConnectorContext) Plugin(com.facebook.presto.spi.Plugin) Test(org.testng.annotations.Test)

Aggregations

Plugin (com.facebook.presto.spi.Plugin)13 ConnectorFactory (com.facebook.presto.spi.connector.ConnectorFactory)8 Test (org.testng.annotations.Test)8 TestingConnectorContext (com.facebook.presto.testing.TestingConnectorContext)7 ImmutableMap (com.google.common.collect.ImmutableMap)4 DistributedQueryRunner (com.facebook.presto.tests.DistributedQueryRunner)3 TpchPlugin (com.facebook.presto.tpch.TpchPlugin)3 Session (com.facebook.presto.Session)1 TEST_SESSION (com.facebook.presto.SessionTestUtils.TEST_SESSION)1 IGNORE_STATS_CALCULATOR_FAILURES (com.facebook.presto.SystemSessionProperties.IGNORE_STATS_CALCULATOR_FAILURES)1 MockConnectorFactory (com.facebook.presto.connector.MockConnectorFactory)1 DispatchManager (com.facebook.presto.dispatcher.DispatchManager)1 FAILED (com.facebook.presto.execution.QueryState.FAILED)1 RUNNING (com.facebook.presto.execution.QueryState.RUNNING)1 TestingSessionContext (com.facebook.presto.execution.TestingSessionContext)1 MetadataManager (com.facebook.presto.metadata.MetadataManager)1 H2ResourceGroupsDao (com.facebook.presto.resourceGroups.db.H2ResourceGroupsDao)1 BasicQueryInfo (com.facebook.presto.server.BasicQueryInfo)1 Catalog (com.facebook.presto.server.testing.TestingPrestoServerLauncherOptions.Catalog)1 ConnectorId (com.facebook.presto.spi.ConnectorId)1