* Split config reference to one for each module/extension. * Adjusted signature of registerExtension to avoid race of extension init * Moved Duration.dilated to testkit * TestKitExtension * RemoteExtension * SerializationExtension * Durable mailboxes extensions * Fixed broken serialization bindings and added test * Updated configuration documentation * System properties akka.remote.hostname akka.remote.port replaced with akka.remote.server.hostname and akka.remote.server.port * Adjustments of ActorSystem initialization. Still don't like the two-phase constructor/init flow. Very fragile for changes. Review fixes. SerializationExtension
45 lines
1.1 KiB
Java
45 lines
1.1 KiB
Java
/**
|
|
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
|
|
*/
|
|
package akka.actor;
|
|
|
|
import org.junit.Test;
|
|
|
|
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 TestExtension implements Extension<TestExtension> {
|
|
private ActorSystemImpl system;
|
|
public static ExtensionKey<TestExtension> key = new ExtensionKey<TestExtension>() {
|
|
};
|
|
|
|
public ExtensionKey<TestExtension> key() {
|
|
return key;
|
|
}
|
|
|
|
public void init(ActorSystemImpl system) {
|
|
this.system = system;
|
|
}
|
|
|
|
public ActorSystemImpl getSystem() {
|
|
return system;
|
|
}
|
|
}
|
|
|
|
private Config c = ConfigFactory.parseString("akka.extensions = [ \"akka.actor.JavaExtension$TestExtension\" ]",
|
|
ConfigParseOptions.defaults());
|
|
|
|
private ActorSystem system = ActorSystem.create("JavaExtension", c);
|
|
|
|
@Test
|
|
public void mustBeAccessible() {
|
|
final ActorSystemImpl s = system.extension(TestExtension.key).getSystem();
|
|
assertSame(s, system);
|
|
}
|
|
|
|
}
|