use of org.apache.calcite.avatica.server.Main.HandlerFactory 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();
}
Aggregations