Search in sources :

Example 1 with TopLevelListKey

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

the class Bug1418AugmentationTest method complexAugmentationUpdatedTest.

@Test
public void complexAugmentationUpdatedTest() {
    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());
    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());
    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
    assertContains(event.getUpdatedData(), COMPLEX_AUGMENT);
    assertContains(event.getCreatedData(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY_MOD));
    assertContains(event.getRemovedPaths(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY));
    assertContains(event.getOriginalData(), COMPLEX_AUGMENT);
    assertContains(event.getOriginalData(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY));
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) ListViaUses(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.augment.rev140709.complex.from.grouping.ListViaUses) DataObject(org.opendaylight.yangtools.yang.binding.DataObject) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) TopLevelListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey) Test(org.junit.Test) AbstractDataChangeListenerTest(org.opendaylight.controller.md.sal.binding.test.AbstractDataChangeListenerTest)

Example 2 with TopLevelListKey

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

the class Bug1418AugmentationTest method leafOnlyAugmentationCreatedTest.

@Test
public void leafOnlyAugmentationCreatedTest() {
    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());
    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
    assertContains(event.getCreatedData(), SIMPLE_AUGMENT);
    assertEmpty(event.getUpdatedData());
    assertEmpty(event.getOriginalData());
    assertEmpty(event.getRemovedPaths());
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) DataObject(org.opendaylight.yangtools.yang.binding.DataObject) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) TopLevelListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey) Test(org.junit.Test) AbstractDataChangeListenerTest(org.opendaylight.controller.md.sal.binding.test.AbstractDataChangeListenerTest)

Example 3 with TopLevelListKey

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

the class ForwardedNotificationAdapterTest method createTestData.

private TwoLevelListChanged createTestData() {
    final TwoLevelListChangedBuilder tb = new TwoLevelListChangedBuilder();
    tb.setTopLevelList(ImmutableList.of(new TopLevelListBuilder().setKey(new TopLevelListKey("test")).build()));
    return tb.build();
}
Also used : TopLevelListBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListBuilder) TwoLevelListChangedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChangedBuilder) TopLevelListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey)

Example 4 with TopLevelListKey

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

the class CachingCodecTest method createList.

private static Map<TopLevelListKey, TopLevelList> createList(final int num) {
    final ImmutableMap.Builder<TopLevelListKey, TopLevelList> builder = ImmutableMap.builder();
    for (int i = 0; i < num; i++) {
        final TopLevelListKey key = new TopLevelListKey("test-" + i);
        builder.put(key, new TopLevelListBuilder().withKey(key).build());
    }
    return builder.build();
}
Also used : TopLevelListBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListBuilder) TopLevelList(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList) ImmutableMap(com.google.common.collect.ImmutableMap) TopLevelListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListKey)

Example 5 with TopLevelListKey

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

the class Bug1418AugmentationTest method complexAugmentationCreatedTest.

@Test
public void complexAugmentationCreatedTest() {
    TreeComplexUsesAugment complexUsesAugment = complexUsesAugment(LIST_VIA_USES_KEY);
    final TestListener<TreeComplexUsesAugment> listener = createListener(CONFIGURATION, COMPLEX_AUGMENT, added(path(TOP_FOO_KEY, TreeComplexUsesAugment.class), complexUsesAugment));
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(CONFIGURATION, TOP, top());
    writeTx.put(CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
    writeTx.put(CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment);
    assertCommit(writeTx.commit());
    listener.verify();
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) TreeComplexUsesAugment(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeComplexUsesAugment) TopLevelListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListKey) AbstractDataTreeChangeListenerTest(org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataTreeChangeListenerTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)14 TopLevelListKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListKey)11 WriteTransaction (org.opendaylight.mdsal.binding.api.WriteTransaction)7 TopLevelListKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey)7 TopLevelList (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList)6 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)5 AbstractDataChangeListenerTest (org.opendaylight.controller.md.sal.binding.test.AbstractDataChangeListenerTest)5 AbstractDataTreeChangeListenerTest (org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataTreeChangeListenerTest)5 TopLevelListBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListBuilder)5 DataObject (org.opendaylight.yangtools.yang.binding.DataObject)5 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)5 TopLevelListBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListBuilder)4 TreeLeafOnlyUsesAugment (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeLeafOnlyUsesAugment)3 TopBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TopBuilder)3 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)2 ReadWriteTransaction (org.opendaylight.mdsal.binding.api.ReadWriteTransaction)2 AbstractDataBrokerTest (org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataBrokerTest)2 ListViaUses (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.augment.rev140709.complex.from.grouping.ListViaUses)2 TwoLevelListChangedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChangedBuilder)2 TreeComplexUsesAugment (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeComplexUsesAugment)2