Adjust for Binding RPC codegen changes
[controller.git] / opendaylight / md-sal / sal-inmemory-datastore / src / test / java / org / opendaylight / controller / md / sal / dom / store / impl / WildcardedScopeOneTest.java
index 1f2cb22..02797c2 100644 (file)
@@ -10,18 +10,16 @@ package org.opendaylight.controller.md.sal.dom.store.impl;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.top.level.list.NestedList;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
 
-    private static final InstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
+    private static final YangInstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
             TopLevelList.QNAME);
 
     @Override
@@ -30,14 +28,14 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    public void putTopLevelOneNested(final DatastoreTestTask task) throws Exception {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
         assertNotNull(change);
 
-        assertNotContains(change.getCreatedData(), TOP_LEVEL);
-        assertContains(change.getCreatedData(), path(FOO), path(FOO, BAR));
+        assertNotContains(change.getCreatedData(), TOP_LEVEL,path(FOO, BAR));
+        assertContains(change.getCreatedData(), path(FOO), path(FOO).node(NestedList.QNAME));
 
         assertEmpty(change.getUpdatedData());
         assertEmpty(change.getRemovedPaths());
@@ -45,39 +43,43 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws Exception {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
         assertNotNull(change);
-
-        assertContains(change.getCreatedData(), path(FOO, BAZ));
-        assertContains(change.getUpdatedData(), path(FOO));
+        /*
+         * Created data must NOT contain nested-list item since scope is base, and change is two
+         * level deep.
+         */
+        assertNotContains(change.getCreatedData(), path(FOO, BAZ));
+        assertContains(change.getUpdatedData(), path(FOO),path(FOO).node(NestedList.QNAME));
         assertNotContains(change.getUpdatedData(), TOP_LEVEL);
-        assertContains(change.getRemovedPaths(), path(FOO, BAR));
+        /*
+         * Removed data must NOT contain nested-list item since scope is base, and change is two
+         * level deep.
+         */
+        assertNotContains(change.getRemovedPaths(), path(FOO, BAR));
 
     }
 
     @Override
-    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws Exception {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
         assertNotNull(change);
         assertFalse(change.getCreatedData().isEmpty());
 
-        assertContains(change.getCreatedData(), path(FOO), path(FOO, BAR), path(FOO, BAZ));
-        assertNotContains(change.getCreatedData(), TOP_LEVEL);
+        // Base event should contain only changed item, and details about immediate child.
+        assertContains(change.getCreatedData(), path(FOO),path(FOO).node(NestedList.QNAME));
+        assertNotContains(change.getCreatedData(), TOP_LEVEL,path(FOO, BAR), path(FOO, BAZ));
         assertEmpty(change.getUpdatedData());
         assertEmpty(change.getRemovedPaths());
 
     }
 
     @Override
-    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws Exception {
 
-        Future<?> future = task.getChangeEvent();
         /*
          * One listener should be notified only and only if actual node changed its state,
          * since deletion of nested child (in this case /nested-list/nested-list[foo],
@@ -86,25 +88,24 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
          * and this means settable future containing receivedDataChangeEvent is not done.
          *
          */
-        assertFalse(future.isDone());
+        task.verifyNoChangeEvent();
     }
 
     @Override
-    public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws Exception {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
         assertEmpty(change.getCreatedData());
         assertEmpty(change.getUpdatedData());
 
         assertNotContains(change.getUpdatedData(), TOP_LEVEL);
-        assertContains(change.getRemovedPaths(), path(FOO),path(FOO, BAZ),path(FOO,BAR));
+        assertContains(change.getRemovedPaths(), path(FOO),path(FOO).node(NestedList.QNAME));
+        assertNotContains(change.getRemovedPaths(), path(FOO, BAZ),path(FOO,BAR));
     }
 
     @Override
-    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) {
-        Future<?> future = task.getChangeEvent();
+    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws Exception {
         /*
          * One listener should be notified only and only if actual node changed its state,
          * since deletion of nested child (in this case /nested-list/nested-list[foo],
@@ -113,12 +114,11 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
          * and this means settable future containing receivedDataChangeEvent is not done.
          *
          */
-        assertFalse(future.isDone());
+        task.verifyNoChangeEvent();
     }
 
     @Override
-    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
-        Future<?> future = task.getChangeEvent();
+    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws Exception {
         /*
          * One listener should be notified only and only if actual node changed its state,
          * since deletion of nested child (in this case /nested-list/nested-list[foo],
@@ -127,12 +127,12 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
          * and this means settable future containing receivedDataChangeEvent is not done.
          *
          */
-        assertFalse(future.isDone());
+        task.verifyNoChangeEvent();
     }
 
     @Override
-    protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+    protected void existingTopWriteSibling(final DatastoreTestTask task) throws Exception {
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
         assertContains(change.getCreatedData(), path(FOO_SIBLING));
         assertNotContains(change.getUpdatedData(),path(FOO), TOP_LEVEL);

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