]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Path notification
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 19 Mar 2009 17:17:30 +0000 (17:17 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 19 Mar 2009 17:17:30 +0000 (17:17 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2290 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlow.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultModulesManager.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/test/SimpleTestRun.java

index 8c06dc579f62db2d01f4c1f70e335cc64ee7e3a6..83a9b344dbc8b6ce228d3ae471da9bbd06593ab0 100644 (file)
@@ -22,7 +22,7 @@ import org.springframework.beans.factory.InitializingBean;
 import org.springframework.validation.MapBindingResult;
 
 public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
-               BeanNameAware {
+               BeanNameAware, StructureAware<TreeSPath> {
        private ExecutionSpec executionSpec = new DefaultExecutionSpec();
        private String name = null;
        private Map<String, Object> parameters = new HashMap<String, Object>();
@@ -165,4 +165,19 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
                return path;
        }
 
+       public void setPath(String path) {
+               this.path = path;
+       }
+
+       public void setRegistry(StructureRegistry<TreeSPath> registry) {
+               this.registry = registry;
+       }
+
+       public void notifyCurrentPath(StructureRegistry<TreeSPath> registry,
+                       TreeSPath path) {
+               if (this.path == null) {
+                       this.path = path.toString();
+               }
+       }
+
 }
index 50de8582cb5ad437b15dfd7d63368f3b093fdcc1..05a0e8daef263a5936a22b2d2ad43da7bfac2699 100644 (file)
@@ -39,7 +39,8 @@ public class DefaultModulesManager implements ExecutionModulesManager {
                        String moduleName, String version) {
                ExecutionModule module = getExecutionModule(moduleName, version);
 
-               Assert.notNull(module);
+               if(module==null)
+                       throw new SlcException("Module "+moduleName+" ("+version+") not found");
 
                return module.getDescriptor();
        }
index bab085990ba9a22560a1f70c417cbc67e2436203..b01e103ead65f5a3fc7086ebb7a986aa64ccdf93 100644 (file)
@@ -9,6 +9,7 @@ import org.argeo.slc.process.SlcExecution;
 import org.argeo.slc.process.SlcExecutionRelated;\r
 import org.argeo.slc.process.SlcExecutionStep;\r
 import org.argeo.slc.structure.StructureAware;\r
+import org.argeo.slc.structure.StructureElement;\r
 import org.argeo.slc.structure.StructureRegistry;\r
 import org.argeo.slc.test.ExecutableTestRun;\r
 import org.argeo.slc.test.TestData;\r
@@ -21,13 +22,14 @@ import org.argeo.slc.test.WritableTestRun;
  * references to the various parts of a test run.\r
  */\r
 public class SimpleTestRun implements WritableTestRun, ExecutableTestRun,\r
-               SlcExecutionRelated {\r
+               SlcExecutionRelated, StructureAware<TreeSPath> {\r
        private String uuid;\r
 \r
        private String slcExecutionUuid;\r
        private String slcExecutionStepUuid;\r
 \r
-       private String path;\r
+       private TreeSPath path;\r
+       private StructureRegistry<TreeSPath> registry;\r
 \r
        private DeployedSystem deployedSystem;\r
        private TestData testData;\r
@@ -36,27 +38,19 @@ public class SimpleTestRun implements WritableTestRun, ExecutableTestRun,
 \r
        /** Executes the underlying test definition. */\r
        public void execute() {\r
-               TreeSPath basePath = null;\r
-               StructureRegistry<TreeSPath> registry = null;\r
-               if (path != null) {\r
-                       // TODO: generalize\r
-                       basePath = new TreeSPath(path);\r
-                       registry = new TreeSRegistry();\r
-               }\r
-\r
                uuid = UUID.randomUUID().toString();\r
                if (testResult != null)\r
                        testResult.notifyTestRun(this);\r
 \r
                // Structure\r
-               if (testResult != null && basePath != null\r
+               if (testResult != null && path != null\r
                                && testResult instanceof StructureAware)\r
                        ((StructureAware<TreeSPath>) testResult).notifyCurrentPath(\r
-                                       registry, basePath);\r
+                                       registry, path);\r
 \r
-               if (basePath != null && testDefinition instanceof StructureAware)\r
+               if (path != null && testDefinition instanceof StructureAware)\r
                        ((StructureAware<TreeSPath>) testDefinition).notifyCurrentPath(\r
-                                       registry, basePath);\r
+                                       registry, path);\r
 \r
                testDefinition.execute(this);\r
        }\r
@@ -127,7 +121,9 @@ public class SimpleTestRun implements WritableTestRun, ExecutableTestRun,
                }\r
        }\r
 \r
-       public void setPath(String path) {\r
+       public void notifyCurrentPath(StructureRegistry<TreeSPath> registry,\r
+                       TreeSPath path) {\r
+               this.registry = registry;\r
                this.path = path;\r
        }\r
 \r