use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListBuilder in project controller by opendaylight.
the class DataTreeChangeListenerTest method testWildcardNotificationOfPreexistingData.
@SuppressWarnings("unchecked")
@Test
public void testWildcardNotificationOfPreexistingData() throws Exception {
InstanceIdentifier<Top> id = InstanceIdentifier.builder(Top.class).build();
ArrayList<TopLevelList> list = new ArrayList<>();
list.add(new TopLevelListBuilder().setName("name").build());
TopBuilder builder = new TopBuilder().setTopLevelList(list);
DataBroker dataBroker = getDataBroker();
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
writeTransaction.put(LogicalDatastoreType.OPERATIONAL, id, builder.build());
assertCommit(writeTransaction.submit());
DataTreeChangeListener<TopLevelList> listener = mock(DataTreeChangeListener.class);
InstanceIdentifier<TopLevelList> wildcard = InstanceIdentifier.builder(Top.class).child(TopLevelList.class).build();
dataBroker.registerDataTreeChangeListener(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, wildcard), listener);
verify(listener, timeout(1000)).onDataTreeChanged(Matchers.anyObject());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListBuilder in project controller by opendaylight.
the class ForwardedNotificationAdapterTest method createTestData.
private TwoLevelListChanged createTestData() {
final TwoLevelListChangedBuilder tb = new TwoLevelListChangedBuilder();
tb.setTopLevelList(ImmutableList.of(new TopLevelListBuilder().setKey(new TopLevelListKey("test")).build()));
return tb.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 CachingCodecTest method createList.
private static Map<TopLevelListKey, TopLevelList> createList(final int num) {
final ImmutableMap.Builder<TopLevelListKey, TopLevelList> builder = ImmutableMap.builder();
for (int i = 0; i < num; i++) {
final TopLevelListKey key = new TopLevelListKey("test-" + i);
builder.put(key, new TopLevelListBuilder().withKey(key).build());
}
return builder.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 ListInsertionDataChangeListenerTest method topSubtreeModified.
private static Function<DataTreeModification<Top>, Boolean> topSubtreeModified(final TopLevelList topFoo, final TopLevelList topBar) {
return match(ModificationType.SUBTREE_MODIFIED, TOP, (Function<Top, Boolean>) dataBefore -> Objects.equals(top(topFoo), dataBefore), dataAfter -> {
Set<TopLevelList> expList = new HashSet<>(top(topBar, topFoo).getTopLevelList().values());
Set<TopLevelList> actualList = dataAfter.getTopLevelList().values().stream().map(list -> new TopLevelListBuilder(list).build()).collect(Collectors.toSet());
return expList.equals(actualList);
});
}
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 Mdsal108Test method testDelete.
@Test
public void testDelete() {
DataBroker dataBroker = getDataBroker();
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
final TopLevelList item = new TopLevelListBuilder().setName("name").build();
TopBuilder builder = new TopBuilder().setTopLevelList(Collections.singletonMap(item.key(), item));
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