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());
}
}
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);
}
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);
}
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);
}
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;
}
Aggregations