Search in sources :

Example 1 with DefaultPromise

use of scala.concurrent.impl.Promise.DefaultPromise in project controller by opendaylight.

the class AbstractClientHistoryTest method createActorContextMock.

protected static ActorContext createActorContextMock(final ActorSystem system, final ActorRef actor) {
    final ActorContext mock = mock(ActorContext.class);
    final Promise<PrimaryShardInfo> promise = new DefaultPromise<>();
    final ActorSelection selection = system.actorSelection(actor.path());
    final PrimaryShardInfo shardInfo = new PrimaryShardInfo(selection, (short) 0);
    promise.success(shardInfo);
    when(mock.findPrimaryShardAsync(any())).thenReturn(promise.future());
    return mock;
}
Also used : ActorSelection(akka.actor.ActorSelection) DefaultPromise(scala.concurrent.impl.Promise.DefaultPromise) PrimaryShardInfo(org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo) ActorContext(org.opendaylight.controller.cluster.datastore.utils.ActorContext) ClientActorContext(org.opendaylight.controller.cluster.access.client.ClientActorContext)

Aggregations

ActorSelection (akka.actor.ActorSelection)1 ClientActorContext (org.opendaylight.controller.cluster.access.client.ClientActorContext)1 PrimaryShardInfo (org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo)1 ActorContext (org.opendaylight.controller.cluster.datastore.utils.ActorContext)1 DefaultPromise (scala.concurrent.impl.Promise.DefaultPromise)1