Search in sources :

Example 1 with DataTreeChangeService

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)));
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) DOMDataTreeIdentifier(org.opendaylight.controller.md.sal.dom.api.DOMDataTreeIdentifier) DataTreeChangeService(org.opendaylight.controller.md.sal.binding.api.DataTreeChangeService) DOMDataTreeChangeService(org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService) Top(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top) ClusteredDOMDataTreeChangeListener(org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeListener) DOMDataTreeChangeListener(org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener) ClusteredDOMDataTreeChangeListener(org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeListener) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 DataTreeChangeService (org.opendaylight.controller.md.sal.binding.api.DataTreeChangeService)1 DataTreeIdentifier (org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier)1 ClusteredDOMDataTreeChangeListener (org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeListener)1 DOMDataTreeChangeListener (org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener)1 DOMDataTreeChangeService (org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService)1 DOMDataTreeIdentifier (org.opendaylight.controller.md.sal.dom.api.DOMDataTreeIdentifier)1 Top (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top)1