- @Test
- public void testExecuteLocalShardOperationWithShardFound(){
- new JavaTestKit(getSystem()) {{
-
- new Within(duration("1 seconds")) {
- @Override
- protected void run() {
-
- ActorRef shardActorRef = getSystem().actorOf(Props.create(EchoActor.class));
-
- ActorRef shardManagerActorRef = getSystem()
- .actorOf(MockShardManager.props(true, shardActorRef));
-
- ActorContext actorContext =
- new ActorContext(getSystem(), shardManagerActorRef , mock(ClusterWrapper.class),
- mock(Configuration.class));
-
- Object out = actorContext.executeLocalShardOperation("default", "hello");
-
- assertEquals("hello", out);
-
-
- expectNoMsg();
- }
- };
- }};
-
- }
-
- @Test
- public void testExecuteLocalShardOperationWithShardNotFound(){
- new JavaTestKit(getSystem()) {{
-
- new Within(duration("1 seconds")) {
- @Override
- protected void run() {
-
- ActorRef shardManagerActorRef = getSystem()
- .actorOf(MockShardManager.props(false, null));
-
- ActorContext actorContext =
- new ActorContext(getSystem(), shardManagerActorRef , mock(ClusterWrapper.class),
- mock(Configuration.class));
-
- Object out = actorContext.executeLocalShardOperation("default", "hello");
-
- assertNull(out);
-
-
- expectNoMsg();
- }
- };
- }};
-
- }
-
-