2012-02-27 22:38:26 +01:00
|
|
|
package akka.actor;
|
|
|
|
|
|
2013-05-02 17:12:36 +02:00
|
|
|
import akka.testkit.AkkaJUnitActorSystemResource;
|
2013-05-22 11:49:30 +02:00
|
|
|
import akka.testkit.TestProbe;
|
|
|
|
|
|
2013-05-02 17:12:36 +02:00
|
|
|
import org.junit.ClassRule;
|
2012-02-27 22:38:26 +01:00
|
|
|
import org.junit.Test;
|
2012-09-19 23:55:53 +02:00
|
|
|
|
2012-02-27 22:38:26 +01:00
|
|
|
public class StashJavaAPI {
|
|
|
|
|
|
2013-05-02 17:12:36 +02:00
|
|
|
@ClassRule
|
|
|
|
|
public static AkkaJUnitActorSystemResource actorSystemResource =
|
|
|
|
|
new AkkaJUnitActorSystemResource("StashJavaAPI", ActorWithBoundedStashSpec.testConf());
|
2012-09-19 23:55:53 +02:00
|
|
|
|
2013-05-02 17:12:36 +02:00
|
|
|
private final ActorSystem system = actorSystemResource.getSystem();
|
2012-09-19 23:55:53 +02:00
|
|
|
|
2013-07-01 15:55:59 +02:00
|
|
|
private void testAStashApi(Props props) {
|
|
|
|
|
ActorRef ref = system.actorOf(props);
|
|
|
|
|
final TestProbe probe = new TestProbe(system);
|
|
|
|
|
probe.send(ref, "Hello");
|
|
|
|
|
probe.send(ref, "Hello2");
|
|
|
|
|
probe.send(ref, "Hello12");
|
|
|
|
|
probe.expectMsg(5);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-19 23:55:53 +02:00
|
|
|
@Test
|
|
|
|
|
public void mustBeAbleToUseStash() {
|
2013-07-01 15:55:59 +02:00
|
|
|
testAStashApi(Props.create(StashJavaAPITestActors.WithStash.class));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void mustBeAbleToUseUnboundedStash() {
|
|
|
|
|
testAStashApi(Props.create(StashJavaAPITestActors.WithUnboundedStash.class));
|
2012-09-19 23:55:53 +02:00
|
|
|
}
|
2012-02-27 22:38:26 +01:00
|
|
|
|
2013-07-01 15:55:59 +02:00
|
|
|
@Test
|
|
|
|
|
public void mustBeAbleToUseUnrestrictedStash() {
|
|
|
|
|
testAStashApi(Props.create(StashJavaAPITestActors.WithUnrestrictedStash.class)
|
|
|
|
|
.withMailbox("akka.actor.mailbox.unbounded-deque-based"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-02-27 22:38:26 +01:00
|
|
|
}
|