X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=trunk%2Fsystem%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcore%2FApplication.java;h=d1302f5852177582763f1cf1e0f85bdc4eb3a684;hb=5b53fe5f0f9be61a2f71f5d441db0ba3ab299d90;hp=ca1467cc0fd4afde4ff9327bfcff49668b91035e;hpb=fcf46bf4ba1749730d584ce0be783c7787fee27c;p=utils diff --git a/trunk/system/general/src/test/java/org/wamblee/system/core/Application.java b/trunk/system/general/src/test/java/org/wamblee/system/core/Application.java index ca1467cc..d1302f58 100644 --- a/trunk/system/general/src/test/java/org/wamblee/system/core/Application.java +++ b/trunk/system/general/src/test/java/org/wamblee/system/core/Application.java @@ -34,10 +34,12 @@ public class Application extends AbstractComponent { private EventTracker _tracker; private String _string; - private Integer _integer; + private Integer _integer; + private double _random; public Application() { - super("application", new ProvidedInterface[0], required(false)); + super("application", new ProvidedInterface[0], required(false)); + _random = Math.random(); } public Application(boolean aIsOptinal) { @@ -50,10 +52,11 @@ public class Application extends AbstractComponent { } @Override - protected void doStart() { + protected Object doStart(Scope aScope) { track("start." + getName()); - _string = getRequiredInterfaces()[0].getImplementation(String.class); - _integer = getRequiredInterfaces()[1].getImplementation(Integer.class); + _string = aScope.getInterfaceImplementation(getRequiredInterfaces()[0].getProvider(), String.class); + _integer = aScope.getInterfaceImplementation(getRequiredInterfaces()[1].getProvider(), Integer.class); + return _random; } public String getString() { @@ -65,8 +68,12 @@ public class Application extends AbstractComponent { } @Override - protected void doStop() { - track("stop." + getName()); + protected void doStop(Object aRuntime) { + track("stop." + getName()); + if ( _random != (Double)aRuntime) { + throw new IllegalArgumentException("Wrong runtime: expected " + _random + " but got " + + aRuntime); + } } private void track(String aString) {