From: Mathieu Baudier Date: Thu, 19 Mar 2009 17:17:30 +0000 (+0000) Subject: Path notification X-Git-Tag: argeo-slc-2.1.7~2021 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=236b49051dd15775eba14d444878814509be32b7;p=gpl%2Fargeo-slc.git Path notification git-svn-id: https://svn.argeo.org/slc/trunk@2290 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlow.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlow.java index 8c06dc579..83a9b344d 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlow.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlow.java @@ -22,7 +22,7 @@ import org.springframework.beans.factory.InitializingBean; import org.springframework.validation.MapBindingResult; public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean, - BeanNameAware { + BeanNameAware, StructureAware { private ExecutionSpec executionSpec = new DefaultExecutionSpec(); private String name = null; private Map parameters = new HashMap(); @@ -165,4 +165,19 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean, return path; } + public void setPath(String path) { + this.path = path; + } + + public void setRegistry(StructureRegistry registry) { + this.registry = registry; + } + + public void notifyCurrentPath(StructureRegistry registry, + TreeSPath path) { + if (this.path == null) { + this.path = path.toString(); + } + } + } diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultModulesManager.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultModulesManager.java index 50de8582c..05a0e8dae 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultModulesManager.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultModulesManager.java @@ -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(); } diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/test/SimpleTestRun.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/test/SimpleTestRun.java index bab085990..b01e103ea 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/test/SimpleTestRun.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/test/SimpleTestRun.java @@ -9,6 +9,7 @@ import org.argeo.slc.process.SlcExecution; import org.argeo.slc.process.SlcExecutionRelated; import org.argeo.slc.process.SlcExecutionStep; import org.argeo.slc.structure.StructureAware; +import org.argeo.slc.structure.StructureElement; import org.argeo.slc.structure.StructureRegistry; import org.argeo.slc.test.ExecutableTestRun; import org.argeo.slc.test.TestData; @@ -21,13 +22,14 @@ import org.argeo.slc.test.WritableTestRun; * references to the various parts of a test run. */ public class SimpleTestRun implements WritableTestRun, ExecutableTestRun, - SlcExecutionRelated { + SlcExecutionRelated, StructureAware { private String uuid; private String slcExecutionUuid; private String slcExecutionStepUuid; - private String path; + private TreeSPath path; + private StructureRegistry registry; private DeployedSystem deployedSystem; private TestData testData; @@ -36,27 +38,19 @@ public class SimpleTestRun implements WritableTestRun, ExecutableTestRun, /** Executes the underlying test definition. */ public void execute() { - TreeSPath basePath = null; - StructureRegistry registry = null; - if (path != null) { - // TODO: generalize - basePath = new TreeSPath(path); - registry = new TreeSRegistry(); - } - uuid = UUID.randomUUID().toString(); if (testResult != null) testResult.notifyTestRun(this); // Structure - if (testResult != null && basePath != null + if (testResult != null && path != null && testResult instanceof StructureAware) ((StructureAware) testResult).notifyCurrentPath( - registry, basePath); + registry, path); - if (basePath != null && testDefinition instanceof StructureAware) + if (path != null && testDefinition instanceof StructureAware) ((StructureAware) testDefinition).notifyCurrentPath( - registry, basePath); + registry, path); testDefinition.execute(this); } @@ -127,7 +121,9 @@ public class SimpleTestRun implements WritableTestRun, ExecutableTestRun, } } - public void setPath(String path) { + public void notifyCurrentPath(StructureRegistry registry, + TreeSPath path) { + this.registry = registry; this.path = path; }