Fix warnings in topology-manager 72/94372/2
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 3 Jan 2021 17:07:00 +0000 (18:07 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 3 Jan 2021 18:01:02 +0000 (19:01 +0100)
Use BindingMap.ordered() to perform minimal migration of tests,
also fixing obvious warnings reported by Eclipse.

Change-Id: Id8c804d6fa02da269c079993a8f4d9609e350ac3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/DataTreeChangeListenerImpl.java
applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/FlowCapableTopologyExporter.java
applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/NodeChangeListenerImpl.java
applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/NodeChangeListenerImplTest.java
applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/TerminationPointChangeListenerImplTest.java

index 8e37a0a297559aa0761f7e6ca19dc72a32f1d888..61860351094d97238d9e52a1340f2b5c4d17d70f 100644 (file)
@@ -31,7 +31,7 @@ public abstract class DataTreeChangeListenerImpl<T extends DataObject> implement
     private static final Logger LOG = LoggerFactory.getLogger(DataTreeChangeListenerImpl.class);
     private static final long STARTUP_LOOP_TICK = 500L;
     private static final int STARTUP_LOOP_MAX_RETRIES = 8;
-    protected final ListenerRegistration<DataTreeChangeListener> listenerRegistration;
+    protected final ListenerRegistration<?> listenerRegistration;
     protected OperationProcessor operationProcessor;
 
     static final InstanceIdentifier<Topology> II_TO_TOPOLOGY = InstanceIdentifier.create(NetworkTopology.class)
@@ -77,7 +77,7 @@ public abstract class DataTreeChangeListenerImpl<T extends DataObject> implement
                        nodeKeyInTopology).build();
     }
 
-    NodeId provideTopologyNodeId(InstanceIdentifier<T> iiToNodeInInventory) {
+    NodeId provideTopologyNodeId(final InstanceIdentifier<T> iiToNodeInInventory) {
         final NodeKey inventoryNodeKey = iiToNodeInInventory.firstKeyOf(Node.class);
         if (inventoryNodeKey != null) {
             return new NodeId(inventoryNodeKey.getId().getValue());
index 15b0c1a059ec254aa4ad1e27f98b73ca7bd2eb44..2935fe077d16684f7f6dc8ff62031c674d6a0674 100644 (file)
@@ -37,6 +37,7 @@ class FlowCapableTopologyExporter implements FlowTopologyDiscoveryListener {
     }
 
     @Override
+    @Deprecated
     public void onLinkDiscovered(final LinkDiscovered notification) {
         processor.enqueueOperation(new TopologyOperation() {
             @Override
@@ -54,11 +55,13 @@ class FlowCapableTopologyExporter implements FlowTopologyDiscoveryListener {
     }
 
     @Override
+    @Deprecated
     public void onLinkOverutilized(final LinkOverutilized notification) {
         // NOOP
     }
 
     @Override
+    @Deprecated
     public void onLinkRemoved(final LinkRemoved notification) {
         processor.enqueueOperation(new TopologyOperation() {
             @Override
@@ -86,8 +89,8 @@ class FlowCapableTopologyExporter implements FlowTopologyDiscoveryListener {
     }
 
     @Override
+    @Deprecated
     public void onLinkUtilizationNormal(final LinkUtilizationNormal notification) {
         // NOOP
     }
-
 }
index f8030e30acb4b848b697eb100b0051538692c093..9814d1fe8fe7c723d3012568c82af1e61838d855 100644 (file)
@@ -40,7 +40,7 @@ public class NodeChangeListenerImpl extends DataTreeChangeListenerImpl<FlowCapab
 
     @Override
     public void onDataTreeChanged(final Collection<DataTreeModification<FlowCapableNode>> modifications) {
-        for (DataTreeModification modification : modifications) {
+        for (DataTreeModification<FlowCapableNode> modification : modifications) {
             switch (modification.getRootNode().getModificationType()) {
                 case WRITE:
                     processAddedNode(modification);
index 27c6a821c7fbd37c5122ac3a1af9d06599f05a4b..320c26eca9d7a6155be1f41a3db6ecb533057712 100644 (file)
@@ -51,6 +51,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
 import org.opendaylight.yangtools.util.concurrent.FluentFutures;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
 
 public class NodeChangeListenerImplTest extends DataTreeChangeListenerBase {
     @SuppressWarnings({ "rawtypes" })
@@ -70,7 +71,9 @@ public class NodeChangeListenerImplTest extends DataTreeChangeListenerBase {
                 newLink("link1", newSourceNode("node1"), newDestNode("dest")),
                 newLink("link2", newSourceNode("source"), newDestNode("node1")),
                 newLink("link3", newSourceNode("source2"), newDestNode("dest2")));
-        final Topology topology = new TopologyBuilder().withKey(topologyIID.getKey()).setLink(linkList).build();
+        final Topology topology = new TopologyBuilder().withKey(topologyIID.getKey())
+            .setLink(BindingMap.ordered(linkList))
+            .build();
 
         final InstanceIdentifier[] expDeletedIIDs = {
                 topologyIID.child(Link.class, linkList.get(0).key()),
index 95037655a2426068e95b4b89b523f37d68fd0566..02bf1c9cbe0b921002448731842674196b46045c 100644 (file)
@@ -57,6 +57,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
 import org.opendaylight.yangtools.util.concurrent.FluentFutures;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
 
 public class TerminationPointChangeListenerImplTest extends DataTreeChangeListenerBase {
     @SuppressWarnings("rawtypes")
@@ -81,7 +82,9 @@ public class TerminationPointChangeListenerImplTest extends DataTreeChangeListen
                 newLink("link1", newSourceTp("tp1"), newDestTp("dest")),
                 newLink("link2", newSourceTp("source"), newDestTp("tp1")),
                 newLink("link3", newSourceTp("source2"), newDestTp("dest2")));
-        final Topology topology = new TopologyBuilder().withKey(topologyIID.getKey()).setLink(linkList).build();
+        final Topology topology = new TopologyBuilder().withKey(topologyIID.getKey())
+            .setLink(BindingMap.ordered(linkList))
+            .build();
 
         final InstanceIdentifier[] expDeletedIIDs = {
                 topologyIID.child(Link.class, linkList.get(0).key()),
@@ -220,7 +223,9 @@ public class TerminationPointChangeListenerImplTest extends DataTreeChangeListen
         final InstanceIdentifier<?> invNodeConnID = newNodeConnID(nodeKey, ncKey);
 
         List<Link> linkList = Arrays.asList(newLink("link1", newSourceTp("tp1"), newDestTp("dest")));
-        Topology topology = new TopologyBuilder().withKey(topologyIID.getKey()).setLink(linkList).build();
+        Topology topology = new TopologyBuilder().withKey(topologyIID.getKey())
+            .setLink(BindingMap.ordered(linkList))
+            .build();
 
         ReadWriteTransaction mockTx = mock(ReadWriteTransaction.class);
         doReturn(FluentFutures.immediateFluentFuture(Optional.of(topology))).when(mockTx)
@@ -265,7 +270,9 @@ public class TerminationPointChangeListenerImplTest extends DataTreeChangeListen
         final InstanceIdentifier<?> invNodeConnID = newNodeConnID(nodeKey, ncKey);
 
         List<Link> linkList = Arrays.asList(newLink("link1", newSourceTp("tp1"), newDestTp("dest")));
-        Topology topology = new TopologyBuilder().withKey(topologyIID.getKey()).setLink(linkList).build();
+        Topology topology = new TopologyBuilder().withKey(topologyIID.getKey())
+            .setLink(BindingMap.ordered(linkList))
+            .build();
 
         ReadWriteTransaction mockTx = mock(ReadWriteTransaction.class);
         doReturn(FluentFutures.immediateFluentFuture(Optional.of(topology))).when(mockTx)