use of org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoInput in project openflowplugin by opendaylight.
the class SalEchoServiceImplTest method testSendEcho.
@Test
public void testSendEcho() throws Exception {
final EchoOutput echoOut = new EchoOutputBuilder().setData(DUMMY_DATA).build();
final RpcResult<EchoOutput> replyRpcResult = RpcResultBuilder.success(echoOut).build();
final ListenableFuture<RpcResult<EchoOutput>> replyFt = Futures.immediateFuture(replyRpcResult);
Mockito.when(mockedRequestContext.getFuture()).thenReturn(replyFt);
SendEchoInput sendEchoInput = new SendEchoInputBuilder().setData(DUMMY_DATA).build();
final Future<RpcResult<SendEchoOutput>> echoOutput = salEchoService.sendEcho(sendEchoInput);
Assert.assertNotNull(echoOutput);
Assert.assertTrue(echoOutput.isDone());
Assert.assertTrue(echoOutput.get().isSuccessful());
verify(mockedRequestContextStack).createRequestContext();
verify(mockedOutboundQueue).commitEntry(Matchers.eq(2121L), Matchers.<OfHeader>any(), Matchers.<FutureCallback<OfHeader>>any());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoInput in project openflowplugin by opendaylight.
the class EchoServiceTest method testSendEcho.
@Test
public void testSendEcho() throws Exception {
EchoInputBuilder sendEchoInput = new EchoInputBuilder();
echoService.handleServiceCall(sendEchoInput);
verify(mockedRequestContextStack).createRequestContext();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoInput in project openflowplugin by opendaylight.
the class EchoServiceTest method testBuildRequest.
@Test
public void testBuildRequest() throws Exception {
EchoInputBuilder sendEchoInput = new EchoInputBuilder().setData(DUMMY_DATA);
final OfHeader request = this.echoService.buildRequest(new Xid(DUMMY_XID_VALUE), sendEchoInput);
assertEquals(DUMMY_XID_VALUE, request.getXid());
assertTrue(request instanceof EchoInput);
final byte[] data = ((EchoInput) request).getData();
assertArrayEquals(DUMMY_DATA, data);
assertEquals(OFConstants.OFP_VERSION_1_3, request.getVersion().shortValue());
}
Aggregations