Search in sources :

Example 26 with RpcException

use of org.apache.drill.exec.rpc.RpcException in project drill by apache.

the class ConnectTriesPropertyTestClusterBits method testConnectFailureUsingZKWithOnlyFakeBits.

@Test
public void testConnectFailureUsingZKWithOnlyFakeBits() throws Exception {
    Properties props = new Properties();
    props.setProperty("tries", "3");
    // Test with Cluster Coordinator connection
    RemoteServiceSet localServiceSet = RemoteServiceSet.getLocalServiceSet();
    DrillClient client = new DrillClient(drillConfig, localServiceSet.getCoordinator());
    // Create couple of fake drillbit endpoints and register with cluster coordinator
    DrillbitEndpoint fakeEndPoint1 = DrillbitEndpoint.newBuilder().setAddress("127.0.0.1").setUserPort(5000).build();
    DrillbitEndpoint fakeEndPoint2 = DrillbitEndpoint.newBuilder().setAddress("127.0.0.1").setUserPort(5001).build();
    ClusterCoordinator.RegistrationHandle fakeEndPoint1Handle = localServiceSet.getCoordinator().register(fakeEndPoint1);
    ClusterCoordinator.RegistrationHandle fakeEndPoint2Handle = localServiceSet.getCoordinator().register(fakeEndPoint2);
    try {
        client.connect(props);
        fail();
    } catch (RpcException ex) {
        assertTrue(ex.getCause() instanceof ExecutionException);
        client.close();
    } finally {
        // Remove the fake drillbits from local cluster cordinator
        localServiceSet.getCoordinator().unregister(fakeEndPoint1Handle);
        localServiceSet.getCoordinator().unregister(fakeEndPoint2Handle);
    }
}
Also used : DrillbitEndpoint(org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint) RemoteServiceSet(org.apache.drill.exec.server.RemoteServiceSet) RpcException(org.apache.drill.exec.rpc.RpcException) ClusterCoordinator(org.apache.drill.exec.coord.ClusterCoordinator) Properties(java.util.Properties) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Aggregations

RpcException (org.apache.drill.exec.rpc.RpcException)26 Test (org.junit.Test)10 ExecutionException (java.util.concurrent.ExecutionException)9 IOException (java.io.IOException)8 NonTransientRpcException (org.apache.drill.exec.rpc.NonTransientRpcException)6 Connection (java.sql.Connection)5 SQLException (java.sql.SQLException)5 Properties (java.util.Properties)4 SaslException (javax.security.sasl.SaslException)4 QueryId (org.apache.drill.exec.proto.UserBitShared.QueryId)4 Response (org.apache.drill.exec.rpc.Response)4 SaslClient (javax.security.sasl.SaslClient)3 UserException (org.apache.drill.common.exceptions.UserException)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 AbstractCheckedFuture (com.google.common.util.concurrent.AbstractCheckedFuture)2 ByteString (com.google.protobuf.ByteString)2 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)2 ByteBufInputStream (io.netty.buffer.ByteBufInputStream)2 UserRemoteException (org.apache.drill.common.exceptions.UserRemoteException)2 DrillbitEndpoint (org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint)2