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);
}
}
Aggregations