Merge branch 'master' into wip-ActorPath-rk
This commit is contained in:
commit
e38cd19af9
152 changed files with 3741 additions and 1749 deletions
|
|
@ -2,21 +2,36 @@ package akka.actor;
|
|||
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.japi.Creator;
|
||||
import akka.testkit.AkkaSpec;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class JavaAPI {
|
||||
|
||||
private ActorSystem system = ActorSystem.create();
|
||||
private static ActorSystem system;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeAll() {
|
||||
system = ActorSystem.create("JavaAPI", AkkaSpec.testConf());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterAll() {
|
||||
system.stop();
|
||||
system = null;
|
||||
}
|
||||
|
||||
@Test
|
||||
void mustBeAbleToCreateActorRefFromClass() {
|
||||
public void mustBeAbleToCreateActorRefFromClass() {
|
||||
ActorRef ref = system.actorOf(JavaAPITestActor.class);
|
||||
assertNotNull(ref);
|
||||
}
|
||||
|
||||
@Test
|
||||
void mustBeAbleToCreateActorRefFromFactory() {
|
||||
public void mustBeAbleToCreateActorRefFromFactory() {
|
||||
ActorRef ref = system.actorOf(new Props().withCreator(new Creator<Actor>() {
|
||||
public Actor create() {
|
||||
return new JavaAPITestActor();
|
||||
|
|
@ -26,7 +41,7 @@ public class JavaAPI {
|
|||
}
|
||||
|
||||
@Test
|
||||
void mustAcceptSingleArgTell() {
|
||||
public void mustAcceptSingleArgTell() {
|
||||
ActorRef ref = system.actorOf(JavaAPITestActor.class);
|
||||
ref.tell("hallo");
|
||||
ref.tell("hallo", ref);
|
||||
|
|
|
|||
|
|
@ -3,18 +3,23 @@
|
|||
*/
|
||||
package akka.actor;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import akka.testkit.AkkaSpec;
|
||||
|
||||
import com.typesafe.config.ConfigFactory;
|
||||
import com.typesafe.config.Config;
|
||||
import com.typesafe.config.ConfigParseOptions;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class JavaExtension {
|
||||
|
||||
static class Provider implements ExtensionIdProvider {
|
||||
public ExtensionId<TestExtension> lookup() { return defaultInstance; }
|
||||
public ExtensionId<TestExtension> lookup() {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
public final static TestExtensionId defaultInstance = new TestExtensionId();
|
||||
|
|
@ -26,10 +31,11 @@ public class JavaExtension {
|
|||
}
|
||||
|
||||
static class TestExtension implements Extension {
|
||||
public final ActorSystemImpl system;
|
||||
public TestExtension(ActorSystemImpl i) {
|
||||
system = i;
|
||||
}
|
||||
public final ActorSystemImpl system;
|
||||
|
||||
public TestExtension(ActorSystemImpl i) {
|
||||
system = i;
|
||||
}
|
||||
}
|
||||
|
||||
static class OtherExtension implements Extension {
|
||||
|
|
@ -41,10 +47,20 @@ public class JavaExtension {
|
|||
}
|
||||
}
|
||||
|
||||
private Config c = ConfigFactory.parseString("akka.extensions = [ \"akka.actor.JavaExtension$Provider\" ]",
|
||||
ConfigParseOptions.defaults());
|
||||
private static ActorSystem system;
|
||||
|
||||
private ActorSystem system = ActorSystem.create("JavaExtension", c);
|
||||
@BeforeClass
|
||||
public static void beforeAll() {
|
||||
Config c = ConfigFactory.parseString("akka.extensions = [ \"akka.actor.JavaExtension$Provider\" ]").withFallback(
|
||||
AkkaSpec.testConf());
|
||||
system = ActorSystem.create("JavaExtension", c);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterAll() {
|
||||
system.stop();
|
||||
system = null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mustBeAccessible() {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package akka.dispatch;
|
|||
|
||||
import akka.actor.Timeout;
|
||||
import akka.actor.ActorSystem;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import java.util.concurrent.Callable;
|
||||
|
|
@ -14,15 +17,30 @@ import akka.japi.Function;
|
|||
import akka.japi.Function2;
|
||||
import akka.japi.Procedure;
|
||||
import akka.japi.Option;
|
||||
import akka.testkit.AkkaSpec;
|
||||
|
||||
public class JavaFutureTests {
|
||||
|
||||
private final ActorSystem system = ActorSystem.create();
|
||||
private final Timeout t = system.settings().ActorTimeout();
|
||||
private final FutureFactory ff = new FutureFactory(system.dispatcher(), t);
|
||||
private static ActorSystem system;
|
||||
private static FutureFactory ff;
|
||||
private static Timeout t;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeAll() {
|
||||
system = ActorSystem.create("JavaFutureTests", AkkaSpec.testConf());
|
||||
t = system.settings().ActorTimeout();
|
||||
ff = new FutureFactory(system.dispatcher(), t);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterAll() {
|
||||
system.stop();
|
||||
system = null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mustBeAbleToMapAFuture() {
|
||||
|
||||
Future<String> f1 = ff.future(new Callable<String>() {
|
||||
public String call() {
|
||||
return "Hello";
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ import org.junit.Test;
|
|||
|
||||
public class JavaDuration {
|
||||
|
||||
@Test void testCreation() {
|
||||
@Test
|
||||
public void testCreation() {
|
||||
final Duration fivesec = Duration.create(5, "seconds");
|
||||
final Duration threemillis = Duration.parse("3 millis");
|
||||
final Duration diff = fivesec.minus(threemillis);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue