use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project controller by opendaylight.
the class Bug1418AugmentationTest method complexAugmentationCreatedTest.
@Test
public void complexAugmentationCreatedTest() {
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());
AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
assertContains(event.getCreatedData(), COMPLEX_AUGMENT);
assertContains(event.getCreatedData(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY));
assertEmpty(event.getUpdatedData());
assertEmpty(event.getOriginalData());
assertEmpty(event.getRemovedPaths());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project controller by opendaylight.
the class Bug1418AugmentationTest method leafOnlyAugmentationUpdatedTest.
@Test
public void leafOnlyAugmentationUpdatedTest() {
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());
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());
AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
assertContains(event.getUpdatedData(), SIMPLE_AUGMENT);
assertContains(event.getOriginalData(), SIMPLE_AUGMENT);
assertEmpty(event.getCreatedData());
assertEmpty(event.getRemovedPaths());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project controller by opendaylight.
the class Bug1418AugmentationTest method leafOnlyAugmentationDeletedTest.
@Test
public void leafOnlyAugmentationDeletedTest() {
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());
final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, AsyncDataBroker.DataChangeScope.SUBTREE);
writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.delete(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT);
assertCommit(writeTx.submit());
AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
assertContains(event.getRemovedPaths(), SIMPLE_AUGMENT);
assertContains(event.getOriginalData(), SIMPLE_AUGMENT);
assertEmpty(event.getCreatedData());
assertEmpty(event.getUpdatedData());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project controller by opendaylight.
the class ListsBindingUtils method topLevelList.
public static TopLevelList topLevelList(final TopLevelListKey key, final TreeComplexUsesAugment augment) {
TopLevelListBuilder builder = new TopLevelListBuilder().setKey(key);
builder.addAugmentation(TreeComplexUsesAugment.class, augment);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project genius by opendaylight.
the class RetryingManagedNewTransactionRunnerTest method testCallWithNewReadWriteTransactionReadFailedException.
@Test
public void testCallWithNewReadWriteTransactionReadFailedException() throws Exception {
testableDataBroker.failReads(2, new ReadFailedException("bada boum bam!"));
TopLevelList data = newTestDataObject();
managedNewTransactionRunner.callWithNewReadWriteTransactionAndSubmit(tx -> {
tx.put(LogicalDatastoreType.OPERATIONAL, TEST_PATH, data);
assertEquals(data, tx.read(LogicalDatastoreType.OPERATIONAL, TEST_PATH).get().get());
}).get();
assertEquals(data, singleTransactionDataBroker.syncRead(OPERATIONAL, TEST_PATH));
}
Aggregations