Merge branch 'extensions' into master
This commit is contained in:
commit
263e2d495d
8 changed files with 280 additions and 9 deletions
40
akka-actor-tests/src/test/java/akka/actor/JavaExtension.java
Normal file
40
akka-actor-tests/src/test/java/akka/actor/JavaExtension.java
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* 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> init(ActorSystemImpl system) {
|
||||
this.system = system;
|
||||
return key;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue