X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Fimpl%2Ftest%2FBug1418AugmentationTest.java;h=ca6c78f0cf43516f37329d6ae6ade0f3fb525185;hp=6b5c825b83fa21a35353fdbfc79c41979ad6d54d;hb=03c13bd8a8bb89a729d739eb2fcd501a4dfa5439;hpb=a7730b0b1b7d86f270e7d2e1aff0e91e86cff125 diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug1418AugmentationTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug1418AugmentationTest.java index 6b5c825b83..ca6c78f0cf 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug1418AugmentationTest.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug1418AugmentationTest.java @@ -1,5 +1,21 @@ +/* + * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * 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.md.sal.binding.impl.test; +import static org.opendaylight.controller.md.sal.binding.test.AssertCollections.assertContains; +import static org.opendaylight.controller.md.sal.binding.test.AssertCollections.assertEmpty; +import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.TOP_FOO_KEY; +import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.complexUsesAugment; +import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.leafOnlyUsesAugment; +import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.top; +import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.topLevelList; + import org.junit.Test; import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; import org.opendaylight.controller.md.sal.binding.test.AbstractDataChangeListenerTest; @@ -16,16 +32,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import static org.junit.Assert.assertTrue; -import static org.opendaylight.controller.md.sal.binding.test.AssertCollections.assertContains; -import static org.opendaylight.controller.md.sal.binding.test.AssertCollections.assertEmpty; -import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.top; -import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.TOP_FOO_KEY; -import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.topLevelList; -import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.leafOnlyUsesAugment; -import static org.opendaylight.controller.md.sal.test.model.util.ListsBindingUtils.complexUsesAugment; - -public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{ +public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest { private static final InstanceIdentifier TOP = InstanceIdentifier.create(Top.class); private static final InstanceIdentifier TOP_FOO = TOP.child(TopLevelList.class, TOP_FOO_KEY); private static final InstanceIdentifier SIMPLE_AUGMENT = @@ -39,14 +46,13 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{ @Test public void leafOnlyAugmentationCreatedTest() { - TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, - AsyncDataBroker.DataChangeScope.SUBTREE); + final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, + AsyncDataBroker.DataChangeScope.SUBTREE, false); WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction(); writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top()); writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY))); writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf")); assertCommit(writeTx.submit()); - assertTrue(listener.hasEvent()); AsyncDataChangeEvent, DataObject> event = listener.event(); assertContains(event.getCreatedData(), SIMPLE_AUGMENT); assertEmpty(event.getUpdatedData()); @@ -61,12 +67,11 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{ writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY))); writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf")); assertCommit(writeTx.submit()); - TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, + final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, AsyncDataBroker.DataChangeScope.SUBTREE); writeTx = getDataBroker().newWriteOnlyTransaction(); writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf changed")); assertCommit(writeTx.submit()); - assertTrue(listener.hasEvent()); AsyncDataChangeEvent, DataObject> event = listener.event(); assertContains(event.getUpdatedData(), SIMPLE_AUGMENT); assertContains(event.getOriginalData(), SIMPLE_AUGMENT); @@ -81,12 +86,11 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{ writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY))); writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf")); assertCommit(writeTx.submit()); - TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, + final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, AsyncDataBroker.DataChangeScope.SUBTREE); writeTx = getDataBroker().newWriteOnlyTransaction(); writeTx.delete(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT); assertCommit(writeTx.submit()); - assertTrue(listener.hasEvent()); AsyncDataChangeEvent, DataObject> event = listener.event(); assertContains(event.getRemovedPaths(), SIMPLE_AUGMENT); assertContains(event.getOriginalData(), SIMPLE_AUGMENT); @@ -96,14 +100,13 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{ @Test public void complexAugmentationCreatedTest() { - TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, - AsyncDataBroker.DataChangeScope.SUBTREE); + final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, + AsyncDataBroker.DataChangeScope.SUBTREE, false); WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction(); writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top()); writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY))); writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY)); assertCommit(writeTx.submit()); - assertTrue(listener.hasEvent()); AsyncDataChangeEvent, DataObject> event = listener.event(); assertContains(event.getCreatedData(), COMPLEX_AUGMENT); assertContains(event.getCreatedData(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY)); @@ -119,12 +122,11 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{ writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY))); writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY)); assertCommit(writeTx.submit()); - TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, + final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, AsyncDataBroker.DataChangeScope.SUBTREE); writeTx = getDataBroker().newWriteOnlyTransaction(); writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY_MOD)); assertCommit(writeTx.submit()); - assertTrue(listener.hasEvent()); AsyncDataChangeEvent, DataObject> event = listener.event(); assertContains(event.getUpdatedData(), COMPLEX_AUGMENT); assertContains(event.getCreatedData(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY_MOD));