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 leafOnlyAugmentationUpdatedTest.
@Test
public void leafOnlyAugmentationUpdatedTest() {
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(CONFIGURATION, TOP, top());
writeTx.put(CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
TreeLeafOnlyUsesAugment leafOnlyUsesAugmentBefore = leafOnlyUsesAugment("test leaf");
writeTx.put(CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugmentBefore);
assertCommit(writeTx.commit());
TreeLeafOnlyUsesAugment leafOnlyUsesAugmentAfter = leafOnlyUsesAugment("test leaf changed");
final TestListener<TreeLeafOnlyUsesAugment> listener = createListener(CONFIGURATION, SIMPLE_AUGMENT, added(path(TOP_FOO_KEY, TreeLeafOnlyUsesAugment.class), leafOnlyUsesAugmentBefore), replaced(path(TOP_FOO_KEY, TreeLeafOnlyUsesAugment.class), leafOnlyUsesAugmentBefore, leafOnlyUsesAugmentAfter));
writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugmentAfter);
assertCommit(writeTx.commit());
listener.verify();
}
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 Bug4494Test method testDelete.
@Test
public void testDelete() throws Exception {
DataBroker dataBroker = getDataBroker();
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
TopLevelList list = new TopLevelListBuilder().setName("name").build();
TopBuilder builder = new TopBuilder().setTopLevelList(Map.of(list.key(), list));
writeTransaction.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Top.class), builder.build());
assertCommit(writeTransaction.commit());
InstanceIdentifier<TopLevelList> id = InstanceIdentifier.builder(Top.class).child(TopLevelList.class, new TopLevelListKey("name")).build();
ReadWriteTransaction writeTransaction1 = dataBroker.newReadWriteTransaction();
writeTransaction1.delete(LogicalDatastoreType.OPERATIONAL, id);
assertCommit(writeTransaction1.commit());
ReadWriteTransaction writeTransaction2 = dataBroker.newReadWriteTransaction();
writeTransaction2.delete(LogicalDatastoreType.OPERATIONAL, id);
assertCommit(writeTransaction2.commit());
}
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 testPutCreateParentsSuccess.
@Test
public void testPutCreateParentsSuccess() throws InterruptedException, ExecutionException {
final WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.mergeParentStructurePut(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());
}
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 QueryBuilderTest method bar.
@Test
public void bar() {
final Stopwatch sw = Stopwatch.createStarted();
final QueryExpression<TopLevelList> query = factory.querySubtree(InstanceIdentifier.create(Top.class)).extractChild(TopLevelList.class).matching().childObject(NestedList.class).leaf(NestedList::getName).contains("foo").and().leaf(TopLevelList::getName).valueEquals("bar").build();
LOG.info("Query built in {}", sw);
assertEquals(0, execute(query).getItems().size());
}
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 RetryingManagedNewTransactionRunnerTest method testCallWithNewTypedReadWriteTransactionReadFailedException.
@Test
public void testCallWithNewTypedReadWriteTransactionReadFailedException() throws Exception {
testableDataBroker.failReads(2, new ReadFailedException("bada boum bam!"));
TopLevelList data = newTestDataObject();
managedNewTransactionRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, tx -> {
tx.put(TEST_PATH, data);
assertEquals(data, tx.read(TEST_PATH).get().get());
}).get();
assertEquals(data, syncRead(LogicalDatastoreType.OPERATIONAL, TEST_PATH));
}
Aggregations