Bug 8568: Remove deprecated MountProviderService from RootBindingAwareBroker 72/58072/3
authorTom Pantelis <tompantelis@gmail.com>
Wed, 31 May 2017 17:17:30 +0000 (13:17 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Fri, 2 Jun 2017 15:12:08 +0000 (11:12 -0400)
The MountProviderService API has been deprecated since Helium so it should be
safe to remove it from the RootBindingAwareBroker.

Change-Id: I7dc7b05feaafb08004f104da8495adc87e5078b1
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-binding-config/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java

index 5465a95..d917371 100644 (file)
@@ -24,8 +24,6 @@ import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.NotificationService;
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
-import org.opendaylight.controller.sal.binding.api.mount.MountService;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
@@ -53,18 +51,12 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
 
     private DataBroker dataBroker;
 
-    private MountProviderService legacyMount;
-
     private ImmutableClassToInstanceMap<BindingAwareService> supportedConsumerServices;
 
     private ImmutableClassToInstanceMap<BindingAwareService> supportedProviderServices;
 
     private MountPointService mountService;
 
-    public void setLegacyMountManager(final MountProviderService legacyMount) {
-        this.legacyMount = legacyMount;
-    }
-
     public RootBindingAwareBroker(final String instanceName) {
         this.identifier = instanceName;
     }
@@ -98,10 +90,6 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
         return mountService;
     }
 
-    public MountProviderService getLegacyMount() {
-        return legacyMount;
-    }
-
     public void setDataBroker(final DataBroker asyncDataBroker) {
         dataBroker = asyncDataBroker;
     }
@@ -137,17 +125,16 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
             consBuilder.put(DataBroker.class, dataBroker);
         }
         consBuilder.put(MountPointService.class, mountService);
-        consBuilder.put(MountService.class, legacyMount).build();
 
         supportedConsumerServices = consBuilder.build();
         final ImmutableClassToInstanceMap.Builder<BindingAwareService> provBuilder = ImmutableClassToInstanceMap
                 .builder();
         provBuilder.putAll(supportedConsumerServices).put(NotificationProviderService.class, getRoot())
-                .put(RpcProviderRegistry.class, getRoot()) .put(MountProviderService.class, legacyMount);
+                .put(RpcProviderRegistry.class, getRoot());
         if (notificationPublishService != null) {
             provBuilder.put(NotificationPublishService.class, notificationPublishService);
         }
-        supportedConsumerServices = consBuilder.build();
+
         supportedProviderServices = provBuilder.build();
     }
 
index 87f7eaa..6475258 100644 (file)
@@ -23,7 +23,6 @@ import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
 import org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.compat.HeliumRpcProviderRegistry;
-import org.opendaylight.controller.md.sal.binding.compat.HydrogenMountProvisionServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMMountPointServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationPublishServiceAdapter;
@@ -45,7 +44,6 @@ import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointSer
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
 import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker;
 import org.opendaylight.controller.sal.core.api.BrokerService;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
@@ -158,7 +156,6 @@ public class BindingTestContext implements AutoCloseable {
 
         final MountPointService mountService = new BindingDOMMountPointServiceAdapter(this.biMountImpl, this.codec);
         this.baBrokerImpl.setMountService(mountService);
-        this.baBrokerImpl.setLegacyMountManager(new HydrogenMountProvisionServiceAdapter(mountService));
         this.baBrokerImpl.setRpcBroker(new HeliumRpcProviderRegistry(this.baConsumerRpc, this.baProviderRpc));
         this.baBrokerImpl.setNotificationBroker(this.baNotifyImpl);
         this.baBrokerImpl.start();
@@ -254,10 +251,6 @@ public class BindingTestContext implements AutoCloseable {
 
     }
 
-    public MountProviderService getBindingMountProviderService() {
-        return this.baBrokerImpl.getLegacyMount();
-    }
-
     public MountPointService getBindingMountPointService() {
         return this.baBrokerImpl.getMountService();
     }
index fe2e499..6480080 100644 (file)
@@ -18,7 +18,6 @@ package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
 import org.opendaylight.controller.md.sal.binding.api.MountPointService;
 import org.opendaylight.controller.md.sal.binding.compat.HeliumRpcProviderRegistry;
-import org.opendaylight.controller.md.sal.binding.compat.HydrogenMountProvisionServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMMountPointServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcProviderServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcServiceAdapter;
@@ -27,7 +26,6 @@ import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
 import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker;
 import org.opendaylight.controller.sal.core.api.Broker;
 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
@@ -66,8 +64,6 @@ public final class BindingBrokerImplModule extends
         final BindingDOMRpcProviderServiceAdapter rpcProvider = createRpcProvider(codec,session);
         final RootBindingAwareBroker broker = new RootBindingAwareBroker(getIdentifier().getInstanceName());
         final RpcProviderRegistry heliumRpcBroker = new HeliumRpcProviderRegistry(rpcConsumer, rpcProvider);
-        final MountProviderService legacyMount = createLegacyMountPointService(mount);
-
 
         broker.setNotificationBroker(getNotificationServiceDependency());
         if (getNotificationPublishServiceDependency() != null) {
@@ -76,20 +72,10 @@ public final class BindingBrokerImplModule extends
         broker.setRpcBroker(heliumRpcBroker);
         broker.setDataBroker(getRootDataBrokerDependency());
         broker.setMountService(mount);
-        broker.setLegacyMountManager(legacyMount);
         broker.start();
         return broker;
     }
 
-
-    @SuppressWarnings("deprecation")
-    private MountProviderService createLegacyMountPointService(final MountPointService service) {
-        if(service != null) {
-            return new HydrogenMountProvisionServiceAdapter(service);
-        }
-        return null;
-    }
-
     private BindingDOMRpcProviderServiceAdapter createRpcProvider(final BindingToNormalizedNodeCodec codec,
             final ProviderSession session) {
         final DOMRpcProviderService domService = session.getService(DOMRpcProviderService.class);
index e240b19..c7399e8 100644 (file)
@@ -11,6 +11,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -22,14 +23,15 @@ import java.util.concurrent.Future;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.opendaylight.controller.md.sal.binding.api.MountPoint;
+import org.opendaylight.controller.md.sal.binding.api.MountPointService;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcAvailabilityListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
 import org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult;
-import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance;
-import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
 import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.OpendaylightTestRpcServiceService;
@@ -69,7 +71,7 @@ public class DOMRpcServiceTestBugfix560 {
 
     private BindingTestContext testContext;
     private DOMMountPointService domMountPointService;
-    private MountProviderService bindingMountPointService;
+    private MountPointService bindingMountPointService;
     private SchemaContext schemaContext;
 
     /**
@@ -84,7 +86,7 @@ public class DOMRpcServiceTestBugfix560 {
 
         testContext.start();
         domMountPointService = testContext.getDomMountProviderService();
-        bindingMountPointService = testContext.getBindingMountProviderService();
+        bindingMountPointService = testContext.getBindingMountPointService();
         assertNotNull(domMountPointService);
 
         final InputStream moduleStream = BindingReflections.getModuleInfo(
@@ -129,10 +131,13 @@ public class DOMRpcServiceTestBugfix560 {
                         return Futures.immediateCheckedFuture(result);
                     }
                 }).register();
-        final MountProviderInstance mountInstance = bindingMountPointService
-                .getMountPoint(BA_MOUNT_ID);
-        assertNotNull(mountInstance);
-        final OpendaylightTestRpcServiceService rpcService = mountInstance
+
+        final Optional<MountPoint> mountInstance = bindingMountPointService.getMountPoint(BA_MOUNT_ID);
+        assertTrue(mountInstance.isPresent());
+
+        final Optional<RpcConsumerRegistry> rpcRegistry = mountInstance.get().getService(RpcConsumerRegistry.class);
+        assertTrue(rpcRegistry.isPresent());
+        final OpendaylightTestRpcServiceService rpcService = rpcRegistry.get()
                 .getRpcService(OpendaylightTestRpcServiceService.class);
         assertNotNull(rpcService);
 

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