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 ManagedNewTransactionRunnerImplTest method testApplyWithNewReadWriteTransactionAndSubmitPutSuccessfully.
@Test
public void testApplyWithNewReadWriteTransactionAndSubmitPutSuccessfully() throws Exception {
TopLevelList data = newTestDataObject();
assertEquals(1, (long) managedNewTransactionRunner.applyWithNewReadWriteTransactionAndSubmit(OPERATIONAL, tx -> {
tx.put(TEST_PATH, data);
return 1;
}).get());
assertEquals(data, singleTransactionDataBroker.syncRead(LogicalDatastoreType.OPERATIONAL, TEST_PATH));
}
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 ManagedNewTransactionRunnerImplTest method testCallWithNewReadTransactionAndCloseReadSuccessfully.
@Test
public void testCallWithNewReadTransactionAndCloseReadSuccessfully() throws Exception {
TopLevelList data = newTestDataObject();
managedNewTransactionRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx -> tx.put(TEST_PATH, data)).get();
assertEquals(data, managedNewTransactionRunner.applyWithNewReadOnlyTransactionAndClose(OPERATIONAL, tx -> tx.read(TEST_PATH)).get().get());
}
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 EmptyLeafTest method testCaseWithEmptyLeafType.
@Test
public void testCaseWithEmptyLeafType() {
final TopLevelList withEmptyCase = new TopLevelListBuilder().withKey(TOP_FOO_KEY).setChoiceInList(new EmptyLeafBuilder().setEmptyType(Empty.value()).build()).build();
final Entry<YangInstanceIdentifier, NormalizedNode> dom = codecContext.toNormalizedNode(BA_TOP_LEVEL_LIST, withEmptyCase);
final Entry<InstanceIdentifier<?>, DataObject> readed = codecContext.fromNormalizedNode(dom.getKey(), dom.getValue());
final ChoiceInList list = ((TopLevelList) readed.getValue()).getChoiceInList();
assertTrue(list instanceof EmptyLeaf);
assertNotNull(((EmptyLeaf) list).getEmptyType());
}
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 NormalizedNodeSerializeDeserializeTest method orderedLisFromNormalized.
@Test
public void orderedLisFromNormalized() {
final MapEntryNode foo = mapEntryBuilder().withNodeIdentifier(NodeIdentifierWithPredicates.of(TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE)).withChild(leafNode(TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE)).withChild(ImmutableUserMapNodeBuilder.create().withNodeIdentifier(new NodeIdentifier(NESTED_LIST_QNAME)).withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "foo")).withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "bar")).build()).build();
final Entry<InstanceIdentifier<?>, DataObject> entry = codecContext.fromNormalizedNode(BI_TOP_LEVEL_LIST_FOO_PATH, foo);
final TopLevelList topLevelList = new TopLevelListBuilder().withKey(TOP_LEVEL_LIST_FOO_KEY).setNestedList(List.of(new NestedListBuilder().withKey(new NestedListKey("foo")).build(), new NestedListBuilder().withKey(new NestedListKey("bar")).build())).build();
assertEquals(topLevelList, entry.getValue());
}
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 AugmentationSubstitutionTest method augmentationInGroupingSubstituted.
@Test
public void augmentationInGroupingSubstituted() {
final TopLevelList baRpc = new TopLevelListBuilder().withKey(TOP_FOO_KEY).addAugmentation(new RpcComplexUsesAugmentBuilder(createComplexData()).build()).build();
final TopLevelList baTree = new TopLevelListBuilder().withKey(TOP_FOO_KEY).addAugmentation(new TreeComplexUsesAugmentBuilder(createComplexData()).build()).build();
final NormalizedNode domTreeEntry = codecContext.toNormalizedNode(BA_TOP_LEVEL_LIST, baTree).getValue();
final NormalizedNode domRpcEntry = codecContext.toNormalizedNode(BA_TOP_LEVEL_LIST, baRpc).getValue();
assertEquals(domTreeEntry, domRpcEntry);
}
Aggregations