use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList in project controller by opendaylight.
the class Bug1333DataChangeListenerTest method writeTopWithListItem.
public void writeTopWithListItem(final LogicalDatastoreType store) {
ReadWriteTransaction tx = getDataBroker().newReadWriteTransaction();
Top topItem = top(topLevelList(TOP_FOO_KEY, complexUsesAugment(USES_ONE_KEY, USES_TWO_KEY)));
tx.put(store, TOP_PATH, topItem);
assertCommit(tx.submit());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList 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));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList in project controller by opendaylight.
the class DataTreeChangeListenerTest method testWildcardNotificationOfPreexistingData.
@SuppressWarnings("unchecked")
@Test
public void testWildcardNotificationOfPreexistingData() throws Exception {
InstanceIdentifier<Top> id = InstanceIdentifier.builder(Top.class).build();
ArrayList<TopLevelList> list = new ArrayList<>();
list.add(new TopLevelListBuilder().setName("name").build());
TopBuilder builder = new TopBuilder().setTopLevelList(list);
DataBroker dataBroker = getDataBroker();
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
writeTransaction.put(LogicalDatastoreType.OPERATIONAL, id, builder.build());
assertCommit(writeTransaction.submit());
DataTreeChangeListener<TopLevelList> listener = mock(DataTreeChangeListener.class);
InstanceIdentifier<TopLevelList> wildcard = InstanceIdentifier.builder(Top.class).child(TopLevelList.class).build();
dataBroker.registerDataTreeChangeListener(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, wildcard), listener);
verify(listener, timeout(1000)).onDataTreeChanged(Matchers.anyObject());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList in project controller by opendaylight.
the class WriteTransactionTest method testPutCreateParentsSuccess.
@Test
public void testPutCreateParentsSuccess() throws TransactionCommitFailedException, InterruptedException, ExecutionException {
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE, true);
writeTx.submit().checkedGet();
ReadOnlyTransaction readTx = getDataBroker().newReadOnlyTransaction();
Optional<Top> topNode = readTx.read(LogicalDatastoreType.OPERATIONAL, TOP_PATH).get();
assertTrue("Top node must exists after commit", topNode.isPresent());
Optional<TopLevelList> listNode = readTx.read(LogicalDatastoreType.OPERATIONAL, NODE_PATH).get();
assertTrue("List node must exists after commit", listNode.isPresent());
}
Aggregations