Search in sources :

Example 6 with SuccessEnvelope

use of org.opendaylight.controller.cluster.access.concepts.SuccessEnvelope in project controller by opendaylight.

the class AbstractClientConnectionTest method testSendRequestReceiveResponse.

@Test
public void testSendRequestReceiveResponse() throws Exception {
    final Consumer<Response<?, ?>> callback = mock(Consumer.class);
    final Request<?, ?> request = createRequest(replyToProbe.ref());
    connection.sendRequest(request, callback);
    final RequestEnvelope requestEnvelope = backendProbe.expectMsgClass(RequestEnvelope.class);
    Assert.assertEquals(request, requestEnvelope.getMessage());
    final LocalHistoryIdentifier historyId = new LocalHistoryIdentifier(CLIENT_ID, 0L);
    final RequestSuccess<?, ?> message = new TransactionAbortSuccess(new TransactionIdentifier(historyId, 0L), 0L);
    final ResponseEnvelope<?> envelope = new SuccessEnvelope(message, 0L, 0L, 0L);
    connection.receiveResponse(envelope);
    verify(callback, timeout(1000)).accept(isA(TransactionAbortSuccess.class));
}
Also used : Response(org.opendaylight.controller.cluster.access.concepts.Response) TransactionAbortSuccess(org.opendaylight.controller.cluster.access.commands.TransactionAbortSuccess) SuccessEnvelope(org.opendaylight.controller.cluster.access.concepts.SuccessEnvelope) TransactionIdentifier(org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier) RequestEnvelope(org.opendaylight.controller.cluster.access.concepts.RequestEnvelope) LocalHistoryIdentifier(org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier) Test(org.junit.Test)

Aggregations

SuccessEnvelope (org.opendaylight.controller.cluster.access.concepts.SuccessEnvelope)6 Test (org.junit.Test)4 Response (org.opendaylight.controller.cluster.access.concepts.Response)4 TransactionIdentifier (org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier)4 TransactionAbortSuccess (org.opendaylight.controller.cluster.access.commands.TransactionAbortSuccess)2 TransactionPurgeRequest (org.opendaylight.controller.cluster.access.commands.TransactionPurgeRequest)2 TransactionPurgeResponse (org.opendaylight.controller.cluster.access.commands.TransactionPurgeResponse)2 LocalHistoryIdentifier (org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier)2 RequestEnvelope (org.opendaylight.controller.cluster.access.concepts.RequestEnvelope)2 FailureEnvelope (org.opendaylight.controller.cluster.access.concepts.FailureEnvelope)1 RequestFailure (org.opendaylight.controller.cluster.access.concepts.RequestFailure)1 RequestSuccess (org.opendaylight.controller.cluster.access.concepts.RequestSuccess)1