git://wamblee.org
/
utils
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Moving around a lot of files to work towards production components.
[utils]
/
system
/
general
/
src
/
test
/
java
/
org
/
wamblee
/
system
/
core
/
Application.java
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 ca1467cc0fd4afde4ff9327bfcff49668b91035e..5e771b326464676d3729ffed4d2be370ea21f6f2 100644
(file)
--- 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,24
+24,39
@@
import org.wamblee.system.core.RequiredInterface;
import org.wamblee.test.EventTracker;
public class Application extends AbstractComponent {
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[] {
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<String> _tracker;
private String _string;
private EventTracker<String> _tracker;
private String _string;
- private Integer _integer;
+ private Integer _integer;
+ private double _random;
public Application() {
public Application() {
- super("application", new ProvidedInterface[0], required(false));
+ 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) {
public Application(boolean aIsOptinal) {
- super("application", new ProvidedInterface[0], required(true));
+ super("application", new ProvidedInterface[0], required(true
, ""
));
}
public Application(EventTracker<String> aTracker) {
}
public Application(EventTracker<String> aTracker) {
@@
-50,10
+65,11
@@
public class Application extends AbstractComponent {
}
@Override
}
@Override
- protected
void doStart(
) {
+ protected
Object doStart(Scope aScope
) {
track("start." + getName());
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() {
}
public String getString() {
@@
-65,8
+81,12
@@
public class Application extends AbstractComponent {
}
@Override
}
@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) {
}
private void track(String aString) {