X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-inmemory-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fimpl%2FWildcardedScopeOneTest.java;h=02797c27610c88a0c411f6674f4d5abda16256f2;hp=3407e0ffa4c6511a55b7d11c5bdd4ca9a0a718f2;hb=258d8039ac144aeee2efa7943228c0fc6cdaf651;hpb=26d0e25159bf3b73ca38a88e17268cf17f876d8d diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeOneTest.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeOneTest.java index 3407e0ffa4..02797c2761 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeOneTest.java +++ b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeOneTest.java @@ -10,10 +10,10 @@ 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 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.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; @@ -28,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> 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()); @@ -43,37 +43,42 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite { } @Override - public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException, - ExecutionException { + public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws Exception { AsyncDataChangeEvent> 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> 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 { /* * One listener should be notified only and only if actual node changed its state, @@ -87,8 +92,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite { } @Override - public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException, - ExecutionException { + public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws Exception { AsyncDataChangeEvent> change = task.getChangeEvent(); @@ -96,11 +100,12 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite { 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) { + 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,7 +118,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite { } @Override - protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException { + 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], @@ -126,7 +131,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite { } @Override - protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException { + protected void existingTopWriteSibling(final DatastoreTestTask task) throws Exception { AsyncDataChangeEvent> change = task.getChangeEvent(); assertContains(change.getCreatedData(), path(FOO_SIBLING));