use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockInput in project mdsal by opendaylight.
the class BindingDOMRpcIntegrationTest method testBindingRegistrationWithDOMInvocation.
@Test
public void testBindingRegistrationWithDOMInvocation() throws InterruptedException, ExecutionException, TimeoutException {
knockRpcImpl.registerTo(baRpcProviderService, BA_NODE_ID).setKnockKnockResult(knockResult(true, "open"));
final OpendaylightKnockKnockRpcService baKnockService = baRpcConsumerService.getRpcService(OpendaylightKnockKnockRpcService.class);
assertNotSame(knockRpcImpl, baKnockService);
KnockKnockInput baKnockKnockInput = knockKnock(BA_NODE_ID).setQuestion("who's there?").build();
ContainerNode biKnockKnockInput = toDOMKnockKnockInput(baKnockKnockInput);
DOMRpcResult domResult = biRpcService.invokeRpc(KNOCK_KNOCK_QNAME, biKnockKnockInput).get(5, TimeUnit.SECONDS);
assertNotNull(domResult);
assertNotNull(domResult.getResult());
assertTrue("Binding KnockKnock service was not invoked", knockRpcImpl.getReceivedKnocks().containsKey(BA_NODE_ID));
assertEquals(baKnockKnockInput, knockRpcImpl.getReceivedKnocks().get(BA_NODE_ID).iterator().next());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockInput in project mdsal by opendaylight.
the class BindingDOMRpcIntegrationTest method testBindingRpcShortcut.
@Test
public void testBindingRpcShortcut() throws InterruptedException, ExecutionException, TimeoutException {
final ListenableFuture<RpcResult<KnockKnockOutput>> baKnockResult = knockResult(true, "open");
knockRpcImpl.registerTo(baRpcProviderService, BA_NODE_ID).setKnockKnockResult(baKnockResult);
final OpendaylightKnockKnockRpcService baKnockService = baRpcConsumerService.getRpcService(OpendaylightKnockKnockRpcService.class);
KnockKnockInput baKnockKnockInput = knockKnock(BA_NODE_ID).setQuestion("who's there?").build();
ListenableFuture<RpcResult<KnockKnockOutput>> future = baKnockService.knockKnock(baKnockKnockInput);
final RpcResult<KnockKnockOutput> rpcResult = future.get(5, TimeUnit.SECONDS);
assertEquals(baKnockResult.get().getResult().getClass(), rpcResult.getResult().getClass());
assertSame(baKnockResult.get().getResult(), rpcResult.getResult());
assertSame(baKnockKnockInput, knockRpcImpl.getReceivedKnocks().get(BA_NODE_ID).iterator().next());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockInput in project controller by opendaylight.
the class CrossBrokerRpcTest method bindingRoutedRpcProvider_DomInvokerTest.
@Test
public void bindingRoutedRpcProvider_DomInvokerTest() throws Exception {
//
knockService.registerPath(TestContext.class, //
BA_NODE_A_ID).registerPath(TestContext.class, //
BA_NODE_B_ID).setKnockKnockResult(knockResult(true, "open"));
OpendaylightOfMigrationTestModelService baKnockInvoker = providerRegistry.getRpcService(OpendaylightOfMigrationTestModelService.class);
assertNotSame(knockService, baKnockInvoker);
KnockKnockInput knockKnockA = //
knockKnock(BA_NODE_A_ID).setQuestion("who's there?").build();
ContainerNode knockKnockDom = toDomRpc(KNOCK_KNOCK_QNAME, knockKnockA);
assertNotNull(knockKnockDom);
DOMRpcResult domResult = biRpcInvoker.invokeRpc(KNOCK_KNOCK_PATH, knockKnockDom).get();
assertNotNull(domResult);
assertNotNull("DOM result is successful.", domResult.getResult());
assertTrue("Bidning Add Flow RPC was captured.", knockService.getReceivedKnocks().containsKey(BA_NODE_A_ID));
assertEquals(knockKnockA, knockService.getReceivedKnocks().get(BA_NODE_A_ID).iterator().next());
}
Aggregations