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 WriteTransactionTest method testMergeCreateParentsSuccess.
@Test
public void testMergeCreateParentsSuccess() throws TransactionCommitFailedException, InterruptedException, ExecutionException {
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.merge(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());
}
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 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.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project controller by opendaylight.
the class BrokerIntegrationTest method simpleModifyOperation.
@Test
public void simpleModifyOperation() throws Exception {
DataBroker dataBroker = testContext.getDataBroker();
Optional<TopLevelList> tllFoo = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, FOO_PATH).checkedGet(5, TimeUnit.SECONDS);
assertFalse(tllFoo.isPresent());
TopLevelList tllFooData = createTll(TLL_FOO_KEY);
final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
transaction.put(LogicalDatastoreType.CONFIGURATION, FOO_PATH, tllFooData);
transaction.submit().get(5, TimeUnit.SECONDS);
Optional<TopLevelList> readedData = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, FOO_PATH).checkedGet(5, TimeUnit.SECONDS);
assertTrue(readedData.isPresent());
assertEquals(tllFooData.getKey(), readedData.get().getKey());
TopLevelList nodeBarData = createTll(TLL_BAR_KEY);
TopLevelList nodeBazData = createTll(TLL_BAZ_KEY);
final WriteTransaction insertMoreTr = dataBroker.newWriteOnlyTransaction();
insertMoreTr.put(LogicalDatastoreType.CONFIGURATION, BAR_PATH, nodeBarData);
insertMoreTr.put(LogicalDatastoreType.CONFIGURATION, BAZ_PATH, nodeBazData);
insertMoreTr.submit().get(5, TimeUnit.SECONDS);
Optional<Top> top = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, TOP_PATH).checkedGet(5, TimeUnit.SECONDS);
assertTrue(top.isPresent());
assertEquals(3, top.get().getTopLevelList().size());
// We create transaction no 2
final WriteTransaction removalTransaction = dataBroker.newWriteOnlyTransaction();
// We remove node 1
removalTransaction.delete(LogicalDatastoreType.CONFIGURATION, BAR_PATH);
// We commit transaction
removalTransaction.submit().get(5, TimeUnit.SECONDS);
Optional<TopLevelList> readedData2 = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, BAR_PATH).checkedGet(5, TimeUnit.SECONDS);
assertFalse(readedData2.isPresent());
}
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 CrossBrokerRpcTest method knockKnock.
private static KnockKnockInputBuilder knockKnock(final InstanceIdentifier<TopLevelList> listId) {
KnockKnockInputBuilder builder = new KnockKnockInputBuilder();
builder.setKnockerId(listId);
return builder;
}
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 WriteTransactionTest method testMergeCreateParentsSuccess.
@Test
public void testMergeCreateParentsSuccess() throws InterruptedException, ExecutionException {
final WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE);
writeTx.commit().get();
final ReadTransaction readTx = getDataBroker().newReadOnlyTransaction();
final Optional<Top> topNode = readTx.read(LogicalDatastoreType.OPERATIONAL, TOP_PATH).get();
assertTrue("Top node must exists after commit", topNode.isPresent());
final Optional<TopLevelList> listNode = readTx.read(LogicalDatastoreType.OPERATIONAL, NODE_PATH).get();
assertTrue("List node must exists after commit", listNode.isPresent());
}
Aggregations