use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListBuilder 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);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListBuilder in project mdsal by opendaylight.
the class AugmentationSubstitutionTest method copyBuilderWithAugmenationsTest.
@Test
public void copyBuilderWithAugmenationsTest() {
final TopLevelList manuallyConstructed = new TopLevelListBuilder().withKey(TOP_FOO_KEY).addAugmentation(new TreeComplexUsesAugmentBuilder(createComplexData()).build()).build();
final Entry<YangInstanceIdentifier, NormalizedNode> entry = codecContext.toNormalizedNode(BA_TOP_LEVEL_LIST, manuallyConstructed);
final TopLevelList deserialized = (TopLevelList) codecContext.fromNormalizedNode(entry.getKey(), entry.getValue()).getValue();
assertEquals(manuallyConstructed, deserialized);
final TopLevelList copiedFromDeserialized = new TopLevelListBuilder(deserialized).build();
assertEquals(manuallyConstructed, copiedFromDeserialized);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListBuilder in project mdsal by opendaylight.
the class LazyBindingListTest method testSingletonList.
@Test
public void testSingletonList() {
final TopLevelList expected = new TopLevelListBuilder().setName("test").setNestedList(List.of(new NestedListBuilder().setName(String.valueOf("one")).build())).build();
final TopLevelList actual = thereAndBackAgain(InstanceIdentifier.create(Top.class).child(TopLevelList.class, expected.key()), expected);
final List<NestedList> list = actual.getNestedList();
assertThat(list, not(instanceOf(LazyBindingList.class)));
assertEquals(expected.getNestedList(), list);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListBuilder in project mdsal by opendaylight.
the class LazyBindingMapTest method testLookupValue.
@Test
public void testLookupValue() {
final Map<TopLevelListKey, TopLevelList> list = prepareData().getTopLevelList();
for (TopLevelList val : TOP.getTopLevelList().values()) {
assertTrue(list.containsValue(val));
}
assertFalse(list.containsValue(new TopLevelListBuilder().setName("blah").build()));
// We checked this key, but this is a different object
assertFalse(list.containsValue(new TopLevelListBuilder(TOP.getTopLevelList().values().iterator().next()).setNestedList(List.of(new NestedListBuilder().setName("foo").build())).build()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListBuilder in project mdsal by opendaylight.
the class LazyBindingMapTest method prepareTop.
@BeforeClass
public static void prepareTop() {
final Map<TopLevelListKey, TopLevelList> map = new HashMap<>();
for (int i = 0; i < 2 * LazyBindingMap.LAZY_CUTOFF; i++) {
final TopLevelList item = new TopLevelListBuilder().setName(String.valueOf(i)).build();
map.put(item.key(), item);
}
TOP = new TopBuilder().setTopLevelList(map).build();
}
Aggregations