use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TopBuilder 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.TopBuilder in project controller by opendaylight.
the class AbstractDataBrokerTestTest method writeInitialState.
// copy/pasted from Bug1125RegressionTest.writeInitialState()
private void writeInitialState() throws TransactionCommitFailedException {
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.submit().checkedGet();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TopBuilder in project controller by opendaylight.
the class Bug1125RegressionTest method writeInitialState.
private void 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.submit());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TopBuilder in project controller by opendaylight.
the class WriteTransactionTest method test.
@Test
public void test() throws InterruptedException, ExecutionException {
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.OPERATIONAL, TOP_PATH, new TopBuilder().build());
writeTx.put(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE);
writeTx.submit().get();
}
Aggregations