diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c8d0a31..eab59ae 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,17 +5,10 @@
-
-
-
-
-
-
-
-
+
-
+
@@ -80,51 +73,51 @@
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -133,19 +126,27 @@
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
@@ -168,7 +169,6 @@
@@ -663,14 +665,14 @@
-
+
-
-
+
+
-
+
@@ -681,24 +683,18 @@
-
-
-
-
-
-
-
+
-
-
+
+
@@ -709,17 +705,23 @@
+
+
+
+
+
+
-
+
-
+
@@ -731,27 +733,21 @@
-
-
-
-
-
-
-
+
-
+
-
-
-
+
+
+
-
-
+
+
@@ -759,23 +755,17 @@
-
-
-
-
-
-
-
+
-
+
@@ -787,7 +777,13 @@
+
+
+
+
+
+
@@ -921,19 +917,19 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
@@ -1139,12 +1135,16 @@
1403633508812
1403633508812
-
+
+ 1403644471034
+ 1403644471034
+
+
-
+
@@ -1163,7 +1163,7 @@
-
+
@@ -1213,7 +1213,6 @@
-
@@ -1238,7 +1237,8 @@
-
+
+
@@ -1257,7 +1257,7 @@
file://$PROJECT_DIR$/centipede/src/main/java/com/ontology2/centipede/shell/CentipedeShell.java
- 71
+ 70
@@ -1273,13 +1273,6 @@
-
-
-
-
-
-
-
@@ -1459,6 +1452,9 @@
+
+
+
@@ -1517,14 +1513,6 @@
-
-
-
-
-
-
-
-
@@ -1595,77 +1583,98 @@
-
+
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
diff --git a/centipede/src/main/java/com/ontology2/centipede/shell/CentipedeShell.java b/centipede/src/main/java/com/ontology2/centipede/shell/CentipedeShell.java
index e8977b7..1219824 100755
--- a/centipede/src/main/java/com/ontology2/centipede/shell/CentipedeShell.java
+++ b/centipede/src/main/java/com/ontology2/centipede/shell/CentipedeShell.java
@@ -68,12 +68,9 @@ ApplicationContext createApplicationContext(CentipedeShellOptions centipedeOptio
if(centipedeOptions.eager && centipedeOptions.lazy)
throw new MisconfigurationException("Cannot force eager and lazy load at same time");
- Boolean forcedMode=false;
-// Boolean forcedMode =
-// centipedeOptions.lazy ? true :
-// (centipedeOptions.eager ? false : null);
-
- forcedMode = (forcedMode==null) ? isLazyByDefault() : forcedMode;
+ Boolean forcedMode =
+ centipedeOptions.lazy ? Boolean.TRUE :
+ (centipedeOptions.eager ? Boolean.FALSE : isLazyByDefault());
return (forcedMode==null) ? newContext(contextPath) :
newContext(contextPath,forcedMode);
diff --git a/centipede/src/test/java/com/ontology2/centipede/shell/InfovoreShell.java b/centipede/src/test/java/com/ontology2/centipede/shell/InfovoreShell.java
index 0786d2e..179e37a 100755
--- a/centipede/src/test/java/com/ontology2/centipede/shell/InfovoreShell.java
+++ b/centipede/src/test/java/com/ontology2/centipede/shell/InfovoreShell.java
@@ -35,11 +35,7 @@ public List getApplicationContextPath() {
return that;
}
- public static void main(String[] args) {
+ static void main(String[] args) {
new InfovoreShell().run(args);
-
-
}
-
-
}
diff --git a/centipede/src/test/java/com/ontology2/centipede/shell/NeitherLazyNorEagerShell.java b/centipede/src/test/java/com/ontology2/centipede/shell/NeitherLazyNorEagerShell.java
new file mode 100644
index 0000000..84411d8
--- /dev/null
+++ b/centipede/src/test/java/com/ontology2/centipede/shell/NeitherLazyNorEagerShell.java
@@ -0,0 +1,12 @@
+package com.ontology2.centipede.shell;
+
+public class NeitherLazyNorEagerShell extends InfovoreShell {
+ @Override
+ protected Boolean isLazyByDefault() {
+ return null;
+ }
+
+ static void main(String[] arguments) {
+ new NeitherLazyNorEagerShell().run(arguments);
+ }
+}
diff --git a/centipede/src/test/java/com/ontology2/centipede/shell/ObjectThatCountsClassInstances.java b/centipede/src/test/java/com/ontology2/centipede/shell/ObjectThatCountsClassInstances.java
index f49dacc..4e59e8e 100644
--- a/centipede/src/test/java/com/ontology2/centipede/shell/ObjectThatCountsClassInstances.java
+++ b/centipede/src/test/java/com/ontology2/centipede/shell/ObjectThatCountsClassInstances.java
@@ -25,5 +25,6 @@ public static int getCreated() {
public static void reset() {
instanceCount.set(0);
+ totalCreated.set(0);
}
}
diff --git a/centipede/src/test/java/com/ontology2/centipede/shell/TestInfovoreShell.java b/centipede/src/test/java/com/ontology2/centipede/shell/TestInfovoreShell.java
index 2dfd73f..fb16e22 100755
--- a/centipede/src/test/java/com/ontology2/centipede/shell/TestInfovoreShell.java
+++ b/centipede/src/test/java/com/ontology2/centipede/shell/TestInfovoreShell.java
@@ -6,6 +6,7 @@
import org.junit.Before;
import org.junit.Test;
+import org.junit.experimental.theories.suppliers.TestedOn;
public class TestInfovoreShell {
@@ -62,4 +63,38 @@ public void alternateLaunchCode() throws IOException {
assertEquals("777-656-005",ShellTestApp.getLaunchCode());
}
+ @Test
+ public void evaluationIsLazyByDefault() {
+ String[] arguments = {"-applicationContext","classpath:com/ontology2/centipede/shell/objectCountingContext.xml","run","shellTest"};
+ InfovoreShell.main(arguments);
+ assertEquals(0,ObjectThatCountsClassInstances.getCreated());
+ }
+
+ @Test
+ public void evaluationCanBeForcedEager() {
+ String[] arguments = {"-applicationContext","classpath:com/ontology2/centipede/shell/objectCountingContext.xml","-eager","run","shellTest"};
+ InfovoreShell.main(arguments);
+ assertEquals(2,ObjectThatCountsClassInstances.getCreated());
+ }
+
+ @Test
+ public void defaultEvaluationBehaviorCanBeExposed() {
+ String[] arguments = {"-applicationContext","classpath:com/ontology2/centipede/shell/objectCountingContext.xml","run","shellTest"};
+ NeitherLazyNorEagerShell.main(arguments);
+ assertEquals(1,ObjectThatCountsClassInstances.getCreated());
+ }
+
+ @Test
+ public void defaultEvaluationBehaviorCanBeForcedLazy() {
+ String[] arguments = {"-applicationContext","classpath:com/ontology2/centipede/shell/objectCountingContext.xml","-lazy","run","shellTest"};
+ NeitherLazyNorEagerShell.main(arguments);
+ assertEquals(0,ObjectThatCountsClassInstances.getCreated());
+ }
+
+ @Test
+ public void defaultEvaluationBehaviorCanBeForcedEager() {
+ String[] arguments = {"-applicationContext","classpath:com/ontology2/centipede/shell/objectCountingContext.xml","-eager","run","shellTest"};
+ NeitherLazyNorEagerShell.main(arguments);
+ assertEquals(2,ObjectThatCountsClassInstances.getCreated());
+ }
}