use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TopChoiceAugment2Builder in project mdsal by opendaylight.
the class NormalizedNodeSerializeDeserializeTest method augmentMultipleChoices.
@Test
public void augmentMultipleChoices() {
final QName augmentChoice1QName = AugmentChoice1.QNAME;
final QName augmentChoice2QName = QName.create(augmentChoice1QName, "augment-choice2");
final QName containerQName = QName.create(augmentChoice1QName, "case11-choice-case-container");
final QName leafQName = QName.create(augmentChoice1QName, "case11-choice-case-leaf");
final AugmentationIdentifier aug1Id = new AugmentationIdentifier(Set.of(augmentChoice1QName));
final AugmentationIdentifier aug2Id = new AugmentationIdentifier(Set.of(augmentChoice2QName));
final NodeIdentifier augmentChoice1Id = new NodeIdentifier(augmentChoice1QName);
final NodeIdentifier augmentChoice2Id = new NodeIdentifier(augmentChoice2QName);
final NodeIdentifier containerId = new NodeIdentifier(containerQName);
final TopBuilder tBuilder = new TopBuilder();
final TopChoiceAugment1Builder tca1Builder = new TopChoiceAugment1Builder();
final Case1Builder c1Builder = new Case1Builder();
final TopChoiceAugment2Builder tca2Builder = new TopChoiceAugment2Builder();
final Case11Builder c11Builder = new Case11Builder();
final Case11ChoiceCaseContainerBuilder cccc1Builder = new Case11ChoiceCaseContainerBuilder();
cccc1Builder.setCase11ChoiceCaseLeaf("leaf-value");
c11Builder.setCase11ChoiceCaseContainer(cccc1Builder.build());
tca2Builder.setAugmentChoice2(c11Builder.build());
c1Builder.addAugmentation(tca2Builder.build());
tca1Builder.setAugmentChoice1(c1Builder.build());
tBuilder.addAugmentation(tca1Builder.build());
final Top top = tBuilder.build();
final Entry<YangInstanceIdentifier, NormalizedNode> biResult = codecContext.toNormalizedNode(InstanceIdentifier.create(Top.class), top);
final NormalizedNode topNormalized = containerBuilder().withNodeIdentifier(new NodeIdentifier(TOP_QNAME)).withChild(augmentationBuilder().withNodeIdentifier(aug1Id).withChild(choiceBuilder().withNodeIdentifier(augmentChoice1Id).withChild(augmentationBuilder().withNodeIdentifier(aug2Id).withChild(choiceBuilder().withNodeIdentifier(augmentChoice2Id).withChild(containerBuilder().withNodeIdentifier(containerId).withChild(leafNode(leafQName, "leaf-value")).build()).build()).build()).build()).build()).build();
assertEquals(BI_TOP_PATH, biResult.getKey());
assertEquals(topNormalized, biResult.getValue());
final Entry<InstanceIdentifier<?>, DataObject> baResult = codecContext.fromNormalizedNode(BI_TOP_PATH, topNormalized);
assertEquals(InstanceIdentifier.create(Top.class), baResult.getKey());
assertEquals(top, baResult.getValue());
}
Aggregations