use of org.opendaylight.yang.gen.v1.rpc.norev.SwitchInput in project mdsal by opendaylight.
the class Mdsal500Test method testBindingRpcShortcut.
@Test
public void testBindingRpcShortcut() throws InterruptedException, ExecutionException, TimeoutException {
final ListenableFuture<RpcResult<SwitchOutput>> baSwitchResult = switchResult(true);
switchRpcImpl.registerTo(baRpcProviderService).setSwitchResult(baSwitchResult);
final Mdsal500Service baSwitchService = baRpcConsumerService.getRpcService(Mdsal500Service.class);
SwitchInput baSwitchInput = switchBuilder(FOO).build();
ListenableFuture<RpcResult<SwitchOutput>> future = baSwitchService.switch$(baSwitchInput);
final RpcResult<SwitchOutput> rpcResult = future.get(5, TimeUnit.SECONDS);
assertEquals(baSwitchResult.get().getResult().getClass(), rpcResult.getResult().getClass());
assertSame(baSwitchResult.get().getResult(), rpcResult.getResult());
assertSame(baSwitchInput, switchRpcImpl.getReceivedSwitch().get(FOO).iterator().next());
}
use of org.opendaylight.yang.gen.v1.rpc.norev.SwitchInput in project mdsal by opendaylight.
the class Mdsal500Test method testBindingRegistrationWithDOMInvocation.
@Test
public void testBindingRegistrationWithDOMInvocation() throws Exception {
switchRpcImpl.registerTo(baRpcProviderService).setSwitchResult(switchResult(true));
final Mdsal500Service baSwitchService = baRpcConsumerService.getRpcService(Mdsal500Service.class);
assertNotSame(switchRpcImpl, baSwitchService);
SwitchInput baSwitchInput = switchBuilder(FOO).build();
ContainerNode biSwitchInput = toDOMSwitchInput(baSwitchInput);
DOMRpcResult domResult = biRpcService.invokeRpc(SWITCH_QNAME, biSwitchInput).get(5, TimeUnit.SECONDS);
assertNotNull(domResult);
assertNotNull(domResult.getResult());
assertTrue("Binding KnockKnock service was not invoked", switchRpcImpl.getReceivedSwitch().containsKey(FOO));
assertEquals(baSwitchInput, switchRpcImpl.getReceivedSwitch().get(FOO).iterator().next());
}
Aggregations