Search in sources :

Example 11 with PrimaryShardInfo

use of org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo 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)

Example 12 with PrimaryShardInfo

use of org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo in project controller by opendaylight.

the class AbstractDataStoreClientBehaviorTest method createActorContextMock.

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

Example 13 with PrimaryShardInfo

use of org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo in project controller by opendaylight.

the class ActorContext method onPrimaryShardFound.

private PrimaryShardInfo onPrimaryShardFound(String shardName, String primaryActorPath, short primaryVersion, DataTree localShardDataTree) {
    ActorSelection actorSelection = actorSystem.actorSelection(primaryActorPath);
    PrimaryShardInfo info = localShardDataTree == null ? new PrimaryShardInfo(actorSelection, primaryVersion) : new PrimaryShardInfo(actorSelection, primaryVersion, localShardDataTree);
    primaryShardInfoCache.putSuccessful(shardName, info);
    return info;
}
Also used : ActorSelection(akka.actor.ActorSelection) PrimaryShardInfo(org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo)

Aggregations

PrimaryShardInfo (org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo)13 ActorSelection (akka.actor.ActorSelection)6 ActorRef (akka.actor.ActorRef)5 TestActorRef (akka.testkit.TestActorRef)5 Test (org.junit.Test)5 LocalPrimaryShardFound (org.opendaylight.controller.cluster.datastore.messages.LocalPrimaryShardFound)4 ActorContext (org.opendaylight.controller.cluster.datastore.utils.ActorContext)4 Timeout (akka.util.Timeout)3 ClientActorContext (org.opendaylight.controller.cluster.access.client.ClientActorContext)3 ClusterWrapper (org.opendaylight.controller.cluster.datastore.ClusterWrapper)3 DatastoreContext (org.opendaylight.controller.cluster.datastore.DatastoreContext)3 Configuration (org.opendaylight.controller.cluster.datastore.config.Configuration)3 FindPrimary (org.opendaylight.controller.cluster.datastore.messages.FindPrimary)3 RemotePrimaryShardFound (org.opendaylight.controller.cluster.datastore.messages.RemotePrimaryShardFound)3 ActorSystem (akka.actor.ActorSystem)2 AddressFromURIString (akka.actor.AddressFromURIString)2 TestKit (akka.testkit.javadsl.TestKit)2 AbstractActorTest (org.opendaylight.controller.cluster.datastore.AbstractActorTest)2 AbstractShardManagerTest (org.opendaylight.controller.cluster.datastore.AbstractShardManagerTest)2 ClusterWrapperImpl (org.opendaylight.controller.cluster.datastore.ClusterWrapperImpl)2