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