Search in sources :

Example 1 with BindingDOMDataBrokerAdapter

use of org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter in project controller by opendaylight.

the class BindingDOMDataBrokerAdapterTest method testClusteredDataChangeListernerRegisteration.

@Test
public void testClusteredDataChangeListernerRegisteration() {
    final BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
    try (BindingDOMDataBrokerAdapter bindingDOMDataBrokerAdapter = new BindingDOMDataBrokerAdapter(this.dataBroker, codec)) {
        Mockito.when(this.codecRegistry.toYangInstanceIdentifier(TOP_PATH)).thenReturn(this.yangInstanceIdentifier);
        final ArgumentCaptor<ClusteredDOMDataChangeListener> clusteredDOMListener = ArgumentCaptor.forClass(ClusteredDOMDataChangeListener.class);
        final ArgumentCaptor<LogicalDatastoreType> logicalDatastoreType = ArgumentCaptor.forClass(LogicalDatastoreType.class);
        final ArgumentCaptor<AsyncDataBroker.DataChangeScope> dataChangeScope = ArgumentCaptor.forClass(AsyncDataBroker.DataChangeScope.class);
        final ArgumentCaptor<YangInstanceIdentifier> yangIidCapture = ArgumentCaptor.forClass(YangInstanceIdentifier.class);
        final TestListener listener = new TestListener();
        bindingDOMDataBrokerAdapter.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, TOP_PATH, listener, AsyncDataBroker.DataChangeScope.BASE);
        Mockito.verify(this.dataBroker).registerDataChangeListener(logicalDatastoreType.capture(), yangIidCapture.capture(), clusteredDOMListener.capture(), dataChangeScope.capture());
    }
}
Also used : AsyncDataBroker(org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker) BindingToNormalizedNodeCodec(org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec) BindingDOMDataBrokerAdapter(org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) ClusteredDOMDataChangeListener(org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataChangeListener) Test(org.junit.Test)

Example 2 with BindingDOMDataBrokerAdapter

use of org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter in project controller by opendaylight.

the class BindingTestContext method startNewDataBroker.

public void startNewDataBroker() {
    checkState(this.executor != null, "Executor needs to be set");
    checkState(this.newDOMDataBroker != null, "DOM Data Broker must be set");
    this.dataBroker = new BindingDOMDataBrokerAdapter(this.newDOMDataBroker, this.codec);
}
Also used : BindingDOMDataBrokerAdapter(org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter)

Example 3 with BindingDOMDataBrokerAdapter

use of org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter in project controller by opendaylight.

the class BindingAsyncDataBrokerImplModule method createInstance.

@Override
public java.lang.AutoCloseable createInstance() {
    final BindingToNormalizedNodeCodec mappingService = getBindingMappingServiceDependency();
    final DOMDataBroker domDataBroker = getDomAsyncBrokerDependency();
    return new BindingDOMDataBrokerAdapter(domDataBroker, mappingService);
}
Also used : BindingToNormalizedNodeCodec(org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec) BindingDOMDataBrokerAdapter(org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter) DOMDataBroker(org.opendaylight.controller.md.sal.dom.api.DOMDataBroker)

Aggregations

BindingDOMDataBrokerAdapter (org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter)3 BindingToNormalizedNodeCodec (org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec)2 Test (org.junit.Test)1 AsyncDataBroker (org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker)1 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)1 ClusteredDOMDataChangeListener (org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataChangeListener)1 DOMDataBroker (org.opendaylight.controller.md.sal.dom.api.DOMDataBroker)1 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)1