Search in sources :

Example 1 with RemoteWithExtrasException

use of org.apache.hadoop.hbase.ipc.RemoteWithExtrasException in project hbase by apache.

the class TestRegionServerCoprocessorEndpoint method testEndpointExceptions.

@Test
public void testEndpointExceptions() throws Exception {
    final ServerName serverName = TEST_UTIL.getHBaseCluster().getRegionServer(0).getServerName();
    final ServerRpcController controller = new ServerRpcController();
    final CoprocessorRpcUtils.BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse> rpcCallback = new CoprocessorRpcUtils.BlockingRpcCallback<>();
    DummyRegionServerEndpointProtos.DummyService service = ProtobufUtil.newServiceStub(DummyRegionServerEndpointProtos.DummyService.class, TEST_UTIL.getAdmin().coprocessorService(serverName));
    service.dummyThrow(controller, DummyRegionServerEndpointProtos.DummyRequest.getDefaultInstance(), rpcCallback);
    assertEquals(null, rpcCallback.get());
    assertTrue(controller.failedOnException());
    assertEquals(WHAT_TO_THROW.getClass().getName().trim(), ((RemoteWithExtrasException) controller.getFailedOn().getCause()).getClassName().trim());
}
Also used : CoprocessorRpcUtils(org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils) DummyResponse(org.apache.hadoop.hbase.coprocessor.protobuf.generated.DummyRegionServerEndpointProtos.DummyResponse) ServerName(org.apache.hadoop.hbase.ServerName) DummyService(org.apache.hadoop.hbase.coprocessor.protobuf.generated.DummyRegionServerEndpointProtos.DummyService) DummyRegionServerEndpointProtos(org.apache.hadoop.hbase.coprocessor.protobuf.generated.DummyRegionServerEndpointProtos) RemoteWithExtrasException(org.apache.hadoop.hbase.ipc.RemoteWithExtrasException) ServerRpcController(org.apache.hadoop.hbase.ipc.ServerRpcController) Test(org.junit.Test)

Aggregations

ServerName (org.apache.hadoop.hbase.ServerName)1 DummyRegionServerEndpointProtos (org.apache.hadoop.hbase.coprocessor.protobuf.generated.DummyRegionServerEndpointProtos)1 DummyResponse (org.apache.hadoop.hbase.coprocessor.protobuf.generated.DummyRegionServerEndpointProtos.DummyResponse)1 DummyService (org.apache.hadoop.hbase.coprocessor.protobuf.generated.DummyRegionServerEndpointProtos.DummyService)1 CoprocessorRpcUtils (org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils)1 RemoteWithExtrasException (org.apache.hadoop.hbase.ipc.RemoteWithExtrasException)1 ServerRpcController (org.apache.hadoop.hbase.ipc.ServerRpcController)1 Test (org.junit.Test)1