private static List<DriftServer> startThriftServers(int thriftServers, boolean enableIndexJoin) { List<DriftServer> servers = new ArrayList<>(thriftServers); for (int i = 0; i < thriftServers; i++) { ThriftTpchService service = enableIndexJoin ? new ThriftIndexedTpchService() : new ThriftTpchService(); DriftServer server = new DriftServer( new DriftNettyServerTransportFactory(new DriftNettyServerConfig()), CODEC_MANAGER, new NullMethodInvocationStatsFactory(), ImmutableSet.of(new DriftService(service)), ImmutableSet.of()); server.start(); servers.add(server); } return servers; }
private static List<DriftServer> startThriftServers(int thriftServers, boolean enableIndexJoin) { List<DriftServer> servers = new ArrayList<>(thriftServers); for (int i = 0; i < thriftServers; i++) { ThriftTpchService service = enableIndexJoin ? new ThriftIndexedTpchService() : new ThriftTpchService(); DriftServer server = new DriftServer( new DriftNettyServerTransportFactory(new DriftNettyServerConfig()), CODEC_MANAGER, new NullMethodInvocationStatsFactory(), ImmutableSet.of(new DriftService(service)), ImmutableSet.of()); server.start(); servers.add(server); } return servers; }
private static int testMethodInvoker(ServerMethodInvoker methodInvoker, List<ToIntFunction<HostAndPort>> clients) { TestingPooledByteBufAllocator testingAllocator = new TestingPooledByteBufAllocator(); ServerTransport serverTransport = new DriftNettyServerTransportFactory(new DriftNettyServerConfig(), testingAllocator).createServerTransport(methodInvoker); try { serverTransport.start(); HostAndPort address = HostAndPort.fromParts("localhost", ((DriftNettyServerTransport) serverTransport).getPort()); int sum = 0; for (ToIntFunction<HostAndPort> client : clients) { sum += client.applyAsInt(address); } return sum; } finally { serverTransport.shutdown(); testingAllocator.close(); } }
private static int testMethodInvoker(ServerMethodInvoker methodInvoker, List<ToIntFunction<HostAndPort>> clients) { TestingPooledByteBufAllocator testingAllocator = new TestingPooledByteBufAllocator(); ServerTransport serverTransport = new DriftNettyServerTransportFactory(new DriftNettyServerConfig(), testingAllocator).createServerTransport(methodInvoker); try { serverTransport.start(); HostAndPort address = HostAndPort.fromParts("localhost", ((DriftNettyServerTransport) serverTransport).getPort()); int sum = 0; for (ToIntFunction<HostAndPort> client : clients) { sum += client.applyAsInt(address); } return sum; } finally { serverTransport.shutdown(); testingAllocator.close(); } }
.build(); DriftNettyServerConfig expected = new DriftNettyServerConfig() .setPort(99) .setAcceptBacklog(101)
.build(); DriftNettyServerConfig expected = new DriftNettyServerConfig() .setPort(99) .setAcceptBacklog(101)
private static int testServerMethodInvoker(ServerMethodInvoker methodInvoker, boolean assumeClientsSupportOutOfOrderResponses, List<ToIntFunction<HostAndPort>> clients) { DriftNettyServerConfig config = new DriftNettyServerConfig() .setAssumeClientsSupportOutOfOrderResponses(assumeClientsSupportOutOfOrderResponses); TestingPooledByteBufAllocator testingAllocator = new TestingPooledByteBufAllocator(); ServerTransport serverTransport = new DriftNettyServerTransportFactory(config, testingAllocator).createServerTransport(methodInvoker); try { serverTransport.start(); HostAndPort address = HostAndPort.fromParts("localhost", ((DriftNettyServerTransport) serverTransport).getPort()); int sum = 0; for (ToIntFunction<HostAndPort> client : clients) { sum += client.applyAsInt(address); } return sum; } finally { serverTransport.shutdown(); testingAllocator.close(); } }
private static int testServerMethodInvoker(ServerMethodInvoker methodInvoker, boolean assumeClientsSupportOutOfOrderResponses, List<ToIntFunction<HostAndPort>> clients) { DriftNettyServerConfig config = new DriftNettyServerConfig() .setAssumeClientsSupportOutOfOrderResponses(assumeClientsSupportOutOfOrderResponses); TestingPooledByteBufAllocator testingAllocator = new TestingPooledByteBufAllocator(); ServerTransport serverTransport = new DriftNettyServerTransportFactory(config, testingAllocator).createServerTransport(methodInvoker); try { serverTransport.start(); HostAndPort address = HostAndPort.fromParts("localhost", ((DriftNettyServerTransport) serverTransport).getPort()); int sum = 0; for (ToIntFunction<HostAndPort> client : clients) { sum += client.applyAsInt(address); } return sum; } finally { serverTransport.shutdown(); testingAllocator.close(); } }
private static void testDriftServer(DriftService service, Consumer<HostAndPort> task) { DriftNettyServerConfig config = new DriftNettyServerConfig() .setSslEnabled(true) .setTrustCertificate(ClientTestUtils.getCertificateChainFile()) .setKey(ClientTestUtils.getPrivateKeyFile()); TestingPooledByteBufAllocator testingAllocator = new TestingPooledByteBufAllocator(); DriftServer driftServer = new DriftServer( new DriftNettyServerTransportFactory(config, testingAllocator), CODEC_MANAGER, new NullMethodInvocationStatsFactory(), ImmutableSet.of(service), ImmutableSet.of()); try { driftServer.start(); HostAndPort address = HostAndPort.fromParts("localhost", ((DriftNettyServerTransport) driftServer.getServerTransport()).getPort()); task.accept(address); } finally { driftServer.shutdown(); testingAllocator.close(); } } }
private static int testDriftServer(ServerMethodInvoker methodInvoker, List<ToIntFunction<HostAndPort>> clients) { DriftNettyServerConfig config = new DriftNettyServerConfig() .setSslEnabled(true) .setTrustCertificate(ClientTestUtils.getCertificateChainFile()) .setKey(ClientTestUtils.getPrivateKeyFile()); TestingPooledByteBufAllocator testingAllocator = new TestingPooledByteBufAllocator(); ServerTransport serverTransport = new DriftNettyServerTransportFactory(config, testingAllocator).createServerTransport(methodInvoker); try { serverTransport.start(); HostAndPort address = HostAndPort.fromParts("localhost", ((DriftNettyServerTransport) serverTransport).getPort()); int sum = 0; for (ToIntFunction<HostAndPort> client : clients) { sum += client.applyAsInt(address); } return sum; } finally { serverTransport.shutdown(); testingAllocator.close(); } }