use of org.opendaylight.controller.md.sal.binding.api.DataTreeChangeService in project controller by opendaylight.
the class BindingDOMDataTreeChangeServiceAdapterTest method testRegisterDataTreeChangeListener.
@Test
public void testRegisterDataTreeChangeListener() {
final BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
final DataTreeChangeService service = BindingDOMDataTreeChangeServiceAdapter.create(codec, this.mockDOMService);
doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID), any(DOMDataTreeChangeListener.class));
final DataTreeIdentifier<Top> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, TOP_PATH);
final TestClusteredDataTreeChangeListener mockClusteredListener = new TestClusteredDataTreeChangeListener();
service.registerDataTreeChangeListener(treeId, mockClusteredListener);
verify(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID), isA(ClusteredDOMDataTreeChangeListener.class));
reset(this.mockDOMService);
doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID), any(DOMDataTreeChangeListener.class));
final TestDataTreeChangeListener mockNonClusteredListener = new TestDataTreeChangeListener();
service.registerDataTreeChangeListener(treeId, mockNonClusteredListener);
verify(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID), not(isA(ClusteredDOMDataTreeChangeListener.class)));
}
Aggregations