pekko/akka-actor-tests/src/test/java/akka/actor/JavaExtension.java

41 lines
1.1 KiB
Java
Raw Normal View History

/**
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.actor;
import org.junit.Test;
2011-11-21 15:58:01 +01:00
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> init(ActorSystemImpl system) {
this.system = system;
return key;
}
public ActorSystemImpl getSystem() {
return system;
}
}
2011-11-21 15:58:01 +01:00
private Config c = ConfigFactory.parseString("akka.extensions = [ \"akka.actor.JavaExtension$TestExtension\" ]", ConfigParseOptions.defaults());
2011-11-21 15:58:01 +01:00
private ActorSystem system = ActorSystem.create("JavaExtension", c);
@Test
public void mustBeAccessible() {
final ActorSystemImpl s = system.extension(TestExtension.key).getSystem();
assertSame(s, system);
}
}