Fix DOMRpcRouter breakage from mdsal 69/74269/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 20 Jul 2018 08:15:00 +0000 (10:15 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 20 Jul 2018 08:28:59 +0000 (10:28 +0200)
MD-SAL's DOMRpcRouter no longer directly implements services,
acquire them from the accessor methods.

Change-Id: Icf337e8b8183726c87bf38d3252dccb0b911ba17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerRpcTest.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMRpcRouter.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMRpcRouterTest.java

index a337b53..5391c3e 100644 (file)
@@ -174,7 +174,7 @@ public class BindingTestContext implements AutoCloseable {
         this.mockSchemaService.changeSchema(getContext(moduleInfos));
     }
 
-    private SchemaContext getContext(final Set<YangModuleInfo> moduleInfos) {
+    private static SchemaContext getContext(final Set<YangModuleInfo> moduleInfos) {
         final ModuleInfoBackedContext ctx = ModuleInfoBackedContext.create();
         ctx.addModuleInfos(moduleInfos);
         return ctx.tryToCreateSchemaContext().get();
@@ -207,7 +207,7 @@ public class BindingTestContext implements AutoCloseable {
         checkState(this.executor != null);
 
         delegateDomRouter = org.opendaylight.mdsal.dom.broker.DOMRpcRouter.newInstance(mockSchemaService);
-        this.domRouter = new DOMRpcRouter(delegateDomRouter, delegateDomRouter);
+        this.domRouter = new DOMRpcRouter(delegateDomRouter.getRpcService(), delegateDomRouter.getRpcProviderService());
     }
 
     public void startBindingNotificationBroker() {
index dcdb5a1..6f50247 100644 (file)
@@ -127,7 +127,7 @@ public class CrossBrokerRpcTest {
         final ListenableFuture<RpcResult<KnockKnockOutput>> knockResult = knockResult(true, "open");
 
         BindingDOMRpcProviderServiceAdapter mdsalServiceRegistry = new BindingDOMRpcProviderServiceAdapter(
-                testContext.getDelegateDomRouter(), testContext.getCodec());
+                testContext.getDelegateDomRouter().getRpcProviderService(), testContext.getCodec());
 
         final Multimap<InstanceIdentifier<?>, KnockKnockInput> receivedKnocks = HashMultimap.create();
         mdsalServiceRegistry.registerRpcImplementation(OpendaylightOfMigrationTestModelService.class,
index 54845cf..f95ef1a 100644 (file)
@@ -46,8 +46,8 @@ public final class DOMRpcRouter implements AutoCloseable, DOMRpcService, DOMRpcP
     @VisibleForTesting
     public DOMRpcRouter() {
         org.opendaylight.mdsal.dom.broker.DOMRpcRouter delegate = new org.opendaylight.mdsal.dom.broker.DOMRpcRouter();
-        this.delegateRpcService = delegate;
-        this.delegateRpcProviderService = delegate;
+        this.delegateRpcService = delegate.getRpcService();
+        this.delegateRpcProviderService = delegate.getRpcProviderService();
     }
 
     public DOMRpcRouter(final org.opendaylight.mdsal.dom.api.DOMRpcService delegateRpcService,
index e2356e3..4f555fb 100644 (file)
@@ -78,7 +78,7 @@ public class DOMRpcRouterTest {
         mdsalRpcRouter = new org.opendaylight.mdsal.dom.broker.DOMRpcRouter();
         final SchemaContext schemaContext = TestModel.createTestContext();
         mdsalRpcRouter.onGlobalContextUpdated(schemaContext);
-        legacyRpcRouter = new DOMRpcRouter(mdsalRpcRouter, mdsalRpcRouter);
+        legacyRpcRouter = new DOMRpcRouter(mdsalRpcRouter.getRpcService(), mdsalRpcRouter.getRpcProviderService());
 
         legacyTestRpcIdentifier = DOMRpcIdentifier.create(findRpc(schemaContext, "test-rpc"));
         legacyTestRpcNoInputIdentifier = DOMRpcIdentifier.create(findRpc(schemaContext, "test-rpc-no-input"));
@@ -149,7 +149,7 @@ public class DOMRpcRouterTest {
         testLegacyRpcImpl.init(Futures.immediateCheckedFuture(result));
 
         ListenableFuture<org.opendaylight.mdsal.dom.api.DOMRpcResult> future =
-                mdsalRpcRouter.invokeRpc(mdsalTestRpcIdentifier.getType(), RPC_INPUT);
+                mdsalRpcRouter.getRpcService().invokeRpc(mdsalTestRpcIdentifier.getType(), RPC_INPUT);
 
         assertEquals(RPC_OUTPUT, future.get().getResult());
         assertEquals(1, future.get().getErrors().size());
@@ -164,7 +164,7 @@ public class DOMRpcRouterTest {
         testLegacyRpcImpl.init(Futures.immediateFailedCheckedFuture(rpcEx));
 
         try {
-            mdsalRpcRouter.invokeRpc(mdsalTestRpcIdentifier.getType(), RPC_INPUT).get();
+            mdsalRpcRouter.getRpcService().invokeRpc(mdsalTestRpcIdentifier.getType(), RPC_INPUT).get();
             fail("Expected exception");
         } catch (ExecutionException e) {
             assertEquals(rpcEx, e.getCause());
@@ -174,7 +174,7 @@ public class DOMRpcRouterTest {
 
         testLegacyRpcImpl.init(Futures.immediateCheckedFuture(null));
 
-        future = mdsalRpcRouter.invokeRpc(mdsalTestRpcNoInputIdentifier.getType(), null);
+        future = mdsalRpcRouter.getRpcService().invokeRpc(mdsalTestRpcNoInputIdentifier.getType(), null);
 
         assertNull(future.get());
         testLegacyRpcImpl.verifyInput(legacyTestRpcNoInputIdentifier, null);
@@ -182,7 +182,7 @@ public class DOMRpcRouterTest {
 
     @Test
     public void testMdsalRegistrationAndLegacyInvocation() throws InterruptedException, ExecutionException {
-        mdsalRpcRouter.registerRpcImplementation(testMdsalRpcImpl, mdsalTestRpcIdentifier,
+        mdsalRpcRouter.getRpcProviderService().registerRpcImplementation(testMdsalRpcImpl, mdsalTestRpcIdentifier,
                 mdsalTestRpcNoInputIdentifier);
 
         // Test success

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.