use of org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataChangeListener 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.dom.api.ClusteredDOMDataChangeListener in project controller by opendaylight.
the class DataChangeListenerRegistrationProxy method doRegistration.
private void doRegistration(final ActorRef shard, final YangInstanceIdentifier path, final DataChangeScope scope) {
Future<Object> future = actorContext.executeOperationAsync(shard, new RegisterChangeListener(path, dataChangeListenerActor, scope, listener instanceof ClusteredDOMDataChangeListener), actorContext.getDatastoreContext().getShardInitializationTimeout());
future.onComplete(new OnComplete<Object>() {
@Override
public void onComplete(final Throwable failure, final Object result) {
if (failure != null) {
LOG.error("Failed to register DataChangeListener {} at path {}", listener, path.toString(), failure);
} else {
RegisterDataTreeNotificationListenerReply reply = (RegisterDataTreeNotificationListenerReply) result;
setListenerRegistrationActor(actorContext.actorSelection(reply.getListenerRegistrationPath()));
}
}
}, actorContext.getClientDispatcher());
}
Aggregations