X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Fimpl%2Ftest%2FRpcProviderRegistryTest.java;h=8782046eeef3c13da933bc01ab8d68476b0a0664;hb=5c7fe226016d6997f411601502589e86ad9d8f87;hp=110e5b4dce3f02e7f32aad00d0c8915ea188bb47;hpb=9e879a95e6bed2faee5c2561fd035fc754648689;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/RpcProviderRegistryTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/RpcProviderRegistryTest.java index 110e5b4dce..8782046eee 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/RpcProviderRegistryTest.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/RpcProviderRegistryTest.java @@ -23,6 +23,7 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcR import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration; import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier; import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter; +import org.opendaylight.controller.sal.binding.codegen.RpcIsNotRoutedException; import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.OpendaylightTestRpcServiceService; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList; @@ -77,6 +78,28 @@ public class RpcProviderRegistryTest { assertNotNull(regTwo); } + @Test + public void routedRpcRegisteredUsingGlobalAsDefaultInstance() throws Exception { + OpendaylightTestRoutedRpcService def = Mockito.mock(OpendaylightTestRoutedRpcService.class); + rpcRegistry.addRpcImplementation(OpendaylightTestRoutedRpcService.class, def); + RpcRouter router = rpcRegistry.getRpcRouter(OpendaylightTestRoutedRpcService.class); + assertEquals(def, router.getDefaultService()); + } + + @Test + public void nonRoutedRegisteredAsRouted() { + OpendaylightTestRpcServiceService one = Mockito.mock(OpendaylightTestRpcServiceService.class); + try { + rpcRegistry.addRoutedRpcImplementation(OpendaylightTestRpcServiceService.class, one); + fail("RpcIsNotRoutedException should be thrown"); + } catch (RpcIsNotRoutedException e) { + assertNotNull(e.getMessage()); + } catch (Exception e) { + fail("RpcIsNotRoutedException should be thrown"); + } + + } + @Test public void testRpcRouterInstance() throws Exception { OpendaylightTestRoutedRpcService def = Mockito.mock(OpendaylightTestRoutedRpcService.class);