use of io.prestosql.server.testing.TestingPrestoServer in project hetu-core by openlookeng.
the class TestJdbcConnection method setupServer.
@BeforeClass
public void setupServer() throws Exception {
Logging.initialize();
Module systemTables = binder -> newSetBinder(binder, SystemTable.class).addBinding().to(ExtraCredentialsSystemTable.class).in(Scopes.SINGLETON);
server = new TestingPrestoServer(ImmutableList.of(systemTables));
server.installPlugin(new HiveHadoop2Plugin());
server.createCatalog("hive", "hive-hadoop2", ImmutableMap.<String, String>builder().put("hive.metastore", "file").put("hive.metastore.catalog.dir", server.getBaseDataDir().resolve("hive").toAbsolutePath().toString()).put("hive.security", "sql-standard").build());
try (Connection connection = createConnection();
Statement statement = connection.createStatement()) {
statement.execute("SET ROLE admin");
statement.execute("CREATE SCHEMA default");
statement.execute("CREATE SCHEMA fruit");
}
}
use of io.prestosql.server.testing.TestingPrestoServer in project hetu-core by openlookeng.
the class TestJdbcResultSet method setupServer.
@BeforeClass
public void setupServer() throws Exception {
Logging.initialize();
server = new TestingPrestoServer();
}
use of io.prestosql.server.testing.TestingPrestoServer in project hetu-core by openlookeng.
the class TestJdbcWarnings method setupServer.
@BeforeClass
public void setupServer() throws Exception {
server = new TestingPrestoServer(ImmutableMap.<String, String>builder().put("testing-warning-collector.add-warnings", "true").put("testing-warning-collector.preloaded-warnings", String.valueOf(PRELOADED_WARNINGS)).build());
server.installPlugin(new TpchPlugin());
server.createCatalog("tpch", "tpch");
server.installPlugin(new BlackHolePlugin());
server.createCatalog("blackhole", "blackhole");
waitForNodeRefresh(server);
}
use of io.prestosql.server.testing.TestingPrestoServer in project hetu-core by openlookeng.
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(), new TestingJmxModule(), new ProxyModule());
Injector injector = app.strictConfig().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 io.prestosql.server.testing.TestingPrestoServer in project hetu-core by openlookeng.
the class TestDataCenterClientAuth method setup.
@BeforeClass
public void setup() throws Exception {
URL resource = getClass().getClassLoader().getResource("33.privateKey");
assertNotNull(resource, "key directory not found");
File keyDir = new File(resource.getFile()).getAbsoluteFile().getParentFile();
defaultKey = getMimeDecoder().decode(asCharSource(new File(keyDir, "default-key.key"), US_ASCII).read().getBytes(US_ASCII));
hmac222 = getMimeDecoder().decode(asCharSource(new File(keyDir, "222.key"), US_ASCII).read().getBytes(US_ASCII));
privateKey33 = PemReader.loadPrivateKey(new File(keyDir, "33.privateKey"), Optional.empty());
server = new TestingPrestoServer(ImmutableMap.<String, String>builder().put("http-server.authentication.type", "JWT").put("http.authentication.jwt.key-file", new File(keyDir, "${KID}.key").toString()).put("http-server.https.enabled", "true").put("http-server.https.keystore.path", getResource("localhost.keystore").getPath()).put("http-server.https.keystore.key", "changeit").build());
server.installPlugin(new TpchPlugin());
server.createCatalog("tpch", "tpch");
}
Aggregations