Search in sources :

Example 1 with BindingToNormalizedNodeCodec

use of org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec 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 BindingToNormalizedNodeCodec

use of org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec 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)

Example 3 with BindingToNormalizedNodeCodec

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

the class BindingNotificationAdapterModule method createInstance.

@Override
public java.lang.AutoCloseable createInstance() {
    final BindingToNormalizedNodeCodec codec = getBindingMappingServiceDependency();
    final Broker.ProviderSession session = getDomAsyncBrokerDependency().registerProvider(new DummyDOMProvider());
    final DOMNotificationService notifService = session.getService(DOMNotificationService.class);
    return new BindingDOMNotificationServiceAdapter(codec.getCodecRegistry(), notifService);
}
Also used : BindingDOMNotificationServiceAdapter(org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationServiceAdapter) Broker(org.opendaylight.controller.sal.core.api.Broker) BindingToNormalizedNodeCodec(org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec) DOMNotificationService(org.opendaylight.controller.md.sal.dom.api.DOMNotificationService)

Example 4 with BindingToNormalizedNodeCodec

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

the class BindingNotificationPublishAdapterModule method createInstance.

@Override
public AutoCloseable createInstance() {
    final BindingToNormalizedNodeCodec codec = getBindingMappingServiceDependency();
    final Broker.ProviderSession session = getDomAsyncBrokerDependency().registerProvider(new DummyDOMProvider());
    final DOMNotificationPublishService publishService = session.getService(DOMNotificationPublishService.class);
    return new BindingDOMNotificationPublishServiceAdapter(codec, publishService);
}
Also used : Broker(org.opendaylight.controller.sal.core.api.Broker) BindingDOMNotificationPublishServiceAdapter(org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationPublishServiceAdapter) BindingToNormalizedNodeCodec(org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec) DOMNotificationPublishService(org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService)

Example 5 with BindingToNormalizedNodeCodec

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

the class RuntimeMappingModule method createInstance.

@Override
public AutoCloseable createInstance() {
    // We need to return the concrete BindingToNormalizedNodeCodec instance for backwards compatibility
    // for CSS users that inject the binding-dom-mapping-service.
    final WaitingServiceTracker<BindingToNormalizedNodeCodec> tracker = WaitingServiceTracker.create(BindingToNormalizedNodeCodec.class, bundleContext);
    final BindingToNormalizedNodeCodec service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
    // Ideally we would close the ServiceTracker via the returned AutoCloseable but then we'd have to
    // proxy the BindingToNormalizedNodeCodec instance which is problematic. It's OK to close the
    // ServiceTracker here.
    tracker.close();
    return service;
}
Also used : BindingToNormalizedNodeCodec(org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec)

Aggregations

BindingToNormalizedNodeCodec (org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec)7 Broker (org.opendaylight.controller.sal.core.api.Broker)3 BindingDOMDataBrokerAdapter (org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter)2 Test (org.junit.Test)1 MountPointService (org.opendaylight.controller.md.sal.binding.api.MountPointService)1 HeliumRpcProviderRegistry (org.opendaylight.controller.md.sal.binding.compat.HeliumRpcProviderRegistry)1 BindingDOMNotificationPublishServiceAdapter (org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationPublishServiceAdapter)1 BindingDOMNotificationServiceAdapter (org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationServiceAdapter)1 BindingDOMRpcProviderServiceAdapter (org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcProviderServiceAdapter)1 BindingDOMRpcServiceAdapter (org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcServiceAdapter)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 DOMMountPointService (org.opendaylight.controller.md.sal.dom.api.DOMMountPointService)1 DOMNotificationPublishService (org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService)1 DOMNotificationService (org.opendaylight.controller.md.sal.dom.api.DOMNotificationService)1 RpcProviderRegistry (org.opendaylight.controller.sal.binding.api.RpcProviderRegistry)1 RootBindingAwareBroker (org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker)1 ProviderSession (org.opendaylight.controller.sal.core.api.Broker.ProviderSession)1