Migrate sal.core.api.mount.MountProvisionListener users 88/73888/5
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 10 Jul 2018 18:03:32 +0000 (20:03 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 11 Jul 2018 10:48:36 +0000 (12:48 +0200)
DOMMountPointListener is the replacement interface, use it.

Change-Id: I51222f1f2bc133d90dd59a029fe538826dde48c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/MountPointEndToEndTest.java
restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/mountpoints/MountPointSwagger.java

index 500a97bced913c167f4cbbc2432df927c8e2022c..45cfd3090e1d5ea7b6dcdc1e3fcae6fb1565df9c 100644 (file)
@@ -84,9 +84,9 @@ import org.opendaylight.controller.md.sal.dom.broker.impl.DOMRpcRouter;
 import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointServiceImpl;
 import org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
 import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
+import org.opendaylight.mdsal.dom.api.DOMMountPointListener;
 import org.opendaylight.mdsal.eos.dom.simple.SimpleDOMEntityOwnershipService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
@@ -167,7 +167,7 @@ public class MountPointEndToEndTest {
     @Mock private ScheduledThreadPool mockKeepaliveExecutor;
 
     @Mock private ActorSystemProvider mockMasterActorSystemProvider;
-    @Mock private MountProvisionListener masterMountPointListener;
+    @Mock private DOMMountPointListener masterMountPointListener;
     private final DOMMountPointService masterMountPointService = new DOMMountPointServiceImpl();
     private final DOMRpcRouter deviceRpcService = new DOMRpcRouter();
     private DOMClusterSingletonServiceProviderImpl masterClusterSingletonServiceProvider;
@@ -180,7 +180,7 @@ public class MountPointEndToEndTest {
     @Mock private ActorSystemProvider mockSlaveActorSystemProvider;
     @Mock private ClusterSingletonServiceProvider mockSlaveClusterSingletonServiceProvider;
     @Mock private ClusterSingletonServiceRegistration mockSlaveClusterSingletonServiceReg;
-    @Mock private MountProvisionListener slaveMountPointListener;
+    @Mock private DOMMountPointListener slaveMountPointListener;
     private final DOMMountPointService slaveMountPointService = new DOMMountPointServiceImpl();
     private DataBroker slaveDataBroker;
     private ActorSystem slaveSystem;
@@ -269,8 +269,8 @@ public class MountPointEndToEndTest {
                 mockMasterActorSystemProvider, eventExecutor, mockClientDispatcher, TOPOLOGY_ID, config,
                 masterMountPointService, mockEncryptionService) {
             @Override
-            protected NetconfTopologyContext newNetconfTopologyContext(NetconfTopologySetup setup,
-                    ServiceGroupIdentifier serviceGroupIdent, Timeout actorResponseWaitTime) {
+            protected NetconfTopologyContext newNetconfTopologyContext(final NetconfTopologySetup setup,
+                    final ServiceGroupIdentifier serviceGroupIdent, final Timeout actorResponseWaitTime) {
                 NetconfTopologyContext context =
                         super.newNetconfTopologyContext(setup, serviceGroupIdent, actorResponseWaitTime);
                 NetconfTopologyContext spiedContext = spy(context);
@@ -304,10 +304,10 @@ public class MountPointEndToEndTest {
         slaveNetconfTopologyManager = new NetconfTopologyManager(slaveDataBroker, mockRpcProviderRegistry,
                 mockSlaveClusterSingletonServiceProvider, mockKeepaliveExecutor, mockThreadPool,
                 mockSlaveActorSystemProvider, eventExecutor, mockClientDispatcher, TOPOLOGY_ID, config,
-                slaveMountPointService, mockEncryptionService)  {
+                slaveMountPointService, mockEncryptionService) {
             @Override
-            protected NetconfTopologyContext newNetconfTopologyContext(NetconfTopologySetup setup,
-                    ServiceGroupIdentifier serviceGroupIdent, Timeout actorResponseWaitTime) {
+            protected NetconfTopologyContext newNetconfTopologyContext(final NetconfTopologySetup setup,
+                    final ServiceGroupIdentifier serviceGroupIdent, final Timeout actorResponseWaitTime) {
                 NetconfTopologyContext spiedContext =
                         spy(super.newNetconfTopologyContext(setup, serviceGroupIdent, actorResponseWaitTime));
                 slaveNetconfTopologyContextFuture.set(spiedContext);
@@ -321,12 +321,12 @@ public class MountPointEndToEndTest {
 
         slaveTxChain = slaveDataBroker.createTransactionChain(new TransactionChainListener() {
             @Override
-            public void onTransactionChainSuccessful(TransactionChain<?, ?> chain) {
+            public void onTransactionChainSuccessful(final TransactionChain<?, ?> chain) {
             }
 
             @Override
-            public void onTransactionChainFailed(TransactionChain<?, ?> chain, AsyncTransaction<?, ?> transaction,
-                    Throwable cause) {
+            public void onTransactionChainFailed(final TransactionChain<?, ?> chain,
+                    final AsyncTransaction<?, ?> transaction, final Throwable cause) {
                 LOG.error("Slave transaction chain failed", cause);
             }
         });
@@ -466,7 +466,7 @@ public class MountPointEndToEndTest {
         verify(mockSlaveClusterSingletonServiceReg).close();
     }
 
-    private void testDOMRpcService(DOMRpcService domRpcService)
+    private void testDOMRpcService(final DOMRpcService domRpcService)
             throws InterruptedException, ExecutionException, TimeoutException {
         testPutTopRpc(domRpcService, new DefaultDOMRpcResult((NormalizedNode<?, ?>)null));
         testPutTopRpc(domRpcService, null);
@@ -481,7 +481,7 @@ public class MountPointEndToEndTest {
         testFailedRpc(domRpcService, getTopRpcSchemaPath, null);
     }
 
-    private void testPutTopRpc(DOMRpcService domRpcService, DOMRpcResult result)
+    private void testPutTopRpc(final DOMRpcService domRpcService, final DOMRpcResult result)
             throws InterruptedException, ExecutionException, TimeoutException {
         ContainerNode putTopInput = bindingToNormalized.toNormalizedNodeRpcData(
                 new PutTopInputBuilder().setTopLevelList(Arrays.asList(new TopLevelListBuilder().setName("one")
@@ -489,13 +489,14 @@ public class MountPointEndToEndTest {
         testRpc(domRpcService, putTopRpcSchemaPath, putTopInput, result);
     }
 
-    private void testGetTopRpc(DOMRpcService domRpcService, DOMRpcResult result)
+    private void testGetTopRpc(final DOMRpcService domRpcService, final DOMRpcResult result)
             throws InterruptedException, ExecutionException, TimeoutException {
         testRpc(domRpcService, getTopRpcSchemaPath, null, result);
     }
 
-    private void testRpc(DOMRpcService domRpcService, SchemaPath schemaPath, NormalizedNode<?, ?> input,
-            DOMRpcResult result) throws InterruptedException, ExecutionException, TimeoutException {
+    private void testRpc(final DOMRpcService domRpcService, final SchemaPath schemaPath,
+            final NormalizedNode<?, ?> input, final DOMRpcResult result) throws InterruptedException,
+            ExecutionException, TimeoutException {
         final DOMRpcResult actual = invokeRpc(domRpcService, schemaPath, input, Futures.immediateCheckedFuture(result));
         if (result == null) {
             assertNull(actual);
@@ -520,8 +521,8 @@ public class MountPointEndToEndTest {
         }
     }
 
-    private void testFailedRpc(DOMRpcService domRpcService, SchemaPath schemaPath, NormalizedNode<?, ?> input)
-            throws InterruptedException, TimeoutException  {
+    private void testFailedRpc(final DOMRpcService domRpcService, final SchemaPath schemaPath,
+            final NormalizedNode<?, ?> input) throws InterruptedException, TimeoutException {
         try {
             invokeRpc(domRpcService, schemaPath, input, Futures.immediateFailedCheckedFuture(
                     new ClusteringRpcException("mock")));
@@ -532,8 +533,8 @@ public class MountPointEndToEndTest {
         }
     }
 
-    private DOMRpcResult invokeRpc(DOMRpcService domRpcService, SchemaPath schemaPath, NormalizedNode<?, ?> input,
-            CheckedFuture<DOMRpcResult, DOMRpcException> returnFuture)
+    private DOMRpcResult invokeRpc(final DOMRpcService domRpcService, final SchemaPath schemaPath,
+            final NormalizedNode<?, ?> input, final CheckedFuture<DOMRpcResult, DOMRpcException> returnFuture)
                     throws InterruptedException, ExecutionException, TimeoutException {
         topRpcImplementation.init(returnFuture);
         final ListenableFuture<DOMRpcResult> resultFuture = domRpcService.invokeRpc(schemaPath, input);
@@ -543,7 +544,7 @@ public class MountPointEndToEndTest {
         return resultFuture.get(5, TimeUnit.SECONDS);
     }
 
-    private static void testDOMDataBrokerOperations(DOMDataBroker dataBroker)
+    private static void testDOMDataBrokerOperations(final DOMDataBroker dataBroker)
             throws InterruptedException, ExecutionException, TimeoutException {
 
         DOMDataWriteTransaction writeTx = dataBroker.newWriteOnlyTransaction();
@@ -573,7 +574,7 @@ public class MountPointEndToEndTest {
         assertTrue(readTx.cancel());
     }
 
-    private static void writeNetconfNode(String cacheDir, DataBroker databroker)
+    private static void writeNetconfNode(final String cacheDir, final DataBroker databroker)
             throws InterruptedException, ExecutionException, TimeoutException {
         final NetconfNode netconfNode = new NetconfNodeBuilder()
                 .setHost(new Host(new IpAddress(new Ipv4Address("127.0.0.1"))))
@@ -596,8 +597,8 @@ public class MountPointEndToEndTest {
         writeTx.commit().get(5, TimeUnit.SECONDS);
     }
 
-    private static void verifyDataInStore(DOMDataReadTransaction readTx, YangInstanceIdentifier path,
-            NormalizedNode<?, ?> expNode) throws InterruptedException, ExecutionException, TimeoutException {
+    private static void verifyDataInStore(final DOMDataReadTransaction readTx, final YangInstanceIdentifier path,
+            final NormalizedNode<?, ?> expNode) throws InterruptedException, ExecutionException, TimeoutException {
         final Optional<NormalizedNode<?, ?>> read = readTx.read(LogicalDatastoreType.CONFIGURATION, path)
                 .get(5, TimeUnit.SECONDS);
         assertTrue(read.isPresent());
@@ -607,7 +608,7 @@ public class MountPointEndToEndTest {
         assertTrue(exists);
     }
 
-    private static void verifyTopologyNodesCreated(DataBroker dataBroker) {
+    private static void verifyTopologyNodesCreated(final DataBroker dataBroker) {
         await().atMost(5, TimeUnit.SECONDS).until(() -> {
             try (ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) {
                 Optional<Topology> configTopology = readTx.read(LogicalDatastoreType.CONFIGURATION,
@@ -635,26 +636,27 @@ public class MountPointEndToEndTest {
         return dataBrokerTest;
     }
 
-    private void awaitMountPointNotPresent(DOMMountPointService mountPointService) {
+    private void awaitMountPointNotPresent(final DOMMountPointService mountPointService) {
         await().atMost(5, TimeUnit.SECONDS).until(
             () -> !mountPointService.getMountPoint(yangNodeInstanceId).isPresent());
     }
 
-    private static DOMDataBroker getDOMDataBroker(DOMMountPoint mountPoint) {
+    private static DOMDataBroker getDOMDataBroker(final DOMMountPoint mountPoint) {
         return getMountPointService(mountPoint, DOMDataBroker.class);
     }
 
-    private static DOMRpcService getDOMRpcService(DOMMountPoint mountPoint) {
+    private static DOMRpcService getDOMRpcService(final DOMMountPoint mountPoint) {
         return getMountPointService(mountPoint, DOMRpcService.class);
     }
 
-    private static <T extends DOMService> T getMountPointService(DOMMountPoint mountPoint, Class<T> serviceClass) {
+    private static <T extends DOMService> T getMountPointService(final DOMMountPoint mountPoint,
+            final Class<T> serviceClass) {
         final Optional<T> maybeService = mountPoint.getService(serviceClass);
         assertTrue(maybeService.isPresent());
         return maybeService.get();
     }
 
-    private DOMMountPoint awaitMountPoint(DOMMountPointService mountPointService) {
+    private DOMMountPoint awaitMountPoint(final DOMMountPointService mountPointService) {
         await().atMost(5, TimeUnit.SECONDS).until(() -> {
             return mountPointService.getMountPoint(yangNodeInstanceId).isPresent();
         });
@@ -662,7 +664,7 @@ public class MountPointEndToEndTest {
         return mountPointService.getMountPoint(yangNodeInstanceId).get();
     }
 
-    private RpcDefinition findRpcDefinition(String rpc) {
+    private RpcDefinition findRpcDefinition(final String rpc) {
         Module topModule = deviceSchemaContext.findModule(TOP_MODULE_NAME, topModuleInfo.getName().getRevision()).get();
         RpcDefinition rpcDefinition = null;
         for (RpcDefinition def: topModule.getRpcs()) {
@@ -681,18 +683,18 @@ public class MountPointEndToEndTest {
         private volatile CheckedFuture<DOMRpcResult, DOMRpcException> returnFuture;
 
         @Override
-        public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(DOMRpcIdentifier rpc,
-                NormalizedNode<?, ?> input) {
+        public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final DOMRpcIdentifier rpc,
+                final NormalizedNode<?, ?> input) {
             rpcInvokedFuture.set(new SimpleEntry<>(rpc, input));
             return returnFuture;
         }
 
-        void init(CheckedFuture<DOMRpcResult, DOMRpcException> retFuture) {
+        void init(final CheckedFuture<DOMRpcResult, DOMRpcException> retFuture) {
             this.returnFuture = retFuture;
             rpcInvokedFuture = SettableFuture.create();
         }
 
-        void verify(DOMRpcIdentifier expRpc, NormalizedNode<?, ?> expInput)
+        void verify(final DOMRpcIdentifier expRpc, final NormalizedNode<?, ?> expInput)
                 throws InterruptedException, ExecutionException, TimeoutException {
             final Entry<DOMRpcIdentifier, NormalizedNode<?, ?>> actual = rpcInvokedFuture.get(5, TimeUnit.SECONDS);
             assertEquals(expRpc, actual.getKey());
index 1ec5a2ebb2c620f3000e4ba163611be019deea7e..df9fca6d258d32c2bcd8a5444cbee82ae4fee6e6 100644 (file)
@@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicLong;
 import javax.ws.rs.core.UriInfo;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
+import org.opendaylight.mdsal.dom.api.DOMMountPointListener;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.netconf.sal.rest.doc.impl.BaseYangSwaggerGenerator;
 import org.opendaylight.netconf.sal.rest.doc.swagger.Api;
@@ -35,7 +35,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-public class MountPointSwagger implements MountProvisionListener, AutoCloseable {
+public class MountPointSwagger implements DOMMountPointListener, AutoCloseable {
 
     private static final String DATASTORES_REVISION = "-";
     private static final String DATASTORES_LABEL = "Datastores";
@@ -51,10 +51,10 @@ public class MountPointSwagger implements MountProvisionListener, AutoCloseable
 
     private final AtomicLong idKey = new AtomicLong(0);
 
-    private ListenerRegistration<MountProvisionListener> registration;
+    private ListenerRegistration<DOMMountPointListener> registration;
 
-    public MountPointSwagger(DOMSchemaService globalSchema, DOMMountPointService mountService,
-            BaseYangSwaggerGenerator swaggerGenerator) {
+    public MountPointSwagger(final DOMSchemaService globalSchema, final DOMMountPointService mountService,
+            final BaseYangSwaggerGenerator swaggerGenerator) {
         this.globalSchema = Objects.requireNonNull(globalSchema);
         this.mountService = Objects.requireNonNull(mountService);
         this.swaggerGenerator = Objects.requireNonNull(swaggerGenerator);