use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibraryUpdate in project netconf by opendaylight.
the class YangLibraryNotificationProducerRFC8525 method onDataTreeChanged.
@Override
public void onDataTreeChanged(@NonNull Collection<DataTreeModification<YangLibrary>> changes) {
for (DataTreeModification<YangLibrary> change : changes) {
final DataObjectModification<YangLibrary> rootNode = change.getRootNode();
final YangLibrary dataAfter = rootNode.getDataAfter();
if (dataAfter != null) {
final YangLibraryUpdate yangLibraryUpdate = new YangLibraryUpdateBuilder().setContentId(dataAfter.getContentId()).build();
yangLibraryPublisherRegistration.onYangLibraryUpdate(yangLibraryUpdate);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibraryUpdate in project netconf by opendaylight.
the class YangLibraryNotificationProducerTestRFC8525 method testOnDataTreeChanged.
@Test
public void testOnDataTreeChanged() {
final String contentId = "1";
YangLibrary yangLibraryAfter = new YangLibraryBuilder().setContentId(contentId).build();
final DataTreeModification<YangLibrary> treeChange = mock(DataTreeModification.class);
final DataObjectModification<Capabilities> objectChange = mock(DataObjectModification.class);
doReturn(objectChange).when(treeChange).getRootNode();
doReturn(yangLibraryAfter).when(objectChange).getDataAfter();
YangLibraryUpdate yangLibraryUpdate = new YangLibraryUpdateBuilder().setContentId(contentId).build();
yangLibraryNotificationProducer.onDataTreeChanged(Collections.singleton(treeChange));
verify(yangLibraryPublisherRegistration).onYangLibraryUpdate(yangLibraryUpdate);
}
Aggregations