X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=system%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcore%2FApplication.java;h=5e771b326464676d3729ffed4d2be370ea21f6f2;hb=436718e7b7ee0bb9f37db496dbde5c011d5f84e3;hp=07857aee2b7510fa05e87a056676b805b360ace8;hpb=dea786c9d49228a37cb5fd5b4113b86d9f6cddbf;p=utils diff --git a/system/general/src/test/java/org/wamblee/system/core/Application.java b/system/general/src/test/java/org/wamblee/system/core/Application.java index 07857aee..5e771b32 100644 --- a/system/general/src/test/java/org/wamblee/system/core/Application.java +++ b/system/general/src/test/java/org/wamblee/system/core/Application.java @@ -24,13 +24,18 @@ import org.wamblee.system.core.RequiredInterface; import org.wamblee.test.EventTracker; public class Application extends AbstractComponent { - public static RequiredInterface[] required(boolean aOptional) { + public static RequiredInterface[] required(boolean aOptional, String aPrefix) { return new RequiredInterface[] { - new DefaultRequiredInterface("string", String.class, aOptional), - new DefaultRequiredInterface("integer", Integer.class, aOptional) + new DefaultRequiredInterface(aPrefix + "string", String.class, aOptional), + new DefaultRequiredInterface(aPrefix + "integer", Integer.class, aOptional) }; } + + public static RequiredInterface[] required(boolean aOptional) { + return required(aOptional, ""); + } + private EventTracker _tracker; private String _string; @@ -38,12 +43,20 @@ public class Application extends AbstractComponent { private double _random; public Application() { - super("application", new ProvidedInterface[0], required(false)); - _random = Math.random(); + this("application"); } + public Application(String aName) { + this(aName, ""); + } + + public Application(String aName, String aPrefix) { + super(aName, new ProvidedInterface[0], required(false, aPrefix)); + _random = Math.random(); + } + public Application(boolean aIsOptinal) { - super("application", new ProvidedInterface[0], required(true)); + super("application", new ProvidedInterface[0], required(true, "")); } public Application(EventTracker aTracker) { @@ -54,8 +67,8 @@ public class Application extends AbstractComponent { @Override protected Object doStart(Scope aScope) { track("start." + getName()); - _string = aScope.retrieveInterfaceImplementation(getRequiredInterfaces()[0].getProvider(), String.class); - _integer = aScope.retrieveInterfaceImplementation(getRequiredInterfaces()[1].getProvider(), Integer.class); + _string = aScope.getInterfaceImplementation(getRequiredInterfaces()[0].getProvider(), String.class); + _integer = aScope.getInterfaceImplementation(getRequiredInterfaces()[1].getProvider(), Integer.class); return _random; }