Search in sources :

Example 1 with ConnectClientFailure

use of org.opendaylight.controller.cluster.access.commands.ConnectClientFailure in project controller by opendaylight.

the class ModuleShardBackendResolverTest method testGetBackendInfoFail.

@Test
public void testGetBackendInfoFail() throws Exception {
    final CompletionStage<ShardBackendInfo> i = moduleShardBackendResolver.getBackendInfo(0L);
    final ConnectClientRequest req = contextProbe.expectMsgClass(ConnectClientRequest.class);
    final RuntimeException cause = new RuntimeException();
    final ConnectClientFailure response = req.toRequestFailure(new RuntimeRequestException("fail", cause));
    contextProbe.reply(response);
    final CompletionStage<ShardBackendInfo> stage = moduleShardBackendResolver.getBackendInfo(0L);
    final ExecutionException caught = TestUtils.assertOperationThrowsException(() -> TestUtils.getWithTimeout(stage.toCompletableFuture()), ExecutionException.class);
    Assert.assertEquals(cause, caught.getCause());
}
Also used : ConnectClientRequest(org.opendaylight.controller.cluster.access.commands.ConnectClientRequest) ConnectClientFailure(org.opendaylight.controller.cluster.access.commands.ConnectClientFailure) RuntimeRequestException(org.opendaylight.controller.cluster.access.concepts.RuntimeRequestException) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)1 Test (org.junit.Test)1 ConnectClientFailure (org.opendaylight.controller.cluster.access.commands.ConnectClientFailure)1 ConnectClientRequest (org.opendaylight.controller.cluster.access.commands.ConnectClientRequest)1 RuntimeRequestException (org.opendaylight.controller.cluster.access.concepts.RuntimeRequestException)1