import akka.dispatch.ExecutionContexts;
import akka.dispatch.Futures;
import akka.util.Timeout;
+import com.google.common.base.Optional;
import com.google.common.util.concurrent.MoreExecutors;
import org.junit.After;
import org.junit.Before;
ListenerRegistration registration =
distributedDataStore.registerChangeListener(TestModel.TEST_PATH, new AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>() {
- @Override
- public void onDataChanged(AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
- throw new UnsupportedOperationException("onDataChanged");
- }
- }, AsyncDataBroker.DataChangeScope.BASE);
+ @Override
+ public void onDataChanged(AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
+ throw new UnsupportedOperationException("onDataChanged");
+ }
+ }, AsyncDataBroker.DataChangeScope.BASE);
// Since we do not expect the shard to be local registration will return a NoOpRegistration
assertTrue(registration instanceof NoOpDataChangeListenerRegistration);
Future future = mock(Future.class);
when(actorContext.getOperationDuration()).thenReturn(FiniteDuration.apply(5, TimeUnit.SECONDS));
when(actorContext.getActorSystem()).thenReturn(getSystem());
+ when(actorContext.findLocalShard(anyString())).thenReturn(Optional.of(doNothingActorRef));
when(actorContext
- .executeLocalShardOperationAsync(anyString(), anyObject(), any(Timeout.class))).thenReturn(future);
+ .executeOperationAsync(eq(doNothingActorRef), anyObject(), any(Timeout.class))).thenReturn(future);
ListenerRegistration registration =
distributedDataStore.registerChangeListener(TestModel.TEST_PATH,
when(actorSystem.dispatcher()).thenReturn(executor);
when(actorSystem.actorOf(any(Props.class))).thenReturn(doNothingActorRef);
when(actorContext.getActorSystem()).thenReturn(actorSystem);
+ when(actorContext.findLocalShard(anyString())).thenReturn(Optional.of(doNothingActorRef));
when(actorContext
- .executeLocalShardOperationAsync(anyString(), anyObject(), any(Timeout.class))).thenReturn(f);
+ .executeOperationAsync(eq(doNothingActorRef), anyObject(), any(Timeout.class))).thenReturn(f);
when(actorContext.actorSelection(any(ActorPath.class))).thenReturn(actorSelection);
ListenerRegistration registration =
when(actorSystem.dispatcher()).thenReturn(executor);
when(actorSystem.actorOf(any(Props.class))).thenReturn(doNothingActorRef);
when(actorContext.getActorSystem()).thenReturn(actorSystem);
+ when(actorContext.findLocalShard(anyString())).thenReturn(Optional.of(doNothingActorRef));
when(actorContext
- .executeLocalShardOperationAsync(anyString(), anyObject(), any(Timeout.class))).thenReturn(f);
+ .executeOperationAsync(eq(doNothingActorRef), anyObject(), any(Timeout.class))).thenReturn(f);
when(actorContext.actorSelection(any(ActorPath.class))).thenReturn(actorSelection);
ListenerRegistration registration =