use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListKey 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.TopLevelListKey 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListKey in project mdsal by opendaylight.
the class LazyBindingMapTest method testLookupKey.
@Test
public void testLookupKey() {
final Map<TopLevelListKey, TopLevelList> list = prepareData().getTopLevelList();
for (TopLevelListKey key : TOP.getTopLevelList().keySet()) {
assertTrue(list.containsKey(key));
}
assertFalse(list.containsKey(new TopLevelListKey("blah")));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListKey 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.TopLevelListKey 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());
}
Aggregations