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 {
|
2011-11-22 13:04:10 +01:00
|
|
|
|
2011-11-24 18:53:18 +01:00
|
|
|
static class Provider implements ExtensionProvider {
|
|
|
|
|
public Extension lookup() { return defaultInstance; }
|
|
|
|
|
}
|
2011-11-22 13:04:10 +01:00
|
|
|
|
2011-11-24 18:53:18 +01:00
|
|
|
public final static TestExtension defaultInstance = new TestExtension();
|
2011-11-22 13:04:10 +01:00
|
|
|
|
2011-11-24 18:53:18 +01:00
|
|
|
static class TestExtension extends AbstractExtension<ActorSystemImpl> {
|
|
|
|
|
public ActorSystemImpl createExtension(ActorSystemImpl i) {
|
|
|
|
|
return i;
|
2011-11-17 23:15:19 +01:00
|
|
|
}
|
|
|
|
|
}
|
2011-11-22 13:04:10 +01:00
|
|
|
|
2011-11-24 18:53:18 +01:00
|
|
|
private Config c = ConfigFactory.parseString("akka.extensions = [ \"akka.actor.JavaExtension$Provider\" ]",
|
2011-11-22 13:04:10 +01:00
|
|
|
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-22 13:04:10 +01:00
|
|
|
|
2011-11-17 23:15:19 +01:00
|
|
|
@Test
|
|
|
|
|
public void mustBeAccessible() {
|
2011-11-24 18:53:18 +01:00
|
|
|
assertSame(system.extension(defaultInstance), system);
|
|
|
|
|
assertSame(defaultInstance.apply(system), system);
|
2011-11-17 23:15:19 +01:00
|
|
|
}
|
2011-11-22 13:04:10 +01:00
|
|
|
|
2011-11-17 23:15:19 +01:00
|
|
|
}
|