use of com.facebook.presto.server.testing.TestingPrestoServer 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();
}
use of com.facebook.presto.server.testing.TestingPrestoServer in project presto by prestodb.
the class DistributedQueryRunner method createTestingPrestoServer.
private static TestingPrestoServer createTestingPrestoServer(URI discoveryUri, boolean resourceManager, boolean resourceManagerEnabled, boolean coordinator, Map<String, String> extraProperties, SqlParserOptions parserOptions, String environment, Optional<Path> baseDataDir, List<Module> extraModules) throws Exception {
long start = nanoTime();
ImmutableMap.Builder<String, String> propertiesBuilder = ImmutableMap.<String, String>builder().put("query.client.timeout", "10m").put("exchange.http-client.idle-timeout", "1h").put("task.max-index-memory", // causes index joins to fault load
"16kB").put("datasources", "system").put("distributed-index-joins-enabled", "true").put("exchange.checksum-enabled", "true");
if (coordinator) {
propertiesBuilder.put("node-scheduler.include-coordinator", "true");
propertiesBuilder.put("join-distribution-type", "PARTITIONED");
}
HashMap<String, String> properties = new HashMap<>(propertiesBuilder.build());
properties.putAll(extraProperties);
TestingPrestoServer server = new TestingPrestoServer(resourceManager, resourceManagerEnabled, coordinator, properties, environment, discoveryUri, parserOptions, extraModules, baseDataDir);
String nodeRole = coordinator ? "coordinator" : resourceManager ? "resourceManager" : "worker";
log.info("Created %s TestingPrestoServer in %s: %s", nodeRole, nanosSince(start).convertToMostSuccinctTimeUnit(), server.getBaseUrl());
return server;
}
use of com.facebook.presto.server.testing.TestingPrestoServer in project presto by prestodb.
the class TestGenerateTokenFilter method setup.
@BeforeClass
public void setup() throws Exception {
server = new TestingPrestoServer(ImmutableList.of(new TestGenerateTokenFilterModule()));
httpClient = (JettyHttpClient) server.getInstance(Key.get(HttpClient.class, GenerateTokenFilterTest.class));
// extract the filter
List<HttpRequestFilter> filters = httpClient.getRequestFilters();
assertEquals(filters.size(), 2);
assertInstanceOf(filters.get(1), GenerateTraceTokenRequestFilter.class);
filter = (GenerateTraceTokenRequestFilter) filters.get(1);
}
use of com.facebook.presto.server.testing.TestingPrestoServer in project presto by prestodb.
the class TestNodeResource method setup.
@BeforeMethod
public void setup() throws Exception {
server = new TestingPrestoServer();
client = new JettyHttpClient();
}
use of com.facebook.presto.server.testing.TestingPrestoServer 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);
}
Aggregations