Search in sources :

Example 1 with HttpServerInfo

use of com.facebook.airlift.http.server.HttpServerInfo 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)

Aggregations

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 BlackHolePlugin (com.facebook.presto.plugin.blackhole.BlackHolePlugin)1 TestingPrestoServer (com.facebook.presto.server.testing.TestingPrestoServer)1 TpchPlugin (com.facebook.presto.tpch.TpchPlugin)1 Injector (com.google.inject.Injector)1 BeforeClass (org.testng.annotations.BeforeClass)1