Search in sources :

Example 1 with GetAsyncInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInputBuilder in project openflowplugin by opendaylight.

the class SalAsyncConfigServiceImplTest method testGetAsyncTest.

@Test
public void testGetAsyncTest() throws Exception {
    final GetAsyncOutput getAsyncOutput = new GetAsyncOutputBuilder().build();
    final RpcResult<GetAsyncOutput> replyRpcResult = RpcResultBuilder.success(getAsyncOutput).build();
    final ListenableFuture<RpcResult<GetAsyncOutput>> replyFuture = Futures.immediateFuture(replyRpcResult);
    Mockito.when(mockedRequestContext.getFuture()).thenReturn(replyFuture);
    final Future<RpcResult<GetAsyncOutput>> getAsyncResult = salAsyncConfigService.getAsync(new GetAsyncInputBuilder().build());
    Assert.assertNotNull(getAsyncResult);
    Assert.assertTrue(getAsyncResult.isDone());
    Assert.assertTrue(getAsyncResult.get().isSuccessful());
    verify(mockedRequestContextStack).createRequestContext();
    verify(mockedOutboundQueue).commitEntry(Matchers.eq(ServiceMocking.DUMMY_XID_VALUE), Matchers.<OfHeader>any(), Matchers.<FutureCallback<OfHeader>>any());
}
Also used : GetAsyncInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.GetAsyncInputBuilder) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetAsyncOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.GetAsyncOutputBuilder) GetAsyncOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.GetAsyncOutput) Test(org.junit.Test)

Example 2 with GetAsyncInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInputBuilder in project openflowplugin by opendaylight.

the class GetAsyncRequestMessageFactory method deserialize.

@Override
public GetAsyncInput deserialize(ByteBuf rawMessage) {
    GetAsyncInputBuilder builder = new GetAsyncInputBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    return builder.build();
}
Also used : GetAsyncInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInputBuilder)

Example 3 with GetAsyncInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInputBuilder in project openflowplugin by opendaylight.

the class GetaAsyncRequestMessageFactoryTest method testGetAsyncReques.

/**
 * Testing of {@link GetAsyncRequestMessageFactory} for correct translation from POJO.
 */
@Test
public void testGetAsyncReques() throws Exception {
    GetAsyncInputBuilder builder = new GetAsyncInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    GetAsyncInput message = builder.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    getAsyncFactory.serialize(message, out);
    BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, MESSAGE_LENGTH);
}
Also used : GetAsyncInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInput) GetAsyncInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInputBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 GetAsyncInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInputBuilder)2 ByteBuf (io.netty.buffer.ByteBuf)1 GetAsyncInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.GetAsyncInputBuilder)1 GetAsyncOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.GetAsyncOutput)1 GetAsyncOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.GetAsyncOutputBuilder)1 GetAsyncInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInput)1 OfHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1