use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutputBuilder in project controller by opendaylight.
the class CrossBrokerRpcTest method knockResult.
private Future<RpcResult<KnockKnockOutput>> knockResult(final boolean success, final String answer) {
KnockKnockOutput output = //
new KnockKnockOutputBuilder().setAnswer(answer).build();
RpcResult<KnockKnockOutput> result = RpcResultBuilder.<KnockKnockOutput>status(success).withResult(output).build();
return Futures.immediateFuture(result);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutputBuilder in project mdsal by opendaylight.
the class BindingDOMRpcIntegrationTest method knockResult.
private static ListenableFuture<RpcResult<KnockKnockOutput>> knockResult(final boolean success, final String answer) {
KnockKnockOutput output = new KnockKnockOutputBuilder().setAnswer(answer).build();
RpcResult<KnockKnockOutput> result = RpcResultBuilder.<KnockKnockOutput>status(success).withResult(output).build();
return Futures.immediateFuture(result);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutputBuilder in project controller by opendaylight.
the class CrossBrokerRpcTest method bindingRpcInvoker_DomRoutedProviderTest.
@Test
public void bindingRpcInvoker_DomRoutedProviderTest() throws Exception {
KnockKnockOutputBuilder builder = new KnockKnockOutputBuilder();
builder.setAnswer("open");
final KnockKnockOutput output = builder.build();
provisionRegistry.registerRpcImplementation((rpc, input) -> {
ContainerNode result = testContext.getCodec().getCodecFactory().toNormalizedNodeRpcData(output);
return Futures.immediateCheckedFuture(new DefaultDOMRpcResult(result));
}, DOMRpcIdentifier.create(KNOCK_KNOCK_PATH, BI_NODE_C_ID));
OpendaylightOfMigrationTestModelService baKnockInvoker = providerRegistry.getRpcService(OpendaylightOfMigrationTestModelService.class);
Future<RpcResult<KnockKnockOutput>> baResult = baKnockInvoker.knockKnock((knockKnock(BA_NODE_C_ID).setQuestion("Who's there?").build()));
assertNotNull(baResult);
assertEquals(output, baResult.get().getResult());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutputBuilder in project mdsal by opendaylight.
the class BindingDOMRpcIntegrationTest method testDOMRegistrationWithBindingInvocation.
@Test
public void testDOMRegistrationWithBindingInvocation() throws InterruptedException, ExecutionException, TimeoutException {
KnockKnockOutput baKnockKnockOutput = new KnockKnockOutputBuilder().setAnswer("open").build();
biRpcProviderService.registerRpcImplementation((rpc, input) -> FluentFutures.immediateFluentFuture(new DefaultDOMRpcResult(testContext.getCodec().currentSerializer().toNormalizedNodeRpcData(baKnockKnockOutput))), DOMRpcIdentifier.create(KNOCK_KNOCK_QNAME, testContext.getCodec().currentSerializer().toYangInstanceIdentifier(BA_NODE_ID)));
final OpendaylightKnockKnockRpcService baKnockService = baRpcConsumerService.getRpcService(OpendaylightKnockKnockRpcService.class);
Future<RpcResult<KnockKnockOutput>> baResult = baKnockService.knockKnock(knockKnock(BA_NODE_ID).setQuestion("Who's there?").build());
assertNotNull(baResult);
assertEquals(baKnockKnockOutput, baResult.get(5, TimeUnit.SECONDS).getResult());
}
Aggregations