import org.mockito.stubbing.Answer;
import org.opendaylight.controller.cluster.datastore.config.Configuration;
import org.opendaylight.controller.cluster.datastore.exceptions.NotInitializedException;
-import org.opendaylight.controller.cluster.datastore.messages.CloseDataTreeChangeListenerRegistration;
+import org.opendaylight.controller.cluster.datastore.messages.CloseDataTreeNotificationListenerRegistration;
import org.opendaylight.controller.cluster.datastore.messages.FindLocalShard;
import org.opendaylight.controller.cluster.datastore.messages.LocalShardFound;
import org.opendaylight.controller.cluster.datastore.messages.LocalShardNotFound;
import org.opendaylight.controller.cluster.datastore.messages.RegisterDataTreeChangeListener;
-import org.opendaylight.controller.cluster.datastore.messages.RegisterDataTreeChangeListenerReply;
+import org.opendaylight.controller.cluster.datastore.messages.RegisterDataTreeNotificationListenerReply;
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
import org.opendaylight.controller.cluster.datastore.utils.Dispatchers;
import org.opendaylight.controller.cluster.raft.utils.DoNothingActor;
ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
mock(Configuration.class));
+ final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> proxy = new DataTreeChangeListenerProxy<>(
- actorContext, mockListener);
+ actorContext, mockListener, path);
- final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
new Thread() {
@Override
public void run() {
- proxy.init("shard-1", path);
+ proxy.init("shard-1");
}
}.start();
Assert.assertEquals("getPath", path, registerMsg.getPath());
Assert.assertEquals("isRegisterOnAllInstances", false, registerMsg.isRegisterOnAllInstances());
- reply(new RegisterDataTreeChangeListenerReply(getRef()));
+ reply(new RegisterDataTreeNotificationListenerReply(getRef()));
for (int i = 0; i < 20 * 5 && proxy.getListenerRegistrationActor() == null; i++) {
Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
proxy.close();
// The listener registration actor should get a Close message
- expectMsgClass(timeout, CloseDataTreeChangeListenerRegistration.class);
+ expectMsgClass(timeout, CloseDataTreeNotificationListenerRegistration.class);
// The DataChangeListener actor should be terminated
expectMsgClass(timeout, Terminated.class);
ClusteredDOMDataTreeChangeListener mockClusteredListener = mock(
ClusteredDOMDataTreeChangeListener.class);
+ final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
final DataTreeChangeListenerProxy<ClusteredDOMDataTreeChangeListener> proxy =
- new DataTreeChangeListenerProxy<>(actorContext, mockClusteredListener);
+ new DataTreeChangeListenerProxy<>(actorContext, mockClusteredListener, path);
- final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
new Thread() {
@Override
public void run() {
- proxy.init("shard-1", path);
+ proxy.init("shard-1");
}
}.start();
ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
mock(Configuration.class));
+ final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> proxy = new DataTreeChangeListenerProxy<>(
- actorContext, mockListener);
+ actorContext, mockListener, path);
- final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
new Thread() {
@Override
public void run() {
- proxy.init("shard-1", path);
+ proxy.init("shard-1");
}
}.start();
ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
mock(Configuration.class));
+ final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> proxy = new DataTreeChangeListenerProxy<>(
- actorContext, mockListener);
+ actorContext, mockListener, path);
- final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
new Thread() {
@Override
public void run() {
- proxy.init("shard-1", path);
+ proxy.init("shard-1");
}
}.start();
final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
doReturn(executor).when(actorContext).getClientDispatcher();
+ doReturn(DatastoreContext.newBuilder().build()).when(actorContext).getDatastoreContext();
doReturn(mockActorSystem).when(actorContext).getActorSystem();
String shardName = "shard-1";
final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> proxy = new DataTreeChangeListenerProxy<>(
- actorContext, mockListener);
+ actorContext, mockListener, path);
doReturn(duration("5 seconds")).when(actorContext).getOperationDuration();
doReturn(Futures.successful(getRef())).when(actorContext).findLocalShardAsync(eq(shardName));
.executeOperationAsync(any(ActorRef.class), any(Object.class), any(Timeout.class));
doReturn(mock(DatastoreContext.class)).when(actorContext).getDatastoreContext();
- proxy.init("shard-1", path);
+ proxy.init("shard-1");
Assert.assertEquals("getListenerRegistrationActor", null, proxy.getListenerRegistrationActor());
doReturn(Futures.successful(getRef())).when(actorContext).findLocalShardAsync(eq(shardName));
final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> proxy = new DataTreeChangeListenerProxy<>(
- actorContext, mockListener);
+ actorContext, mockListener, YangInstanceIdentifier.of(TestModel.TEST_QNAME));
Answer<Future<Object>> answer = invocation -> {
proxy.close();
- return Futures.successful((Object) new RegisterDataTreeChangeListenerReply(getRef()));
+ return Futures.successful((Object) new RegisterDataTreeNotificationListenerReply(getRef()));
};
doAnswer(answer).when(actorContext).executeOperationAsync(any(ActorRef.class), any(Object.class),
any(Timeout.class));
- proxy.init(shardName, YangInstanceIdentifier.of(TestModel.TEST_QNAME));
+ proxy.init(shardName);
- expectMsgClass(duration("5 seconds"), CloseDataTreeChangeListenerRegistration.class);
+ expectMsgClass(duration("5 seconds"), CloseDataTreeNotificationListenerRegistration.class);
Assert.assertEquals("getListenerRegistrationActor", null, proxy.getListenerRegistrationActor());
}