use of org.apache.calcite.avatica.server.HttpServer in project calcite-avatica by apache.
the class AlternatingRemoteMetaTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
final String[] mainArgs = new String[] { FullyRemoteJdbcMetaFactory.class.getName() };
// Bind to '0' to pluck an ephemeral port instead of expecting a certain one to be free
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 2; i++) {
if (sb.length() > 0) {
sb.append(",");
}
HttpServer jsonServer = Main.start(mainArgs, 0, new HandlerFactory() {
@Override
public AbstractHandler createHandler(Service service) {
return new AvaticaJsonHandler(service);
}
});
ACTIVE_SERVERS.add(jsonServer);
sb.append("http://localhost:").append(jsonServer.getPort());
}
url = AlternatingDriver.PREFIX + "url=" + sb.toString();
}
use of org.apache.calcite.avatica.server.HttpServer in project calcite-avatica by apache.
the class SslDriverTest method parameters.
@Parameters(name = "{0}")
public static List<Object[]> parameters() throws Exception {
// Skip TLS testing on IBM Java due the combination of:
// - Jetty 9.4.12+ ignores SSL_* ciphers due to security - eclipse/jetty.project#2807
// - IBM uses SSL_* cipher names for ALL ciphers not following RFC cipher names
// See eclipse/jetty.project#2807 for details
assumeFalse("Skip TLS testing on IBM Java due eclipse/jetty.project#2807", System.getProperty("java.vendor").contains("IBM"));
final ArrayList<Object[]> parameters = new ArrayList<>();
setupClass();
for (Driver.Serialization serialization : new Driver.Serialization[] { Driver.Serialization.JSON, Driver.Serialization.PROTOBUF }) {
for (boolean emptyPassword : new boolean[] { true, false }) {
File keyStore = emptyPassword ? EMPTY_PW_KEYSTORE : KEYSTORE;
String password = emptyPassword ? KEYSTORE_EMPTY_PASSWORD : KEYSTORE_PASSWORD;
// Build and start the server, using TLS
HttpServer httpServer = new HttpServer.Builder().withPort(0).withTLS(keyStore, password, keyStore, password).withHandler(localService, serialization).build();
httpServer.start();
SERVERS_TO_STOP.add(httpServer);
String url = "jdbc:avatica:remote:url=https://localhost:" + httpServer.getPort() + ";serialization=" + serialization + ";truststore=" + keyStore.getAbsolutePath();
if (!emptyPassword) {
url += ";truststore_password=" + password;
}
LOG.info("JDBC URL {}", url);
parameters.add(new Object[] { url });
}
}
return parameters;
}
Aggregations