Search in sources :

Example 21 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 Bug1418AugmentationTest method complexAugmentationUpdatedTest.

@Test
public void complexAugmentationUpdatedTest() {
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(CONFIGURATION, TOP, top());
    writeTx.put(CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
    TreeComplexUsesAugment complexUsesAugmentBefore = complexUsesAugment(LIST_VIA_USES_KEY);
    writeTx.put(CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugmentBefore);
    assertCommit(writeTx.commit());
    TreeComplexUsesAugment complexUsesAugmentAfter = complexUsesAugment(LIST_VIA_USES_KEY_MOD);
    final TestListener<TreeComplexUsesAugment> listener = createListener(CONFIGURATION, COMPLEX_AUGMENT, added(path(TOP_FOO_KEY, TreeComplexUsesAugment.class), complexUsesAugmentBefore), replaced(path(TOP_FOO_KEY, TreeComplexUsesAugment.class), complexUsesAugmentBefore, complexUsesAugmentAfter));
    writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugmentAfter);
    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)

Example 22 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 Bug1418AugmentationTest method leafOnlyAugmentationCreatedTest.

@Test
public void leafOnlyAugmentationCreatedTest() {
    TreeLeafOnlyUsesAugment leafOnlyUsesAugment = leafOnlyUsesAugment("test leaf");
    final TestListener<TreeLeafOnlyUsesAugment> listener = createListener(CONFIGURATION, SIMPLE_AUGMENT, added(path(TOP_FOO_KEY, TreeLeafOnlyUsesAugment.class), leafOnlyUsesAugment));
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(CONFIGURATION, TOP, top());
    writeTx.put(CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
    writeTx.put(CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment);
    assertCommit(writeTx.commit());
    listener.verify();
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) TreeLeafOnlyUsesAugment(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeLeafOnlyUsesAugment) 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)

Example 23 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 Bug1418AugmentationTest method leafOnlyAugmentationDeletedTest.

@Test
public void leafOnlyAugmentationDeletedTest() {
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(CONFIGURATION, TOP, top());
    writeTx.put(CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
    TreeLeafOnlyUsesAugment leafOnlyUsesAugment = leafOnlyUsesAugment("test leaf");
    writeTx.put(CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment);
    assertCommit(writeTx.commit());
    final TestListener<TreeLeafOnlyUsesAugment> listener = createListener(CONFIGURATION, SIMPLE_AUGMENT, added(path(TOP_FOO_KEY, TreeLeafOnlyUsesAugment.class), leafOnlyUsesAugment), deleted(path(TOP_FOO_KEY, TreeLeafOnlyUsesAugment.class), leafOnlyUsesAugment));
    writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.delete(CONFIGURATION, SIMPLE_AUGMENT);
    assertCommit(writeTx.commit());
    listener.verify();
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) TreeLeafOnlyUsesAugment(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeLeafOnlyUsesAugment) 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)

Example 24 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 BindingDOMRpcIntegrationTest method knockKnock.

private static KnockKnockInputBuilder knockKnock(final InstanceIdentifier<TopLevelList> listId) {
    KnockKnockInputBuilder builder = new KnockKnockInputBuilder();
    builder.setKnockerId(listId);
    return builder;
}
Also used : KnockKnockInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockInputBuilder)

Example 25 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 AbstractDataBrokerTestTest method writeInitialState.

// copy/pasted from Bug1125RegressionTest.writeInitialState()
private void writeInitialState() throws InterruptedException, ExecutionException {
    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));
    initialTx.commit().get();
}
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)

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