use of alluxio.hub.proto.ManagerAgentServiceGrpc in project alluxio by Alluxio.
the class RpcClientTest method testClientClose.
@Test
public void testClientClose() throws Exception {
GrpcChannel mockChannel = mock(GrpcChannel.class);
RpcClient<ManagerAgentServiceGrpc.ManagerAgentServiceBlockingStub> client = new RpcClient<>(mAddr, ManagerAgentServiceGrpc::newBlockingStub, (addr) -> mockChannel);
client.get();
client.close();
verify(mockChannel).shutdown();
}
use of alluxio.hub.proto.ManagerAgentServiceGrpc in project alluxio by Alluxio.
the class RpcClientTest method testUnhealthyChannel.
@Test
public void testUnhealthyChannel() throws Exception {
GrpcChannel mockChannel = mock(GrpcChannel.class);
doReturn(false).when(mockChannel).isShutdown();
doReturn(false).when(mockChannel).isHealthy();
RpcClient<ManagerAgentServiceGrpc.ManagerAgentServiceBlockingStub> client = new RpcClient<>(mAddr, ManagerAgentServiceGrpc::newBlockingStub, (addr) -> mockChannel);
client.get();
client.get();
verify(mockChannel).shutdown();
}
use of alluxio.hub.proto.ManagerAgentServiceGrpc in project alluxio by Alluxio.
the class AgentProcessContextTest method before.
@Before
public void before() throws Exception {
mContext = getTestManagerContext();
mServerName = InProcessServerBuilder.generateName();
mServer = InProcessServerBuilder.forName(mServerName).directExecutor().addService(new ManagerAgentService(mContext)).build();
mServer.start();
mChannel = InProcessChannelBuilder.forName(mServerName).directExecutor().build();
mClient = new InProcessRpcClient<>(InetSocketAddress.createUnresolved(mServerName, 0), ManagerAgentServiceGrpc::newBlockingStub, (addr) -> InProcessChannelBuilder.forName(mServerName).directExecutor().build());
}
use of alluxio.hub.proto.ManagerAgentServiceGrpc in project alluxio by Alluxio.
the class RpcClientTest method testGrpcChannelBuilderThrowsException.
@Test
public void testGrpcChannelBuilderThrowsException() throws Exception {
try (MockedStatic<GrpcChannelBuilder> builderMock = Mockito.mockStatic(GrpcChannelBuilder.class)) {
builderMock.when(() -> GrpcChannelBuilder.newBuilder(any(), any())).thenReturn(mMockChannelBuilder);
doThrow(AlluxioStatusException.from(Status.UNAVAILABLE)).when(mMockChannelBuilder).build();
RpcClient<ManagerAgentServiceGrpc.ManagerAgentServiceBlockingStub> client = new RpcClient<>(mConf, mAddr, ManagerAgentServiceGrpc::newBlockingStub, () -> new CountingRetry(4));
assertThrows(AlluxioStatusException.class, client::get);
verify(mMockChannelBuilder, VerificationModeFactory.times(5)).build();
}
}
Aggregations