use of com.facebook.presto.server.testing.TestingPrestoServer 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"));
}
use of com.facebook.presto.server.testing.TestingPrestoServer in project presto by prestodb.
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").toFile().toURI().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 com.facebook.presto.server.testing.TestingPrestoServer in project presto by prestodb.
the class TestJdbcResultSet method setupServer.
@BeforeClass
public void setupServer() throws Exception {
Logging.initialize();
server = new TestingPrestoServer();
}
use of com.facebook.presto.server.testing.TestingPrestoServer in project presto by prestodb.
the class TestPrestoDriverAuth method setup.
@BeforeClass
public void setup() throws Exception {
Logging.initialize();
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(true, 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(), null, null, new SqlParserOptions(), ImmutableList.of());
server.installPlugin(new TpchPlugin());
server.createCatalog(TEST_CATALOG, "tpch");
waitForNodeRefresh(server);
}
use of com.facebook.presto.server.testing.TestingPrestoServer in project presto by prestodb.
the class TestHiveRecoverableExecution method waitUntilAllNodesAreHealthy.
private static void waitUntilAllNodesAreHealthy(DistributedQueryRunner queryRunner, Duration timeout) throws TimeoutException, InterruptedException {
TestingPrestoServer coordinator = queryRunner.getCoordinator();
long deadline = System.currentTimeMillis() + timeout.toMillis();
while (System.currentTimeMillis() < deadline) {
AllNodes allNodes = coordinator.refreshNodes();
if (allNodes.getActiveNodes().size() == queryRunner.getNodeCount()) {
return;
}
sleep(1000);
}
throw new TimeoutException(format("one of the nodes is still missing after: %s", timeout));
}
Aggregations