Search in sources :

Example 1 with ThriftServerInfoClient

use of com.facebook.presto.server.thrift.ThriftServerInfoClient in project presto by prestodb.

the class TestThriftServerInfoIntegration method testServer.

@Test
public void testServer() {
    AddressSelector<SimpleAddressSelector.SimpleAddress> addressSelector = new SimpleAddressSelector(ImmutableSet.of(HostAndPort.fromParts("localhost", thriftServerPort)), true);
    try (DriftNettyMethodInvokerFactory<?> invokerFactory = createStaticDriftNettyMethodInvokerFactory(new DriftNettyClientConfig())) {
        DriftClientFactory clientFactory = new DriftClientFactory(new ThriftCodecManager(), invokerFactory, addressSelector, NORMAL_RESULT);
        ThriftServerInfoClient client = clientFactory.createDriftClient(ThriftServerInfoClient.class).get();
        // get buffer result
        NodeState state = NodeState.valueOf(client.getServerState().get());
        assertEquals(state, ACTIVE);
    } catch (Exception e) {
        fail();
    }
}
Also used : NodeState(com.facebook.presto.spi.NodeState) ThriftServerInfoClient(com.facebook.presto.server.thrift.ThriftServerInfoClient) SimpleAddressSelector(com.facebook.drift.client.address.SimpleAddressSelector) DriftNettyClientConfig(com.facebook.drift.transport.netty.client.DriftNettyClientConfig) DriftClientFactory(com.facebook.drift.client.DriftClientFactory) ThriftCodecManager(com.facebook.drift.codec.ThriftCodecManager) Test(org.testng.annotations.Test)

Aggregations

DriftClientFactory (com.facebook.drift.client.DriftClientFactory)1 SimpleAddressSelector (com.facebook.drift.client.address.SimpleAddressSelector)1 ThriftCodecManager (com.facebook.drift.codec.ThriftCodecManager)1 DriftNettyClientConfig (com.facebook.drift.transport.netty.client.DriftNettyClientConfig)1 ThriftServerInfoClient (com.facebook.presto.server.thrift.ThriftServerInfoClient)1 NodeState (com.facebook.presto.spi.NodeState)1 Test (org.testng.annotations.Test)1