Search in sources :

Example 61 with TopLevelList

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project mdsal by opendaylight.

the class ListInsertionDataChangeListenerTest method replaceTopNodeSubtreeListeners.

@Test
public void replaceTopNodeSubtreeListeners() {
    final TopLevelList topBar = topLevelList(TOP_BAR_KEY);
    final Top top = top(topBar);
    final TopLevelList topFoo = topLevelList(TOP_FOO_KEY);
    // Listener for TOP element
    final TestListener<Top> topListener = createListener(CONFIGURATION, TOP, added(TOP, top(topLevelList(TOP_FOO_KEY))), replaced(TOP, top(topFoo), top));
    // Listener for all list items. This one should see Foo item deleted and Bar item added.
    final TestListener<TopLevelList> allListener = createListener(CONFIGURATION, WILDCARDED, added(TOP_FOO, topFoo), added(TOP_BAR, topBar), deleted(TOP_FOO, topFoo));
    // Listener for all Foo item. This one should see only Foo item deleted.
    final TestListener<TopLevelList> fooListener = createListener(CONFIGURATION, TOP_FOO, added(TOP_FOO, topFoo), deleted(TOP_FOO, topFoo));
    // Listener for bar list items.
    final TestListener<TopLevelList> barListener = createListener(CONFIGURATION, TOP_BAR, added(TOP_BAR, topBar));
    ReadWriteTransaction writeTx = getDataBroker().newReadWriteTransaction();
    writeTx.put(CONFIGURATION, TOP, top);
    assertCommit(writeTx.commit());
    topListener.verify();
    allListener.verify();
    fooListener.verify();
    barListener.verify();
}
Also used : Top(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.Top) TopLevelList(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList) ReadWriteTransaction(org.opendaylight.mdsal.binding.api.ReadWriteTransaction) AbstractDataTreeChangeListenerTest(org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataTreeChangeListenerTest) Test(org.junit.Test)

Example 62 with TopLevelList

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project mdsal by opendaylight.

the class ListInsertionDataChangeListenerTest method mergeTopBarNodeSubtreeListeners.

@Test
public void mergeTopBarNodeSubtreeListeners() {
    final TopLevelList topBar = topLevelList(TOP_BAR_KEY);
    final TopLevelList topFoo = topLevelList(TOP_FOO_KEY);
    final TestListener<Top> topListener = createListener(CONFIGURATION, TOP, added(TOP, top(topLevelList(TOP_FOO_KEY))), topSubtreeModified(topFoo, topBar));
    final TestListener<TopLevelList> allListener = createListener(CONFIGURATION, WILDCARDED, added(TOP_FOO, topFoo), added(TOP_BAR, topBar));
    final TestListener<TopLevelList> fooListener = createListener(CONFIGURATION, TOP_FOO, added(TOP_FOO, topFoo));
    final TestListener<TopLevelList> barListener = createListener(CONFIGURATION, TOP_BAR, added(TOP_BAR, topBar));
    ReadWriteTransaction writeTx = getDataBroker().newReadWriteTransaction();
    writeTx.merge(CONFIGURATION, TOP_BAR, topLevelList(TOP_BAR_KEY));
    assertCommit(writeTx.commit());
    topListener.verify();
    allListener.verify();
    fooListener.verify();
    barListener.verify();
}
Also used : Top(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.Top) TopLevelList(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList) ReadWriteTransaction(org.opendaylight.mdsal.binding.api.ReadWriteTransaction) AbstractDataTreeChangeListenerTest(org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataTreeChangeListenerTest) Test(org.junit.Test)

Example 63 with TopLevelList

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project mdsal by opendaylight.

the class ListInsertionDataChangeListenerTest method putTopBarNodeSubtreeListeners.

@Test
public void putTopBarNodeSubtreeListeners() {
    final TopLevelList topBar = topLevelList(TOP_BAR_KEY);
    final TopLevelList topFoo = topLevelList(TOP_FOO_KEY);
    final TestListener<Top> topListener = createListener(CONFIGURATION, TOP, added(TOP, top(topLevelList(TOP_FOO_KEY))), topSubtreeModified(topFoo, topBar));
    final TestListener<TopLevelList> allListener = createListener(CONFIGURATION, WILDCARDED, added(TOP_FOO, topFoo), added(TOP_BAR, topBar));
    final TestListener<TopLevelList> fooListener = createListener(CONFIGURATION, TOP_FOO, added(TOP_FOO, topFoo));
    final TestListener<TopLevelList> barListener = createListener(CONFIGURATION, TOP_BAR, added(TOP_BAR, topBar));
    ReadWriteTransaction writeTx = getDataBroker().newReadWriteTransaction();
    writeTx.put(CONFIGURATION, TOP_BAR, topLevelList(TOP_BAR_KEY));
    assertCommit(writeTx.commit());
    topListener.verify();
    allListener.verify();
    fooListener.verify();
    barListener.verify();
}
Also used : Top(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.Top) TopLevelList(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList) ReadWriteTransaction(org.opendaylight.mdsal.binding.api.ReadWriteTransaction) AbstractDataTreeChangeListenerTest(org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataTreeChangeListenerTest) Test(org.junit.Test)

Example 64 with TopLevelList

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project mdsal by opendaylight.

the class Bug1125RegressionTest method writeInitialState.

private TreeComplexUsesAugment writeInitialState() {
    WriteTransaction initialTx = getDataBroker().newWriteOnlyTransaction();
    initialTx.put(LogicalDatastoreType.OPERATIONAL, TOP_PATH, new TopBuilder().build());
    TreeComplexUsesAugment fooAugment = new TreeComplexUsesAugmentBuilder().setContainerWithUses(new ContainerWithUsesBuilder().setLeafFromGrouping("foo").build()).build();
    initialTx.put(LogicalDatastoreType.OPERATIONAL, path(TOP_FOO_KEY), topLevelList(TOP_FOO_KEY, fooAugment));
    assertCommit(initialTx.commit());
    return fooAugment;
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) TopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder) TreeComplexUsesAugment(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeComplexUsesAugment) ContainerWithUsesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.complex.from.grouping.ContainerWithUsesBuilder) TreeComplexUsesAugmentBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeComplexUsesAugmentBuilder)

Example 65 with TopLevelList

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project mdsal by opendaylight.

the class Bug1333DataChangeListenerTest method deleteAugmentChildListenTopSubtree.

@Test
public void deleteAugmentChildListenTopSubtree() {
    Top top = writeTopWithListItem(CONFIGURATION);
    TestListener<Top> listener = createListener(CONFIGURATION, TOP_PATH, added(TOP_PATH, top), subtreeModified(TOP_PATH, top, top(topLevelList(TOP_FOO_KEY, complexUsesAugment(USES_TWO_KEY)))));
    InstanceIdentifier<ListViaUses> deletePath = path(TOP_FOO_KEY, USES_ONE_KEY);
    deleteItem(CONFIGURATION, deletePath);
    listener.verify();
}
Also used : ListViaUses(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.complex.from.grouping.ListViaUses) Top(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.Top) AbstractDataTreeChangeListenerTest(org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataTreeChangeListenerTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)61 TopLevelList (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList)32 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)26 Assert.assertEquals (org.junit.Assert.assertEquals)23 LogicalDatastoreType (org.opendaylight.mdsal.common.api.LogicalDatastoreType)23 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)22 OptimisticLockFailedException (org.opendaylight.mdsal.common.api.OptimisticLockFailedException)21 TopLevelList (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList)20 WriteTransaction (org.opendaylight.mdsal.binding.api.WriteTransaction)18 DataObject (org.opendaylight.yangtools.yang.binding.DataObject)14 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)13 ExecutionException (java.util.concurrent.ExecutionException)12 Assert.assertThrows (org.junit.Assert.assertThrows)12 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)12 Before (org.junit.Before)11 AbstractDataTreeChangeListenerTest (org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataTreeChangeListenerTest)11 TopLevelListKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListKey)11 IOException (java.io.IOException)10 OPERATIONAL (org.opendaylight.mdsal.binding.util.Datastore.OPERATIONAL)10 TreeComplexUsesAugmentBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeComplexUsesAugmentBuilder)10