Search in sources :

Example 1 with BlackHolePlugin

use of com.facebook.presto.plugin.blackhole.BlackHolePlugin in project presto by prestodb.

the class TestProxyServer method setupServer.

@BeforeClass
public void setupServer() throws Exception {
    byte[] sharedSecret = Base64.getMimeEncoder().encode("test secret".getBytes(US_ASCII));
    sharedSecretFile = Files.createTempFile("secret", "txt");
    Files.write(sharedSecretFile, sharedSecret);
    Logging.initialize();
    server = new TestingPrestoServer();
    server.installPlugin(new TpchPlugin());
    server.createCatalog("tpch", "tpch");
    server.installPlugin(new BlackHolePlugin());
    server.createCatalog("blackhole", "blackhole");
    server.refreshNodes();
    Bootstrap app = new Bootstrap(new TestingNodeModule("test"), new TestingHttpServerModule(), new JsonModule(), new JaxrsModule(true), new TestingJmxModule(), new ProxyModule());
    Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperty("proxy.uri", server.getBaseUrl().toString()).setRequiredConfigurationProperty("proxy.shared-secret-file", sharedSecretFile.toString()).quiet().initialize();
    lifeCycleManager = injector.getInstance(LifeCycleManager.class);
    httpServerInfo = injector.getInstance(HttpServerInfo.class);
    executorService = newCachedThreadPool(daemonThreadsNamed("test-%s"));
    setupTestTable();
}
Also used : TestingHttpServerModule(com.facebook.airlift.http.server.testing.TestingHttpServerModule) TpchPlugin(com.facebook.presto.tpch.TpchPlugin) TestingNodeModule(com.facebook.airlift.node.testing.TestingNodeModule) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) JaxrsModule(com.facebook.airlift.jaxrs.JaxrsModule) JsonModule(com.facebook.airlift.json.JsonModule) TestingJmxModule(com.facebook.airlift.jmx.testing.TestingJmxModule) LifeCycleManager(com.facebook.airlift.bootstrap.LifeCycleManager) BlackHolePlugin(com.facebook.presto.plugin.blackhole.BlackHolePlugin) Injector(com.google.inject.Injector) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap) HttpServerInfo(com.facebook.airlift.http.server.HttpServerInfo) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with BlackHolePlugin

use of com.facebook.presto.plugin.blackhole.BlackHolePlugin in project presto by prestodb.

the class TestJdbcWarnings method setupServer.

@BeforeClass
public void setupServer() throws Exception {
    server = new TestingPrestoServer(true, ImmutableMap.<String, String>builder().put("testing-warning-collector.add-warnings", "true").put("testing-warning-collector.preloaded-warnings", String.valueOf(PRELOADED_WARNINGS)).build(), null, null, new SqlParserOptions(), ImmutableList.of());
    server.installPlugin(new TpchPlugin());
    server.createCatalog("tpch", "tpch");
    server.installPlugin(new BlackHolePlugin());
    server.createCatalog("blackhole", "blackhole");
    waitForNodeRefresh(server);
}
Also used : SqlParserOptions(com.facebook.presto.sql.parser.SqlParserOptions) BlackHolePlugin(com.facebook.presto.plugin.blackhole.BlackHolePlugin) TpchPlugin(com.facebook.presto.tpch.TpchPlugin) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with BlackHolePlugin

use of com.facebook.presto.plugin.blackhole.BlackHolePlugin in project presto by prestodb.

the class TestJdbcPreparedStatement method setup.

@BeforeClass
public void setup() throws Exception {
    Logging.initialize();
    server = new TestingPrestoServer();
    server.installPlugin(new BlackHolePlugin());
    server.createCatalog("blackhole", "blackhole");
    waitForNodeRefresh(server);
    try (Connection connection = createConnection();
        Statement statement = connection.createStatement()) {
        statement.executeUpdate("CREATE SCHEMA blackhole.blackhole");
    }
}
Also used : BlackHolePlugin(com.facebook.presto.plugin.blackhole.BlackHolePlugin) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) Connection(java.sql.Connection) BeforeClass(org.testng.annotations.BeforeClass)

Example 4 with BlackHolePlugin

use of com.facebook.presto.plugin.blackhole.BlackHolePlugin in project presto by prestodb.

the class TestPrestoDriver method setup.

@BeforeClass
public void setup() throws Exception {
    Logging.initialize();
    server = new TestingPrestoServer();
    server.installPlugin(new TpchPlugin());
    server.createCatalog(TEST_CATALOG, "tpch");
    server.installPlugin(new BlackHolePlugin());
    server.createCatalog("blackhole", "blackhole");
    Catalog bogusTestingCatalog = createBogusTestingCatalog(TESTING_CATALOG);
    server.getCatalogManager().registerCatalog(bogusTestingCatalog);
    SessionPropertyManager sessionPropertyManager = server.getMetadata().getSessionPropertyManager();
    sessionPropertyManager.addConnectorSessionProperties(bogusTestingCatalog.getConnectorId(), TEST_CATALOG_PROPERTIES);
    waitForNodeRefresh(server);
    setupTestTables();
    executorService = newCachedThreadPool(daemonThreadsNamed("test-%s"));
}
Also used : BlackHolePlugin(com.facebook.presto.plugin.blackhole.BlackHolePlugin) TpchPlugin(com.facebook.presto.tpch.TpchPlugin) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) Catalog(com.facebook.presto.metadata.Catalog) TestingSession.createBogusTestingCatalog(com.facebook.presto.testing.TestingSession.createBogusTestingCatalog) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

BlackHolePlugin (com.facebook.presto.plugin.blackhole.BlackHolePlugin)4 TestingPrestoServer (com.facebook.presto.server.testing.TestingPrestoServer)4 BeforeClass (org.testng.annotations.BeforeClass)4 TpchPlugin (com.facebook.presto.tpch.TpchPlugin)3 Bootstrap (com.facebook.airlift.bootstrap.Bootstrap)1 LifeCycleManager (com.facebook.airlift.bootstrap.LifeCycleManager)1 HttpServerInfo (com.facebook.airlift.http.server.HttpServerInfo)1 TestingHttpServerModule (com.facebook.airlift.http.server.testing.TestingHttpServerModule)1 JaxrsModule (com.facebook.airlift.jaxrs.JaxrsModule)1 TestingJmxModule (com.facebook.airlift.jmx.testing.TestingJmxModule)1 JsonModule (com.facebook.airlift.json.JsonModule)1 TestingNodeModule (com.facebook.airlift.node.testing.TestingNodeModule)1 Catalog (com.facebook.presto.metadata.Catalog)1 SessionPropertyManager (com.facebook.presto.metadata.SessionPropertyManager)1 SqlParserOptions (com.facebook.presto.sql.parser.SqlParserOptions)1 TestingSession.createBogusTestingCatalog (com.facebook.presto.testing.TestingSession.createBogusTestingCatalog)1 Injector (com.google.inject.Injector)1 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 Statement (java.sql.Statement)1