2011-11-17 23:15:19 +01:00
|
|
|
/**
|
|
|
|
|
* 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;
|
|
|
|
|
|
2011-11-17 23:15:19 +01:00
|
|
|
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-17 23:15:19 +01:00
|
|
|
|
2011-11-21 15:58:01 +01:00
|
|
|
private ActorSystem system = ActorSystem.create("JavaExtension", c);
|
2011-11-17 23:15:19 +01:00
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void mustBeAccessible() {
|
|
|
|
|
final ActorSystemImpl s = system.extension(TestExtension.key).getSystem();
|
|
|
|
|
assertSame(s, system);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|