Register global PurchaseCarProvider 01/90401/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 11 Jun 2020 16:17:07 +0000 (18:17 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 11 Jun 2020 16:17:51 +0000 (18:17 +0200)
routed-rpc used to create a global registration, which we lost
during migration. Fix that.

JIRA: CONTROLLER-1947
Change-Id: Ifa3a13d8bb2a6caab9d58dd97903186c7c27dfed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PurchaseCarProvider.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/resources/OSGI-INF/blueprint/cluster-test-app.xml

index e958c86..34e8369 100644 (file)
@@ -51,6 +51,9 @@ public class PeopleProvider implements PeopleService, AutoCloseable {
         this.dataProvider = requireNonNull(dataProvider);
         this.rpcProviderService = requireNonNull(rpcProviderService);
         this.rpcImplementation = requireNonNull(rpcImplementation);
+
+        // Add global registration
+        regs.add(rpcProviderService.registerRpcImplementation(CarPurchaseService.class, rpcImplementation));
     }
 
     @Override
index dc6b47d..055dc6a 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.clustering.it.provider;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -22,17 +24,14 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class PurchaseCarProvider implements CarPurchaseService, AutoCloseable {
-
     private static final Logger LOG = LoggerFactory.getLogger(PurchaseCarProvider.class);
 
-    private NotificationPublishService notificationProvider;
-
+    private final NotificationPublishService notificationProvider;
 
-    public void setNotificationProvider(final NotificationPublishService salService) {
-        this.notificationProvider = salService;
+    public PurchaseCarProvider(final NotificationPublishService notificationProvider) {
+        this.notificationProvider = requireNonNull(notificationProvider);
     }
 
-
     @Override
     public ListenableFuture<RpcResult<BuyCarOutput>> buyCar(final BuyCarInput input) {
         LOG.info("Routed RPC buyCar : generating notification for buying car [{}]", input);
@@ -47,5 +46,6 @@ public class PurchaseCarProvider implements CarPurchaseService, AutoCloseable {
 
     @Override
     public void close() {
+
     }
 }
index ef8c73b..eccae7a 100644 (file)
 
 
   <bean id="purchaseCarProvider" class="org.opendaylight.controller.clustering.it.provider.PurchaseCarProvider" >
-    <property name="notificationProvider" ref="notificationPublishService"/>
+    <argument ref="notificationPublishService"/>
   </bean>
 
-  <!-- odl:routed-rpc-implementation id="carPurchaseRpcReg" ref="purchaseCarProvider"/ -->
-
   <bean id="peopleProvider" class="org.opendaylight.controller.clustering.it.provider.PeopleProvider"
         destroy-method="close">
     <argument ref="dataBroker"/>

©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.