Adjust to DOMDataTreeChangeListener update
[controller.git] / opendaylight / md-sal / samples / clustering-test-app / provider / src / main / java / org / opendaylight / controller / clustering / it / provider / impl / IdIntsListener.java
index 60d624442b1f9d4b4bd7f303a75b944fa958df17..e9055456497ead0b6a4ff1e9233ca85e20983870 100644 (file)
@@ -5,12 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.clustering.it.provider.impl;
 
+import static com.google.common.base.Preconditions.checkState;
 import static org.opendaylight.controller.clustering.it.provider.impl.AbstractTransactionHandler.ITEM;
 
-import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.SettableFuture;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Collection;
@@ -22,8 +21,7 @@ import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeListener;
+import org.opendaylight.mdsal.dom.api.ClusteredDOMDataTreeChangeListener;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
@@ -34,20 +32,24 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class IdIntsListener implements ClusteredDOMDataTreeChangeListener {
-
     private static final Logger LOG = LoggerFactory.getLogger(IdIntsListener.class);
     private static final long SECOND_AS_NANO = 1000000000;
 
-    private volatile NormalizedNode<?, ?> localCopy;
+    private volatile NormalizedNode localCopy;
     private final AtomicLong lastNotifTimestamp = new AtomicLong(0);
     private ScheduledExecutorService executorService;
     private ScheduledFuture<?> scheduledFuture;
 
     @Override
-    public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes) {
+    public void onInitialData() {
+        // Intentional no-op
+    }
+
+    @Override
+    public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
 
         // There should only be one candidate reported
-        Preconditions.checkState(changes.size() == 1);
+        checkState(changes.size() == 1);
 
         lastNotifTimestamp.set(System.nanoTime());
 
@@ -72,12 +74,12 @@ public class IdIntsListener implements ClusteredDOMDataTreeChangeListener {
         return localCopy != null;
     }
 
-    public boolean checkEqual(final NormalizedNode<?, ?> expected) {
+    public boolean checkEqual(final NormalizedNode expected) {
         return localCopy.equals(expected);
     }
 
     @SuppressFBWarnings("BC_UNCONFIRMED_CAST")
-    public String diffWithLocalCopy(final NormalizedNode<?, ?> expected) {
+    public String diffWithLocalCopy(final NormalizedNode expected) {
         return diffNodes((MapNode)expected, (MapNode)localCopy);
     }
 
@@ -96,9 +98,9 @@ public class IdIntsListener implements ClusteredDOMDataTreeChangeListener {
         final YangInstanceIdentifier.NodeIdentifier itemNodeId = new YangInstanceIdentifier.NodeIdentifier(ITEM);
 
         Map<NodeIdentifierWithPredicates, MapEntryNode> expIdIntMap = new HashMap<>();
-        expected.getValue().forEach(node -> expIdIntMap.put(node.getIdentifier(), node));
+        expected.body().forEach(node -> expIdIntMap.put(node.getIdentifier(), node));
 
-        actual.getValue().forEach(actIdInt -> {
+        actual.body().forEach(actIdInt -> {
             final MapEntryNode expIdInt = expIdIntMap.remove(actIdInt.getIdentifier());
             if (expIdInt == null) {
                 builder.append('\n').append("  Unexpected id-int entry for ").append(actIdInt.getIdentifier());
@@ -106,10 +108,10 @@ public class IdIntsListener implements ClusteredDOMDataTreeChangeListener {
             }
 
             Map<NodeIdentifierWithPredicates, MapEntryNode> expItemMap = new HashMap<>();
-            ((MapNode)expIdInt.getChild(itemNodeId).get()).getValue()
+            ((MapNode)expIdInt.findChildByArg(itemNodeId).get()).body()
                 .forEach(node -> expItemMap.put(node.getIdentifier(), node));
 
-            ((MapNode)actIdInt.getChild(itemNodeId).get()).getValue().forEach(actItem -> {
+            ((MapNode)actIdInt.findChildByArg(itemNodeId).get()).body().forEach(actItem -> {
                 final MapEntryNode expItem = expItemMap.remove(actItem.getIdentifier());
                 if (expItem == null) {
                     builder.append('\n').append("  Unexpected item entry ").append(actItem.getIdentifier())