]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
XML format for executions
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 11 Mar 2009 13:13:21 +0000 (13:13 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 11 Mar 2009 13:13:21 +0000 (13:13 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2246 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

35 files changed:
org.argeo.slc/pom.xml
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/Deployment.java
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/Executable.java [new file with mode: 0644]
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/Executable.java [deleted file]
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/RealizedFlow.java [new file with mode: 0644]
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecution.java
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionSpec.java [deleted file]
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionSpecField.java [deleted file]
runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/ExecutableTestRun.java
runtime/org.argeo.slc.support.castor/pom.xml
runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java
runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml
runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml
runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java [new file with mode: 0644]
runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java
runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionSpecCastorTest.java [deleted file]
runtime/org.argeo.slc.support.equinox/src/main/java/org/argeo/slc/execution/old/ExecutionFlowFactory.java
runtime/org.argeo.slc.support.hibernate/pom.xml
runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecutionSpec.hbm.xml [deleted file]
runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/spring/applicationContext.xml
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/AbstractExecutionValue.java [new file with mode: 0644]
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/PrimitiveAccessor.java [new file with mode: 0644]
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveSpecAttribute.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveValue.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/RefValue.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/Echo.java
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java [deleted file]
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/unit/test/tree/TreeTestResultTestUtils.java [deleted file]
runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/unit/test/tree/UnitTestTreeUtil.java [deleted file]
runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/execution/ExecutionFlowDescriptorTestUtils.java [new file with mode: 0644]
runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java [new file with mode: 0644]
runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/test/tree/TreeTestResultTestUtils.java [new file with mode: 0644]
runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/test/tree/UnitTestTreeUtil.java [new file with mode: 0644]

index 203eb669fe89c2ce319b16b5e3ac0fa2e9041cbd..ef96635698fdd371b20860a478d3d3774a2ea133 100644 (file)
@@ -89,6 +89,13 @@ limitations under the License.
                                                        <manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile>
                                                </archive>
                                        </configuration>
+                                       <executions>
+                                               <execution>
+                                                       <goals>
+                                                               <goal>test-jar</goal>
+                                                       </goals>
+                                               </execution>
+                                       </executions>
                                </plugin>
                                <plugin>
                                        <groupId>org.apache.maven.plugins</groupId>
@@ -268,6 +275,12 @@ limitations under the License.
                                <artifactId>org.argeo.slc.support.simple</artifactId>
                                <version>${project.version}</version>
                        </dependency>
+                       <dependency>
+                               <groupId>org.argeo.slc.runtime</groupId>
+                               <artifactId>org.argeo.slc.support.simple</artifactId>
+                               <version>${project.version}</version>
+                               <classifier>tests</classifier>
+                       </dependency>
                        <dependency>
                                <groupId>org.argeo.slc.runtime</groupId>
                                <artifactId>org.argeo.slc.support.ant</artifactId>
index 7e471f5901e56d25d2740d5eb6117ea7480328ce..13d39313666f6fd3df052c6d2552637233efae39 100644 (file)
@@ -1,7 +1,7 @@
 package org.argeo.slc.deploy;\r
 \r
 import org.argeo.slc.build.Distribution;\r
-import org.argeo.slc.process.Executable;\r
+import org.argeo.slc.execution.Executable;\r
 \r
 public interface Deployment extends Executable{\r
        public DeployedSystem getDeployedSystem();\r
diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/Executable.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/Executable.java
new file mode 100644 (file)
index 0000000..bc804bd
--- /dev/null
@@ -0,0 +1,7 @@
+package org.argeo.slc.execution;
+
+/** Any object which can perform processing */
+public interface Executable {
+       /** Executes the actions specified by the object */
+       public void execute();
+}
index ce6a805831352f316d6b8cb8aaaa52a684241412..ed9272e01c21c7bbe56e7f517115192051fcb7ba 100644 (file)
@@ -1,6 +1,5 @@
 package org.argeo.slc.execution;
 
-import org.argeo.slc.process.Executable;
 
 public interface ExecutionFlow extends Executable {
        public Object getParameter(String key);
diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/Executable.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/Executable.java
deleted file mode 100644 (file)
index 129b1c6..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.argeo.slc.process;
-
-/** Any object which can perform processing */
-public interface Executable {
-       /** Executes the actions specified by the object */
-       public void execute();
-}
diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/RealizedFlow.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/RealizedFlow.java
new file mode 100644 (file)
index 0000000..c47308e
--- /dev/null
@@ -0,0 +1,44 @@
+package org.argeo.slc.process;
+
+import org.argeo.slc.execution.ExecutionFlowDescriptor;
+import org.argeo.slc.execution.ExecutionSpec;
+
+public class RealizedFlow {
+       private String moduleName;
+       private String moduleVersion;
+       private ExecutionFlowDescriptor flowDescriptor;
+       private ExecutionSpec executionSpec;
+
+       public String getModuleName() {
+               return moduleName;
+       }
+
+       public void setModuleName(String moduleName) {
+               this.moduleName = moduleName;
+       }
+
+       public String getModuleVersion() {
+               return moduleVersion;
+       }
+
+       public void setModuleVersion(String moduleVersion) {
+               this.moduleVersion = moduleVersion;
+       }
+
+       public ExecutionFlowDescriptor getFlowDescriptor() {
+               return flowDescriptor;
+       }
+
+       public void setFlowDescriptor(ExecutionFlowDescriptor flowDescriptor) {
+               this.flowDescriptor = flowDescriptor;
+       }
+
+       public ExecutionSpec getExecutionSpec() {
+               return executionSpec;
+       }
+
+       public void setExecutionSpec(ExecutionSpec executionSpec) {
+               this.executionSpec = executionSpec;
+       }
+
+}
index a52fea533f2c33cb37aac045443ec8e3dd884bae..cfef480336f4975ea2c8c82741f75cb6c64a0e5e 100644 (file)
@@ -22,6 +22,15 @@ public class SlcExecution {
        private Map<String, String> attributes = new TreeMap<String, String>();\r
 \r
        private List<SlcExecutionStep> steps = new ArrayList<SlcExecutionStep>();\r
+       private List<RealizedFlow> realizedFlows = new ArrayList<RealizedFlow>();\r
+\r
+       public List<RealizedFlow> getRealizedFlows() {\r
+               return realizedFlows;\r
+       }\r
+\r
+       public void setRealizedFlows(List<RealizedFlow> realizedFlows) {\r
+               this.realizedFlows = realizedFlows;\r
+       }\r
 \r
        public List<SlcExecutionStep> getSteps() {\r
                return steps;\r
diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionSpec.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionSpec.java
deleted file mode 100644 (file)
index 72ab0e4..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.argeo.slc.process;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class SlcExecutionSpec {
-       private Long tid;
-       private Map<String, SlcExecutionSpecField> executionSpecFields = new HashMap<String, SlcExecutionSpecField>();
-
-       public Long getTid() {
-               return tid;
-       }
-
-       public void setTid(Long tid) {
-               this.tid = tid;
-       }
-
-       public Map<String, SlcExecutionSpecField> getExecutionSpecFields() {
-               return executionSpecFields;
-       }
-
-       public void setExecutionSpecFields(
-                       Map<String, SlcExecutionSpecField> executionSpecFields) {
-               this.executionSpecFields = executionSpecFields;
-       }
-
-}
diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionSpecField.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionSpecField.java
deleted file mode 100644 (file)
index 88bd650..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.argeo.slc.process;
-
-public class SlcExecutionSpecField {
-       private String label;
-       private String type;
-       private String defaultValue;
-       private String listValues;
-
-       public String getLabel() {
-               return label;
-       }
-
-       public void setLabel(String label) {
-               this.label = label;
-       }
-
-       public String getType() {
-               return type;
-       }
-
-       public void setType(String type) {
-               this.type = type;
-       }
-
-       public String getDefaultValue() {
-               return defaultValue;
-       }
-
-       public void setDefaultValue(String defaultValue) {
-               this.defaultValue = defaultValue;
-       }
-
-       public String getListValues() {
-               return listValues;
-       }
-
-       public void setListValues(String listValues) {
-               this.listValues = listValues;
-       }
-
-}
index 5b88113775bbd2cf7a21f60393be7465cc1b06bc..37843d1838f6bb0c0e0f866176271d73580f8b1b 100644 (file)
@@ -1,6 +1,6 @@
 package org.argeo.slc.test;\r
 \r
-import org.argeo.slc.process.Executable;\r
+import org.argeo.slc.execution.Executable;\r
 \r
 /** A test run that can be executed */\r
 public interface ExecutableTestRun extends TestRun, Executable {\r
index 263bf7d7005506673b0b008ea75e5ff68349a94f..a1c8fb791416f0dae233609b1397d7e332dab7a3 100644 (file)
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
                <groupId>org.argeo.slc</groupId>
                                                        org.argeo.slc.*
                                                </Export-Package>
                                                <Import-Package>org.argeo.slc.*;resolution:=optional,
-                                               org.argeo.slc.execution;resolution:=optional,
-                                               org.argeo.slc.core.structure;resolution:=optional,
-                                               org.argeo.slc.core.structure.tree;resolution:=optional,
-                                               org.argeo.slc.core.test;resolution:=optional,
-                                               org.argeo.slc.core.test.tree;resolution:=optional,
-                                               org.argeo.slc.runtime;resolution:=optional,
-                                               org.argeo.slc.core.execution;resolution:=optional,
-                                               org.argeo.slc.msg;resolution:=optional,
-                                               org.argeo.slc.msg.process;resolution:=optional,
-                                               org.argeo.slc.msg.test.tree;resolution:=optional
+                                                       org.argeo.slc.execution;resolution:=optional,
+                                                       org.argeo.slc.core.structure;resolution:=optional,
+                                                       org.argeo.slc.core.structure.tree;resolution:=optional,
+                                                       org.argeo.slc.core.test;resolution:=optional,
+                                                       org.argeo.slc.core.test.tree;resolution:=optional,
+                                                       org.argeo.slc.runtime;resolution:=optional,
+                                                       org.argeo.slc.core.execution;resolution:=optional,
+                                                       org.argeo.slc.msg;resolution:=optional,
+                                                       org.argeo.slc.msg.process;resolution:=optional,
+                                                       org.argeo.slc.msg.test.tree;resolution:=optional
                                                </Import-Package>
                                                <Fragment-Host>com.springsource.org.castor</Fragment-Host>
-                                               <!-- 
-                                               <Import-Package>*,org.argeo.slc.msg,
-                                               org.argeo.slc.msg.process,
-                                               org.argeo.slc.msg.test.tree,
-                                               javax.xml.parsers;resolution:=optional,
-                                               javax.xml.transform;resolution:=optional,
-                                               javax.xml.transform.dom;resolution:=optional,
-                                               javax.xml.transform.stream;resolution:=optional,
-                                               org.w3c.dom;resolution:=optional,
-                                               org.xml.sax;resolution:=optional
-                                               </Import-Package>
-                                                -->
+                                               <!--
+                                                       <Import-Package>*,org.argeo.slc.msg, org.argeo.slc.msg.process,
+                                                       org.argeo.slc.msg.test.tree,
+                                                       javax.xml.parsers;resolution:=optional,
+                                                       javax.xml.transform;resolution:=optional,
+                                                       javax.xml.transform.dom;resolution:=optional,
+                                                       javax.xml.transform.stream;resolution:=optional,
+                                                       org.w3c.dom;resolution:=optional,
+                                                       org.xml.sax;resolution:=optional </Import-Package>
+                                               -->
                                        </instructions>
                                </configuration>
                        </plugin>
                        <groupId>org.argeo.slc.runtime</groupId>
                        <artifactId>org.argeo.slc.support.simple</artifactId>
                </dependency>
+               <dependency>
+                       <groupId>org.argeo.slc.runtime</groupId>
+                       <artifactId>org.argeo.slc.support.simple</artifactId>
+                       <classifier>tests</classifier>
+                       <scope>test</scope>
+               </dependency>
 
                <dependency>
                        <groupId>org.springframework.ws</groupId>
index e27a3af79cb6f8502d8dfba0314434b9d79dce57..bee2acb66ca2c7f762660f6bbd8fcf2bfeb28afa 100644 (file)
@@ -1,7 +1,7 @@
 package org.argeo.slc.castor.execution;
 
+import org.argeo.slc.core.execution.PrimitiveAccessor;
 import org.argeo.slc.core.execution.PrimitiveSpecAttribute;
-import org.argeo.slc.core.execution.PrimitiveValue;
 import org.exolab.castor.mapping.AbstractFieldHandler;
 
 public class PrimitiveFieldHandler extends AbstractFieldHandler {
@@ -11,53 +11,32 @@ public class PrimitiveFieldHandler extends AbstractFieldHandler {
                if (object == null)
                        return null;
 
-               Object value = null;
-               if (object instanceof PrimitiveSpecAttribute)
-                       value = ((PrimitiveSpecAttribute) object).getValue();
-               else if (object instanceof PrimitiveValue)
-                       value = ((PrimitiveValue) object).getValue();
-               else
-                       throw new IllegalStateException("Unkown type " + object.getClass());
-
-               return value != null ? value.toString() : null;
+               return ((PrimitiveAccessor) object).getValue().toString();
        }
 
        @Override
        public Object newInstance(Object parent, Object[] args)
                        throws IllegalStateException {
-               // TODO Auto-generated method stub
                return null;
        }
 
        @Override
        public Object newInstance(Object parent) throws IllegalStateException {
-               // TODO Auto-generated method stub
                return null;
        }
 
        @Override
        public void resetValue(Object object) throws IllegalStateException,
                        IllegalArgumentException {
-               // TODO Auto-generated method stub
-
        }
 
        @Override
        public void setValue(Object object, Object value)
                        throws IllegalStateException, IllegalArgumentException {
-               // TODO: could probably be more generic
-
-               PrimitiveSpecAttribute attr = (PrimitiveSpecAttribute) object;
-               String type = attr.getType();
+               PrimitiveAccessor primitiveAccessor = (PrimitiveAccessor) object;
+               String type = primitiveAccessor.getType();
                String str = value.toString();
-
-               // FIXME: generalize
-               if (object instanceof PrimitiveSpecAttribute)
-                       ((PrimitiveSpecAttribute) object).setValue(convert(type, str));
-               else if (object instanceof PrimitiveValue)
-                       ((PrimitiveValue) object).setValue(convert(type, str));
-               else
-                       throw new IllegalStateException("Unkown type " + object.getClass());
+               primitiveAccessor.setValue(convert(type, str));
        }
 
        protected Object convert(String type, String str) {
index 4c9a256cc7d2151a081590c0a9df30cc9c106aa5..a0489e810c61b81e67fad50f3d02a0f5afe25b88 100644 (file)
@@ -37,7 +37,8 @@
                                        <field name="key" type="string">\r
                                                <bind-xml name="key" node="attribute" />\r
                                        </field>\r
-                                       <field name="value">\r
+                                       <field name="value"\r
+                                               type="org.argeo.slc.core.execution.AbstractExecutionValue">\r
                                                <bind-xml auto-naming="deriveByClass" />\r
                                        </field>\r
                                </class>\r
@@ -60,7 +61,8 @@
                                        <field name="key" type="string">\r
                                                <bind-xml name="key" node="attribute" />\r
                                        </field>\r
-                                       <field name="value">\r
+                                       <field name="value"\r
+                                               type="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
                                                <bind-xml auto-naming="deriveByClass" />\r
                                        </field>\r
                                </class>\r
@@ -90,7 +92,9 @@
                        <bind-xml name="type" node="attribute" />\r
                </field>\r
                <field name="value" type="string"\r
-                       handler="org.argeo.slc.castor.execution.PrimitiveFieldHandler" />\r
+                       handler="org.argeo.slc.castor.execution.PrimitiveFieldHandler">\r
+                       <bind-xml node="element" />\r
+               </field>\r
        </class>\r
 \r
        <class name="org.argeo.slc.core.execution.RefSpecAttribute"\r
        </class>\r
 \r
        <!-- Values -->\r
-       <class name="org.argeo.slc.core.execution.PrimitiveValue">\r
+       <class name="org.argeo.slc.core.execution.AbstractExecutionValue">\r
+               <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+                       ns-prefix="slc" />\r
+       </class>\r
+\r
+       <class name="org.argeo.slc.core.execution.PrimitiveValue"\r
+               extends="org.argeo.slc.core.execution.AbstractExecutionValue">\r
                <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
                        ns-prefix="slc" />\r
                <field name="type">\r
                        <bind-xml name="type" node="attribute" />\r
                </field>\r
                <field name="value" type="string"\r
-                       handler="org.argeo.slc.castor.execution.PrimitiveFieldHandler" />\r
+                       handler="org.argeo.slc.castor.execution.PrimitiveFieldHandler">\r
+                       <bind-xml node="element" />\r
+               </field>\r
        </class>\r
 \r
-       <class name="org.argeo.slc.core.execution.RefValue">\r
+       <class name="org.argeo.slc.core.execution.RefValue" extends="org.argeo.slc.core.execution.AbstractExecutionValue">\r
                <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
                        ns-prefix="slc" />\r
                <field name="label" />\r
index be807ff0f2302987d03513af18c59a122320aab8..401e7a663ed9162f141c32aed4297667d882ab60 100644 (file)
                <field name="type" />\r
                <field name="host" />\r
                <field name="user" />\r
+               <field name="realizedFlows" collection="arraylist"\r
+                       type="org.argeo.slc.process.RealizedFlow">\r
+                       <bind-xml auto-naming="deriveByClass" location="steps" />\r
+               </field>\r
                <field name="steps" collection="arraylist"\r
                        type="org.argeo.slc.process.SlcExecutionStep">\r
                        <bind-xml auto-naming="deriveByClass" location="steps" />\r
                </field>\r
        </class>\r
 \r
+       <class name="org.argeo.slc.process.RealizedFlow">\r
+               <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+                       ns-prefix="slc" />\r
+               <field name="moduleName"/>\r
+               <field name="moduleVersion" />\r
+               <field name="flowDescriptor">\r
+                       <bind-xml auto-naming="deriveByClass" />\r
+               </field>\r
+               <field name="executionSpec">\r
+                       <bind-xml auto-naming="deriveByClass" />\r
+               </field>\r
+       </class>\r
+\r
        <class name="org.argeo.slc.process.SlcExecutionStep">\r
                <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
                        ns-prefix="slc" />\r
                </field>\r
        </class>\r
 \r
-       <class name="org.argeo.slc.process.SlcExecutionSpec">\r
-               <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
-                       ns-prefix="slc" />\r
-               <field name="executionSpecFields" collection="map">\r
-                       <bind-xml name="execution-spec-field" location="execution-spec-fields">\r
-                               <class name="org.exolab.castor.mapping.MapItem">\r
-                                       <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
-                                               ns-prefix="slc" />\r
-                                       <field name="key" type="string">\r
-                                               <bind-xml name="name" node="attribute" />\r
-                                       </field>\r
-                                       <field name="value" type="org.argeo.slc.process.SlcExecutionSpecField">\r
-                                               <bind-xml auto-naming="deriveByClass" />\r
-                                       </field>\r
-                               </class>\r
-                       </bind-xml>\r
-               </field>\r
-       </class>\r
-\r
-       <class name="org.argeo.slc.process.SlcExecutionSpecField">\r
-               <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
-                       ns-prefix="slc" />\r
-               <field name="label" />\r
-               <field name="type" />\r
-               <field name="defaultValue" />\r
-               <field name="listValues" />\r
-       </class>\r
-\r
 </mapping>
\ No newline at end of file
diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java
new file mode 100644 (file)
index 0000000..5adbd62
--- /dev/null
@@ -0,0 +1,30 @@
+package org.argeo.slc.castor;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.argeo.slc.execution.ExecutionFlowDescriptor;\r
+import org.argeo.slc.execution.ExecutionModuleDescriptor;\r
+import org.argeo.slc.execution.ExecutionSpec;\r
+import org.argeo.slc.unit.execution.ExecutionFlowDescriptorTestUtils;\r
+\r
+public class ExecutionModuleDescriptorCastorTest extends AbstractCastorTestCase {\r
+       public void testMarshUnmarsh() throws Exception {\r
+               ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor();\r
+               moduleDescriptor.setName("test.moodule");\r
+               moduleDescriptor.setVersion("1.0.0");\r
+\r
+               ExecutionFlowDescriptor flowDescriptor = ExecutionFlowDescriptorTestUtils\r
+                               .createSimpleExecutionFlowDescriptor();\r
+\r
+               List<ExecutionFlowDescriptor> flows = new ArrayList<ExecutionFlowDescriptor>();\r
+               flows.add(flowDescriptor);\r
+               moduleDescriptor.setExecutionFlows(flows);\r
+\r
+               List<ExecutionSpec> specs = new ArrayList<ExecutionSpec>();\r
+               specs.add(flowDescriptor.getExecutionSpec());\r
+               moduleDescriptor.setExecutionSpecs(specs);\r
+\r
+               marshUnmarsh(moduleDescriptor, false);\r
+       }\r
+}\r
index a8f724f25432a6f0d274a21c1c8fe1610166e78b..bfd6a7e11da56b2fe9ecf549c20903ecdc1c3943 100644 (file)
@@ -1,12 +1,17 @@
 package org.argeo.slc.castor;\r
 \r
 import java.text.SimpleDateFormat;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
 import java.util.UUID;\r
 \r
+import org.argeo.slc.execution.ExecutionFlowDescriptor;\r
 import org.argeo.slc.msg.process.SlcExecutionRequest;\r
 import org.argeo.slc.msg.process.SlcExecutionStepsRequest;\r
+import org.argeo.slc.process.RealizedFlow;\r
 import org.argeo.slc.process.SlcExecution;\r
 import org.argeo.slc.process.SlcExecutionStep;\r
+import org.argeo.slc.unit.execution.ExecutionFlowDescriptorTestUtils;\r
 import org.argeo.slc.unit.process.SlcExecutionTestUtils;\r
 import org.springframework.xml.transform.StringResult;\r
 \r
@@ -63,4 +68,20 @@ public class SlcExecutionCastorTest extends AbstractCastorTestCase {
                SlcExecutionRequest msgUpdateUnm = unmarshal(msgUpdateXml);\r
                assertNotNull(msgUpdateUnm);\r
        }\r
+\r
+       public void testMarshUnmarsh() throws Exception {\r
+               SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution();\r
+               List<RealizedFlow> realizedFlows = new ArrayList<RealizedFlow>();\r
+               RealizedFlow realizedFlow = new RealizedFlow();\r
+               ExecutionFlowDescriptor flowDescriptor = ExecutionFlowDescriptorTestUtils\r
+                               .createSimpleExecutionFlowDescriptor();\r
+               realizedFlow.setModuleName("test.module");\r
+               realizedFlow.setModuleVersion("1.0.0");\r
+               realizedFlow.setFlowDescriptor(flowDescriptor);\r
+               realizedFlow.setExecutionSpec(flowDescriptor.getExecutionSpec());\r
+               realizedFlows.add(realizedFlow);\r
+               slcExec.setRealizedFlows(realizedFlows);\r
+\r
+               marshUnmarsh(slcExec, false);\r
+       }\r
 }\r
diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionSpecCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionSpecCastorTest.java
deleted file mode 100644 (file)
index 51d4c47..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.argeo.slc.castor;\r
-\r
-import org.argeo.slc.process.SlcExecutionSpec;\r
-import org.argeo.slc.process.SlcExecutionSpecField;\r
-\r
-public class SlcExecutionSpecCastorTest extends AbstractCastorTestCase {\r
-       public void testMarshalling() throws Exception {\r
-               SlcExecutionSpec spec = new SlcExecutionSpec();\r
-               \r
-               SlcExecutionSpecField field1 = new SlcExecutionSpecField();\r
-               field1.setLabel("Field1");\r
-               field1.setType("text");\r
-               field1.setDefaultValue("def");\r
-               spec.getExecutionSpecFields().put("field1", field1);\r
-               \r
-               SlcExecutionSpecField field2 = new SlcExecutionSpecField();\r
-               field2.setLabel("Field2");\r
-               field2.setType("list");\r
-               field2.setListValues("def,nodef");\r
-               field2.setDefaultValue("def");\r
-               spec.getExecutionSpecFields().put("field2", field2);\r
-               \r
-               SlcExecutionSpec specUnm = marshUnmarsh(spec,false);            \r
-               \r
-               \r
-       }\r
-}\r
index c38d866d7f09fc2d58a40b4ea176aaa2afaa3469..8b35dda7109f0c07ccafea5508c02a23a89c2dc1 100644 (file)
@@ -5,8 +5,8 @@ import java.util.List;
 import java.util.Map;
 
 import org.argeo.slc.core.execution.DefaultExecutionFlow;
+import org.argeo.slc.execution.Executable;
 import org.argeo.slc.execution.ExecutionFlow;
-import org.argeo.slc.process.Executable;
 
 public class ExecutionFlowFactory {
        private List<Executable> executables = new ArrayList<Executable>();
index 6b3b43828192040659265c227ac86e23a22da458..2ec10792548f97330dc6b01a9b7362b9611df889 100644 (file)
                        <groupId>org.argeo.slc.runtime</groupId>
                        <artifactId>org.argeo.slc.support.simple</artifactId>
                </dependency>
+               <dependency>
+                       <groupId>org.argeo.slc.runtime</groupId>
+                       <artifactId>org.argeo.slc.support.simple</artifactId>
+                       <classifier>tests</classifier>
+                       <scope>test</scope>
+               </dependency>
 
                <dependency>
                        <groupId>javax.transaction</groupId>
diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecutionSpec.hbm.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecutionSpec.hbm.xml
deleted file mode 100644 (file)
index e86cffe..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC\r
-       "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
-       "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.process">\r
-       <class name="SlcExecutionSpec" table="SLC_EXECUTION_SPEC">\r
-               <cache usage="read-write" />\r
-\r
-               <id name="tid" column="T_ID">
-                       <generator class="native" />
-               </id>
-
-               <map name="executionSpecFields" table="SLC_EXEC_SPEC_FIELDS"
-                       cascade="all" lazy="false" sort="natural">
-                       <cache usage="read-write" />
-
-                       <key column="PARENT_ID" />
-                       <map-key column="KEY" type="string" />
-                       <composite-element class="org.argeo.slc.process.SlcExecutionSpecField">
-                               <property name="label" column="LABEL"/>
-                               <property name="type" column="TYPE"/>
-                               <property name="defaultValue" column="DEFAULT_VALUE"/>
-                       </composite-element>
-               </map>
-
-       </class>
-</hibernate-mapping>
\ No newline at end of file
index 08064c4af657f3775d09d52ec92446dfd643cd09..ed52529339b0e69dd1370a121a5b3c6b63051f2c 100644 (file)
@@ -42,9 +42,6 @@
                                <value>
                                        org/argeo/slc/hibernate/process/SlcExecutionStep.hbm.xml
                                </value>
-                               <value>
-                                       org/argeo/slc/hibernate/process/SlcExecutionSpec.hbm.xml
-                               </value>
                                <value>
                                        org/argeo/slc/hibernate/runtime/SlcAgentDescriptor.hbm.xml
                                </value>
diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/AbstractExecutionValue.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/AbstractExecutionValue.java
new file mode 100644 (file)
index 0000000..ce69a4f
--- /dev/null
@@ -0,0 +1,5 @@
+package org.argeo.slc.core.execution;
+
+public class AbstractExecutionValue {
+
+}
index e2c343de3ff4a15e563bcfbbae3ed1a0c1eaef9e..b0e212abfab203c8771291d85c946ff5580f0f8c 100644 (file)
@@ -8,10 +8,10 @@ import java.util.UUID;
 
 import org.apache.commons.lang.math.RandomUtils;
 import org.argeo.slc.SlcException;
+import org.argeo.slc.execution.Executable;
 import org.argeo.slc.execution.ExecutionFlow;
 import org.argeo.slc.execution.ExecutionSpec;
 import org.argeo.slc.execution.ExecutionSpecAttribute;
-import org.argeo.slc.process.Executable;
 import org.argeo.slc.test.ExecutableTestRun;
 import org.springframework.beans.factory.BeanNameAware;
 import org.springframework.beans.factory.InitializingBean;
diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveAccessor.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveAccessor.java
new file mode 100644 (file)
index 0000000..c3859d5
--- /dev/null
@@ -0,0 +1,9 @@
+package org.argeo.slc.core.execution;
+
+public interface PrimitiveAccessor {
+       public String getType();
+
+       public Object getValue();
+
+       public void setValue(Object value);
+}
index daddc0aa8cbb647baecc427004207c52c39dafe4..da2a6a0d83ee5e3c0c2a238129745c7393bba01f 100644 (file)
@@ -1,9 +1,10 @@
 package org.argeo.slc.core.execution;
 
-public class PrimitiveSpecAttribute extends AbstractSpecAttribute {
-//     public enum Type {
-//             string, integer
-//     }
+public class PrimitiveSpecAttribute extends AbstractSpecAttribute implements
+               PrimitiveAccessor {
+       // public enum Type {
+       // string, integer
+       // }
 
        public final static String TYPE_STRING = "string";
        public final static String TYPE_INTEGER = "integer";
index e29d67e90f9fdaf1e750257bc88dd24b6714fd93..01793268affa745ddff0bef1042895cc27cea24e 100644 (file)
@@ -1,10 +1,20 @@
 package org.argeo.slc.core.execution;
 
-public class PrimitiveValue {
+public class PrimitiveValue extends AbstractExecutionValue implements
+               PrimitiveAccessor {
        private String type;
 
        private Object value;
 
+       public PrimitiveValue() {
+       }
+
+       public PrimitiveValue(String type, Object value) {
+               super();
+               this.type = type;
+               this.value = value;
+       }
+
        public String getType() {
                return type;
        }
index bc5336caa93d6e6a4e82bee708aa2d8467099cbf..516a15e3b301c4db9494ce39ba1346e6b9d07110 100644 (file)
@@ -1,8 +1,16 @@
 package org.argeo.slc.core.execution;
 
-public class RefValue {
+public class RefValue extends AbstractExecutionValue {
        private String label;
 
+       public RefValue() {
+       }
+
+       public RefValue(String label) {
+               super();
+               this.label = label;
+       }
+
        public String getLabel() {
                return label;
        }
index 51e06602fd0a1f3790b76ba26625076656f58c7e..eeead38886c044b2a9d08ca8cf676328cde37fe9 100644 (file)
@@ -2,7 +2,7 @@ package org.argeo.slc.core.execution.tasks;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.process.Executable;
+import org.argeo.slc.execution.Executable;
 
 public class Echo implements Executable {
        private final static Log defaultLog = LogFactory.getLog(Echo.class);
diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java
deleted file mode 100644 (file)
index bbea1bb..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.argeo.slc.unit.process;\r
-\r
-import static junit.framework.Assert.assertEquals;\r
-import static junit.framework.Assert.assertNotNull;\r
-import static org.argeo.slc.unit.UnitUtils.assertDateSec;\r
-\r
-import java.util.UUID;\r
-\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.process.SlcExecutionStep;\r
-\r
-public abstract class SlcExecutionTestUtils {\r
-\r
-       public static SlcExecution createSimpleSlcExecution() {\r
-               SlcExecution slcExec = new SlcExecution();\r
-               slcExec.setUuid(UUID.randomUUID().toString());\r
-               slcExec.setHost("localhost");\r
-               slcExec.setUser("user");\r
-               slcExec.setType("slcAnt");\r
-               slcExec.setStatus("STARTED");\r
-               slcExec.getAttributes().put("ant.file", "/test");\r
-               return slcExec;\r
-       }\r
-\r
-       public static void assertSlcExecution(SlcExecution expected,\r
-                       SlcExecution reached) {\r
-               assertNotNull(reached);\r
-               assertEquals(expected.getHost(), reached.getHost());\r
-               assertEquals(expected.getUser(), reached.getUser());\r
-               assertEquals(expected.getType(), reached.getType());\r
-               assertEquals(expected.getStatus(), reached.getStatus());\r
-\r
-               // Attributes\r
-               assertEquals(expected.getAttributes().size(), reached.getAttributes()\r
-                               .size());\r
-               for (String key : expected.getAttributes().keySet()) {\r
-                       String expectedValue = expected.getAttributes().get(key);\r
-                       String reachedValue = reached.getAttributes().get(key);\r
-                       assertNotNull(reachedValue);\r
-                       assertEquals(expectedValue, reachedValue);\r
-               }\r
-\r
-               assertEquals(expected.getSteps().size(), reached.getSteps().size());\r
-               for (int i = 0; i < expected.getSteps().size(); i++) {\r
-                       SlcExecutionStep stepExpected = expected.getSteps().get(i);\r
-                       SlcExecutionStep stepReached = reached.getSteps().get(i);\r
-                       assertSlcExecutionStep(stepExpected, stepReached);\r
-               }\r
-       }\r
-\r
-       public static void assertSlcExecutionStep(SlcExecutionStep expected,\r
-                       SlcExecutionStep reached) {\r
-               assertNotNull(reached);\r
-               assertEquals(expected.getUuid(), reached.getUuid());\r
-               assertEquals(expected.getType(), reached.getType());\r
-               assertEquals(expected.logAsString(), reached.logAsString());\r
-               assertDateSec(expected.getBegin(), reached.getBegin());\r
-       }\r
-\r
-       private SlcExecutionTestUtils() {\r
-\r
-       }\r
-}\r
diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/unit/test/tree/TreeTestResultTestUtils.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/unit/test/tree/TreeTestResultTestUtils.java
deleted file mode 100644 (file)
index cf4b0c1..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.argeo.slc.unit.test.tree;\r
-\r
-import java.util.UUID;\r
-\r
-import org.argeo.slc.build.Distribution;\r
-import org.argeo.slc.core.structure.SimpleSElement;\r
-import org.argeo.slc.core.structure.tree.TreeSPath;\r
-import org.argeo.slc.core.structure.tree.TreeSRegistry;\r
-import org.argeo.slc.core.test.SimpleResultPart;\r
-import org.argeo.slc.core.test.SimpleTestRun;\r
-import org.argeo.slc.core.test.tree.PartSubList;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.deploy.DeployedSystem;\r
-import org.argeo.slc.deploy.DeploymentData;\r
-import org.argeo.slc.deploy.TargetData;\r
-import org.argeo.slc.msg.test.tree.ResultPartRequest;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.process.SlcExecutionStep;\r
-import org.argeo.slc.test.TestStatus;\r
-import org.argeo.slc.unit.process.SlcExecutionTestUtils;\r
-\r
-public abstract class TreeTestResultTestUtils {\r
-\r
-       public static TreeTestResult createSimpleTreeTestResult() {\r
-               TreeTestResult treeTestResult = new TreeTestResult();\r
-               treeTestResult.setUuid(UUID.randomUUID().toString());\r
-               return treeTestResult;\r
-       }\r
-\r
-       public static TreeTestResult createCompleteTreeTestResult() {\r
-               SlcExecution slcExecution = SlcExecutionTestUtils\r
-                               .createSimpleSlcExecution();\r
-               SlcExecutionStep step = new SlcExecutionStep("JUnit step");\r
-               slcExecution.getSteps().add(step);\r
-\r
-               TreeTestResult ttr = createMinimalConsistentTreeTestResult(slcExecution);\r
-\r
-               ttr.addResultPart(createSimpleResultPartPassed());\r
-               ttr.addResultPart(createSimpleResultPartFailed());\r
-               ttr.addResultPart(createSimpleResultPartError());\r
-               return ttr;\r
-       }\r
-\r
-       public static TreeTestResult createMinimalConsistentTreeTestResult(\r
-                       SlcExecution slcExecution) {\r
-               SimpleTestRun testRun = new SimpleTestRun();\r
-               testRun.setUuid(UUID.randomUUID().toString());\r
-\r
-               String pathStr = "/test";\r
-               TreeSPath path = new TreeSPath(pathStr);\r
-\r
-               TreeSRegistry registry = new TreeSRegistry();\r
-               SimpleSElement elem = new SimpleSElement("Unit Test");\r
-               elem.getTags().put("myTag", "myTagValue");\r
-               registry.register(path, elem);\r
-\r
-               TreeTestResult ttr = createSimpleTreeTestResult();\r
-               ttr.getAttributes().put("testCase", "UNIT");\r
-\r
-               // Simulate test run\r
-               ttr.notifyCurrentPath(registry, path);\r
-               ttr.notifyTestRun(testRun);\r
-               testRun.setTestResult(ttr);\r
-               testRun.setDeployedSystem(new DeployedSystem() {\r
-                       private String uuid = UUID.randomUUID().toString();\r
-\r
-                       public String getDeployedSystemId() {\r
-                               return uuid;\r
-                       }\r
-\r
-                       public Distribution getDistribution() {\r
-                               return null;\r
-                       }\r
-\r
-                       public DeploymentData getDeploymentData() {\r
-                               // TODO Auto-generated method stub\r
-                               return null;\r
-                       }\r
-\r
-                       public TargetData getTargetData() {\r
-                               // TODO Auto-generated method stub\r
-                               return null;\r
-                       }\r
-\r
-               });\r
-               testRun.notifySlcExecution(slcExecution);\r
-               return ttr;\r
-       }\r
-\r
-       public static SimpleResultPart createSimpleResultPartPassed() {\r
-               SimpleResultPart partPassed = new SimpleResultPart();\r
-               String msgPassed = "message\nnew line";\r
-               partPassed.setStatus(TestStatus.PASSED);\r
-               partPassed.setMessage(msgPassed);\r
-               return partPassed;\r
-       }\r
-\r
-       public static SimpleResultPart createSimpleResultPartFailed() {\r
-               SimpleResultPart partFailed = new SimpleResultPart();\r
-               String msgFailed = "too bad";\r
-               partFailed.setStatus(TestStatus.FAILED);\r
-               partFailed.setMessage(msgFailed);\r
-               return partFailed;\r
-       }\r
-\r
-       public static SimpleResultPart createSimpleResultPartError() {\r
-               SimpleResultPart partFailed = new SimpleResultPart();\r
-               String msgFailed = "crashed\nanother line";\r
-               partFailed.setStatus(TestStatus.ERROR);\r
-               partFailed.setMessage(msgFailed);\r
-               partFailed.setException(new Exception("Test Exception"));\r
-               return partFailed;\r
-       }\r
-\r
-       public static ResultPartRequest createSimpleResultPartRequest(\r
-                       TreeTestResult ttr) {\r
-               TreeSPath path = ttr.getCurrentPath();\r
-               PartSubList lst = ttr.getResultParts().get(path);\r
-               SimpleResultPart part = (SimpleResultPart) lst.getParts().get(2);\r
-\r
-               ResultPartRequest req = new ResultPartRequest(ttr, path, part);\r
-               req.setPath(ttr.getCurrentPath());\r
-\r
-               return req;\r
-       }\r
-\r
-       private TreeTestResultTestUtils() {\r
-\r
-       }\r
-}\r
diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/unit/test/tree/UnitTestTreeUtil.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/unit/test/tree/UnitTestTreeUtil.java
deleted file mode 100644 (file)
index 91467f3..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-package org.argeo.slc.unit.test.tree;\r
-\r
-import static junit.framework.Assert.assertEquals;\r
-import static junit.framework.Assert.assertNotNull;\r
-import static junit.framework.Assert.assertNull;\r
-import static junit.framework.Assert.fail;\r
-import static org.argeo.slc.unit.UnitUtils.assertDateSec;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.core.structure.SimpleSElement;\r
-import org.argeo.slc.core.structure.tree.TreeSPath;\r
-import org.argeo.slc.core.test.SimpleResultPart;\r
-import org.argeo.slc.core.test.tree.PartSubList;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.test.TestResultPart;\r
-\r
-/** Utilities for unit tests. */\r
-public class UnitTestTreeUtil {\r
-       private final static Log log = LogFactory.getLog(UnitTestTreeUtil.class);\r
-\r
-       public static void assertTreeTestResult(TreeTestResult expected,\r
-                       TreeTestResult reached) {\r
-               assertEquals(expected.getUuid(), reached.getUuid());\r
-               assertDateSec(expected.getCloseDate(), reached.getCloseDate());\r
-\r
-               // Attributes\r
-               assertEquals(expected.getAttributes().size(), reached.getAttributes()\r
-                               .size());\r
-               for (String key : expected.getAttributes().keySet()) {\r
-                       String expectedValue = expected.getAttributes().get(key);\r
-                       String reachedValue = reached.getAttributes().get(key);\r
-                       assertNotNull(reachedValue);\r
-                       assertEquals(expectedValue, reachedValue);\r
-               }\r
-\r
-               // Result parts\r
-               assertEquals(expected.getResultParts().size(), reached.getResultParts()\r
-                               .size());\r
-               for (TreeSPath path : expected.getResultParts().keySet()) {\r
-                       PartSubList lstExpected = expected.getResultParts().get(path);\r
-                       PartSubList lstReached = expected.getResultParts().get(path);\r
-                       if (lstReached == null) {\r
-                               fail("No result for path " + path);\r
-                               return;\r
-                       }\r
-                       assertPartSubList(lstExpected, lstReached);\r
-               }\r
-\r
-               // Elements\r
-               assertEquals(expected.getElements().size(), reached.getElements()\r
-                               .size());\r
-               for (TreeSPath path : expected.getElements().keySet()) {\r
-                       // String nameExpected = expected.getElements().get(path);\r
-                       // String nameReached = expected.getElements().get(path);\r
-                       SimpleSElement elemExpected = (SimpleSElement) expected\r
-                                       .getElements().get(path);\r
-                       SimpleSElement elemReached = (SimpleSElement) expected\r
-                                       .getElements().get(path);\r
-                       assertNotNull(elemReached);\r
-                       assertElements(elemExpected, elemReached);\r
-               }\r
-\r
-       }\r
-\r
-       public static void assertElements(SimpleSElement expected,\r
-                       SimpleSElement reached) {\r
-               assertEquals(expected.getLabel(), reached.getLabel());\r
-               assertEquals(expected.getTags().size(), reached.getTags().size());\r
-               for (String tagName : expected.getTags().keySet()) {\r
-                       String expectedTagValue = expected.getTags().get(tagName);\r
-                       String reachedTagValue = reached.getTags().get(tagName);\r
-                       assertNotNull(reachedTagValue);\r
-                       assertEquals(expectedTagValue, reachedTagValue);\r
-               }\r
-       }\r
-\r
-       public static void assertPartSubList(PartSubList lstExpected,\r
-                       PartSubList lstReached) {\r
-               assertEquals(lstExpected.getParts().size(), lstReached.getParts()\r
-                               .size());\r
-               for (int i = 0; i < lstExpected.getParts().size(); i++) {\r
-                       assertPart(lstExpected.getParts().get(i), lstReached.getParts()\r
-                                       .get(i));\r
-               }\r
-       }\r
-\r
-       /** Asserts one part of a tree test result */\r
-       public static void assertPart(TreeTestResult testResult, String pathStr,\r
-                       int index, Integer status, String message) {\r
-               TreeSPath path = new TreeSPath(pathStr);\r
-               PartSubList list = testResult.getResultParts().get(path);\r
-               if (list == null) {\r
-                       fail("No result for path " + path);\r
-                       return;\r
-               }\r
-               if (index >= list.getParts().size()) {\r
-                       fail("Not enough parts.");\r
-               }\r
-               SimpleResultPart part = (SimpleResultPart) list.getParts().get(index);\r
-               assertPart(part, status, message, null, part.getTestRunUuid(), true);\r
-       }\r
-\r
-       public static void assertPart(TestResultPart expected,\r
-                       TestResultPart reached) {\r
-               String expectedTestRunUuid = null;\r
-               if (expected instanceof SimpleResultPart) {\r
-                       expectedTestRunUuid = ((SimpleResultPart) expected)\r
-                                       .getTestRunUuid();\r
-               }\r
-\r
-               assertPart(reached, expected.getStatus(), expected.getMessage(),\r
-                               expected.getExceptionMessage(), expectedTestRunUuid, false);\r
-       }\r
-\r
-       /** Assert one part of a tree test result. */\r
-       private static void assertPart(TestResultPart part, Integer status,\r
-                       String message, String exceptionDescription,\r
-                       String expectedTestRunUuid, boolean skipExceptionMessage) {\r
-               assertEquals(status, part.getStatus());\r
-\r
-               if (message != null) {\r
-                       if (log.isTraceEnabled()) {\r
-                               log.trace("Expected message:" + message);\r
-                               log.trace("Reached message:" + part.getMessage());\r
-                       }\r
-                       assertEquals(message, part.getMessage());\r
-               }\r
-\r
-               if (!skipExceptionMessage) {\r
-                       if (exceptionDescription == null) {\r
-                               assertNull(part.getExceptionMessage());\r
-                       } else {\r
-                               if (log.isTraceEnabled()) {\r
-                                       log.trace("Expected exception message:"\r
-                                                       + exceptionDescription);\r
-                                       log.trace("Reached exception message:"\r
-                                                       + part.getExceptionMessage());\r
-                               }\r
-\r
-                               assertEquals(exceptionDescription, part.getExceptionMessage());\r
-                       }\r
-               }\r
-\r
-               if (expectedTestRunUuid != null) {\r
-                       SimpleResultPart reachedPart = (SimpleResultPart) part;\r
-                       assertNotNull(reachedPart.getTestRunUuid());\r
-                       assertEquals(expectedTestRunUuid, reachedPart.getTestRunUuid());\r
-               } else {\r
-                       if (part instanceof SimpleResultPart) {\r
-                               assertNull(((SimpleResultPart) part).getTestRunUuid());\r
-                       }\r
-\r
-               }\r
-\r
-       }\r
-\r
-       public static void describeTreeTestResult(TreeTestResult ttr) {\r
-               log.info("TreeTestResult #" + ttr.getUuid());\r
-               log.info(" Close date: " + ttr.getCloseDate());\r
-               log.info(" Attributes:");\r
-               for (String key : ttr.getAttributes().keySet())\r
-                       log.info("  " + key + "=" + ttr.getAttributes().get(key));\r
-\r
-               log.info(" Result parts: (size=" + ttr.getResultParts().size() + ")");\r
-               for (TreeSPath path : ttr.getResultParts().keySet()) {\r
-                       log.info(" Path: " + path);\r
-                       PartSubList lst = ttr.getResultParts().get(path);\r
-                       for (TestResultPart part : lst.getParts())\r
-                               log.info("  " + part);\r
-               }\r
-\r
-               log.info(" Elements: (size=" + ttr.getElements().size() + ")");\r
-               for (TreeSPath path : ttr.getElements().keySet()) {\r
-                       SimpleSElement elem = (SimpleSElement) ttr.getElements().get(path);\r
-                       log.info(" Path: " + path + ", Element: " + elem.getLabel());\r
-                       for (String tag : elem.getTags().keySet())\r
-                               log.info("  " + tag + "=" + elem.getTags().get(tag));\r
-               }\r
-\r
-       }\r
-\r
-       /** Makes sure this is a singleton */\r
-       private UnitTestTreeUtil() {\r
-\r
-       }\r
-}\r
diff --git a/runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/execution/ExecutionFlowDescriptorTestUtils.java b/runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/execution/ExecutionFlowDescriptorTestUtils.java
new file mode 100644 (file)
index 0000000..14a34c7
--- /dev/null
@@ -0,0 +1,48 @@
+package org.argeo.slc.unit.execution;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.argeo.slc.core.deploy.SimpleExecutables;
+import org.argeo.slc.core.execution.DefaultExecutionSpec;
+import org.argeo.slc.core.execution.PrimitiveSpecAttribute;
+import org.argeo.slc.core.execution.PrimitiveValue;
+import org.argeo.slc.core.execution.RefSpecAttribute;
+import org.argeo.slc.core.execution.RefValue;
+import org.argeo.slc.core.test.BasicTestData;
+import org.argeo.slc.execution.ExecutionFlowDescriptor;
+import org.argeo.slc.execution.ExecutionSpecAttribute;
+
+public class ExecutionFlowDescriptorTestUtils {
+       public static ExecutionFlowDescriptor createSimpleExecutionFlowDescriptor() {
+               ExecutionFlowDescriptor flowDescriptor = new ExecutionFlowDescriptor();
+               flowDescriptor.setName("simpleFlow");
+               Map<String, Object> values = new HashMap<String, Object>();
+               values.put("primitiveInteger", new PrimitiveValue(
+                               PrimitiveSpecAttribute.TYPE_INTEGER, 100));
+               values.put("ref1", new RefValue("Just a label"));
+               flowDescriptor.setValues(values);
+
+               flowDescriptor.setExecutionSpec(createRelatedSimpleSpec());
+               return flowDescriptor;
+       }
+
+       protected static DefaultExecutionSpec createRelatedSimpleSpec() {
+               DefaultExecutionSpec spec = new DefaultExecutionSpec();
+               spec.setBeanName("simpleSpec");
+               Map<String, ExecutionSpecAttribute> attributes = new HashMap<String, ExecutionSpecAttribute>();
+
+               PrimitiveSpecAttribute primitiveInteger = new PrimitiveSpecAttribute();
+               primitiveInteger.setType(PrimitiveSpecAttribute.TYPE_INTEGER);
+               primitiveInteger.setValue(50);
+               attributes.put("primitiveInteger", primitiveInteger);
+
+               RefSpecAttribute ref1 = new RefSpecAttribute();
+               ref1.setTargetClass(BasicTestData.class);
+               attributes.put("ref1", ref1);
+
+               spec.setAttributes(attributes);
+
+               return spec;
+       }
+}
diff --git a/runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java b/runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java
new file mode 100644 (file)
index 0000000..bbea1bb
--- /dev/null
@@ -0,0 +1,63 @@
+package org.argeo.slc.unit.process;\r
+\r
+import static junit.framework.Assert.assertEquals;\r
+import static junit.framework.Assert.assertNotNull;\r
+import static org.argeo.slc.unit.UnitUtils.assertDateSec;\r
+\r
+import java.util.UUID;\r
+\r
+import org.argeo.slc.process.SlcExecution;\r
+import org.argeo.slc.process.SlcExecutionStep;\r
+\r
+public abstract class SlcExecutionTestUtils {\r
+\r
+       public static SlcExecution createSimpleSlcExecution() {\r
+               SlcExecution slcExec = new SlcExecution();\r
+               slcExec.setUuid(UUID.randomUUID().toString());\r
+               slcExec.setHost("localhost");\r
+               slcExec.setUser("user");\r
+               slcExec.setType("slcAnt");\r
+               slcExec.setStatus("STARTED");\r
+               slcExec.getAttributes().put("ant.file", "/test");\r
+               return slcExec;\r
+       }\r
+\r
+       public static void assertSlcExecution(SlcExecution expected,\r
+                       SlcExecution reached) {\r
+               assertNotNull(reached);\r
+               assertEquals(expected.getHost(), reached.getHost());\r
+               assertEquals(expected.getUser(), reached.getUser());\r
+               assertEquals(expected.getType(), reached.getType());\r
+               assertEquals(expected.getStatus(), reached.getStatus());\r
+\r
+               // Attributes\r
+               assertEquals(expected.getAttributes().size(), reached.getAttributes()\r
+                               .size());\r
+               for (String key : expected.getAttributes().keySet()) {\r
+                       String expectedValue = expected.getAttributes().get(key);\r
+                       String reachedValue = reached.getAttributes().get(key);\r
+                       assertNotNull(reachedValue);\r
+                       assertEquals(expectedValue, reachedValue);\r
+               }\r
+\r
+               assertEquals(expected.getSteps().size(), reached.getSteps().size());\r
+               for (int i = 0; i < expected.getSteps().size(); i++) {\r
+                       SlcExecutionStep stepExpected = expected.getSteps().get(i);\r
+                       SlcExecutionStep stepReached = reached.getSteps().get(i);\r
+                       assertSlcExecutionStep(stepExpected, stepReached);\r
+               }\r
+       }\r
+\r
+       public static void assertSlcExecutionStep(SlcExecutionStep expected,\r
+                       SlcExecutionStep reached) {\r
+               assertNotNull(reached);\r
+               assertEquals(expected.getUuid(), reached.getUuid());\r
+               assertEquals(expected.getType(), reached.getType());\r
+               assertEquals(expected.logAsString(), reached.logAsString());\r
+               assertDateSec(expected.getBegin(), reached.getBegin());\r
+       }\r
+\r
+       private SlcExecutionTestUtils() {\r
+\r
+       }\r
+}\r
diff --git a/runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/test/tree/TreeTestResultTestUtils.java b/runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/test/tree/TreeTestResultTestUtils.java
new file mode 100644 (file)
index 0000000..cf4b0c1
--- /dev/null
@@ -0,0 +1,130 @@
+package org.argeo.slc.unit.test.tree;\r
+\r
+import java.util.UUID;\r
+\r
+import org.argeo.slc.build.Distribution;\r
+import org.argeo.slc.core.structure.SimpleSElement;\r
+import org.argeo.slc.core.structure.tree.TreeSPath;\r
+import org.argeo.slc.core.structure.tree.TreeSRegistry;\r
+import org.argeo.slc.core.test.SimpleResultPart;\r
+import org.argeo.slc.core.test.SimpleTestRun;\r
+import org.argeo.slc.core.test.tree.PartSubList;\r
+import org.argeo.slc.core.test.tree.TreeTestResult;\r
+import org.argeo.slc.deploy.DeployedSystem;\r
+import org.argeo.slc.deploy.DeploymentData;\r
+import org.argeo.slc.deploy.TargetData;\r
+import org.argeo.slc.msg.test.tree.ResultPartRequest;\r
+import org.argeo.slc.process.SlcExecution;\r
+import org.argeo.slc.process.SlcExecutionStep;\r
+import org.argeo.slc.test.TestStatus;\r
+import org.argeo.slc.unit.process.SlcExecutionTestUtils;\r
+\r
+public abstract class TreeTestResultTestUtils {\r
+\r
+       public static TreeTestResult createSimpleTreeTestResult() {\r
+               TreeTestResult treeTestResult = new TreeTestResult();\r
+               treeTestResult.setUuid(UUID.randomUUID().toString());\r
+               return treeTestResult;\r
+       }\r
+\r
+       public static TreeTestResult createCompleteTreeTestResult() {\r
+               SlcExecution slcExecution = SlcExecutionTestUtils\r
+                               .createSimpleSlcExecution();\r
+               SlcExecutionStep step = new SlcExecutionStep("JUnit step");\r
+               slcExecution.getSteps().add(step);\r
+\r
+               TreeTestResult ttr = createMinimalConsistentTreeTestResult(slcExecution);\r
+\r
+               ttr.addResultPart(createSimpleResultPartPassed());\r
+               ttr.addResultPart(createSimpleResultPartFailed());\r
+               ttr.addResultPart(createSimpleResultPartError());\r
+               return ttr;\r
+       }\r
+\r
+       public static TreeTestResult createMinimalConsistentTreeTestResult(\r
+                       SlcExecution slcExecution) {\r
+               SimpleTestRun testRun = new SimpleTestRun();\r
+               testRun.setUuid(UUID.randomUUID().toString());\r
+\r
+               String pathStr = "/test";\r
+               TreeSPath path = new TreeSPath(pathStr);\r
+\r
+               TreeSRegistry registry = new TreeSRegistry();\r
+               SimpleSElement elem = new SimpleSElement("Unit Test");\r
+               elem.getTags().put("myTag", "myTagValue");\r
+               registry.register(path, elem);\r
+\r
+               TreeTestResult ttr = createSimpleTreeTestResult();\r
+               ttr.getAttributes().put("testCase", "UNIT");\r
+\r
+               // Simulate test run\r
+               ttr.notifyCurrentPath(registry, path);\r
+               ttr.notifyTestRun(testRun);\r
+               testRun.setTestResult(ttr);\r
+               testRun.setDeployedSystem(new DeployedSystem() {\r
+                       private String uuid = UUID.randomUUID().toString();\r
+\r
+                       public String getDeployedSystemId() {\r
+                               return uuid;\r
+                       }\r
+\r
+                       public Distribution getDistribution() {\r
+                               return null;\r
+                       }\r
+\r
+                       public DeploymentData getDeploymentData() {\r
+                               // TODO Auto-generated method stub\r
+                               return null;\r
+                       }\r
+\r
+                       public TargetData getTargetData() {\r
+                               // TODO Auto-generated method stub\r
+                               return null;\r
+                       }\r
+\r
+               });\r
+               testRun.notifySlcExecution(slcExecution);\r
+               return ttr;\r
+       }\r
+\r
+       public static SimpleResultPart createSimpleResultPartPassed() {\r
+               SimpleResultPart partPassed = new SimpleResultPart();\r
+               String msgPassed = "message\nnew line";\r
+               partPassed.setStatus(TestStatus.PASSED);\r
+               partPassed.setMessage(msgPassed);\r
+               return partPassed;\r
+       }\r
+\r
+       public static SimpleResultPart createSimpleResultPartFailed() {\r
+               SimpleResultPart partFailed = new SimpleResultPart();\r
+               String msgFailed = "too bad";\r
+               partFailed.setStatus(TestStatus.FAILED);\r
+               partFailed.setMessage(msgFailed);\r
+               return partFailed;\r
+       }\r
+\r
+       public static SimpleResultPart createSimpleResultPartError() {\r
+               SimpleResultPart partFailed = new SimpleResultPart();\r
+               String msgFailed = "crashed\nanother line";\r
+               partFailed.setStatus(TestStatus.ERROR);\r
+               partFailed.setMessage(msgFailed);\r
+               partFailed.setException(new Exception("Test Exception"));\r
+               return partFailed;\r
+       }\r
+\r
+       public static ResultPartRequest createSimpleResultPartRequest(\r
+                       TreeTestResult ttr) {\r
+               TreeSPath path = ttr.getCurrentPath();\r
+               PartSubList lst = ttr.getResultParts().get(path);\r
+               SimpleResultPart part = (SimpleResultPart) lst.getParts().get(2);\r
+\r
+               ResultPartRequest req = new ResultPartRequest(ttr, path, part);\r
+               req.setPath(ttr.getCurrentPath());\r
+\r
+               return req;\r
+       }\r
+\r
+       private TreeTestResultTestUtils() {\r
+\r
+       }\r
+}\r
diff --git a/runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/test/tree/UnitTestTreeUtil.java b/runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/test/tree/UnitTestTreeUtil.java
new file mode 100644 (file)
index 0000000..91467f3
--- /dev/null
@@ -0,0 +1,187 @@
+package org.argeo.slc.unit.test.tree;\r
+\r
+import static junit.framework.Assert.assertEquals;\r
+import static junit.framework.Assert.assertNotNull;\r
+import static junit.framework.Assert.assertNull;\r
+import static junit.framework.Assert.fail;\r
+import static org.argeo.slc.unit.UnitUtils.assertDateSec;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+import org.argeo.slc.core.structure.SimpleSElement;\r
+import org.argeo.slc.core.structure.tree.TreeSPath;\r
+import org.argeo.slc.core.test.SimpleResultPart;\r
+import org.argeo.slc.core.test.tree.PartSubList;\r
+import org.argeo.slc.core.test.tree.TreeTestResult;\r
+import org.argeo.slc.test.TestResultPart;\r
+\r
+/** Utilities for unit tests. */\r
+public class UnitTestTreeUtil {\r
+       private final static Log log = LogFactory.getLog(UnitTestTreeUtil.class);\r
+\r
+       public static void assertTreeTestResult(TreeTestResult expected,\r
+                       TreeTestResult reached) {\r
+               assertEquals(expected.getUuid(), reached.getUuid());\r
+               assertDateSec(expected.getCloseDate(), reached.getCloseDate());\r
+\r
+               // Attributes\r
+               assertEquals(expected.getAttributes().size(), reached.getAttributes()\r
+                               .size());\r
+               for (String key : expected.getAttributes().keySet()) {\r
+                       String expectedValue = expected.getAttributes().get(key);\r
+                       String reachedValue = reached.getAttributes().get(key);\r
+                       assertNotNull(reachedValue);\r
+                       assertEquals(expectedValue, reachedValue);\r
+               }\r
+\r
+               // Result parts\r
+               assertEquals(expected.getResultParts().size(), reached.getResultParts()\r
+                               .size());\r
+               for (TreeSPath path : expected.getResultParts().keySet()) {\r
+                       PartSubList lstExpected = expected.getResultParts().get(path);\r
+                       PartSubList lstReached = expected.getResultParts().get(path);\r
+                       if (lstReached == null) {\r
+                               fail("No result for path " + path);\r
+                               return;\r
+                       }\r
+                       assertPartSubList(lstExpected, lstReached);\r
+               }\r
+\r
+               // Elements\r
+               assertEquals(expected.getElements().size(), reached.getElements()\r
+                               .size());\r
+               for (TreeSPath path : expected.getElements().keySet()) {\r
+                       // String nameExpected = expected.getElements().get(path);\r
+                       // String nameReached = expected.getElements().get(path);\r
+                       SimpleSElement elemExpected = (SimpleSElement) expected\r
+                                       .getElements().get(path);\r
+                       SimpleSElement elemReached = (SimpleSElement) expected\r
+                                       .getElements().get(path);\r
+                       assertNotNull(elemReached);\r
+                       assertElements(elemExpected, elemReached);\r
+               }\r
+\r
+       }\r
+\r
+       public static void assertElements(SimpleSElement expected,\r
+                       SimpleSElement reached) {\r
+               assertEquals(expected.getLabel(), reached.getLabel());\r
+               assertEquals(expected.getTags().size(), reached.getTags().size());\r
+               for (String tagName : expected.getTags().keySet()) {\r
+                       String expectedTagValue = expected.getTags().get(tagName);\r
+                       String reachedTagValue = reached.getTags().get(tagName);\r
+                       assertNotNull(reachedTagValue);\r
+                       assertEquals(expectedTagValue, reachedTagValue);\r
+               }\r
+       }\r
+\r
+       public static void assertPartSubList(PartSubList lstExpected,\r
+                       PartSubList lstReached) {\r
+               assertEquals(lstExpected.getParts().size(), lstReached.getParts()\r
+                               .size());\r
+               for (int i = 0; i < lstExpected.getParts().size(); i++) {\r
+                       assertPart(lstExpected.getParts().get(i), lstReached.getParts()\r
+                                       .get(i));\r
+               }\r
+       }\r
+\r
+       /** Asserts one part of a tree test result */\r
+       public static void assertPart(TreeTestResult testResult, String pathStr,\r
+                       int index, Integer status, String message) {\r
+               TreeSPath path = new TreeSPath(pathStr);\r
+               PartSubList list = testResult.getResultParts().get(path);\r
+               if (list == null) {\r
+                       fail("No result for path " + path);\r
+                       return;\r
+               }\r
+               if (index >= list.getParts().size()) {\r
+                       fail("Not enough parts.");\r
+               }\r
+               SimpleResultPart part = (SimpleResultPart) list.getParts().get(index);\r
+               assertPart(part, status, message, null, part.getTestRunUuid(), true);\r
+       }\r
+\r
+       public static void assertPart(TestResultPart expected,\r
+                       TestResultPart reached) {\r
+               String expectedTestRunUuid = null;\r
+               if (expected instanceof SimpleResultPart) {\r
+                       expectedTestRunUuid = ((SimpleResultPart) expected)\r
+                                       .getTestRunUuid();\r
+               }\r
+\r
+               assertPart(reached, expected.getStatus(), expected.getMessage(),\r
+                               expected.getExceptionMessage(), expectedTestRunUuid, false);\r
+       }\r
+\r
+       /** Assert one part of a tree test result. */\r
+       private static void assertPart(TestResultPart part, Integer status,\r
+                       String message, String exceptionDescription,\r
+                       String expectedTestRunUuid, boolean skipExceptionMessage) {\r
+               assertEquals(status, part.getStatus());\r
+\r
+               if (message != null) {\r
+                       if (log.isTraceEnabled()) {\r
+                               log.trace("Expected message:" + message);\r
+                               log.trace("Reached message:" + part.getMessage());\r
+                       }\r
+                       assertEquals(message, part.getMessage());\r
+               }\r
+\r
+               if (!skipExceptionMessage) {\r
+                       if (exceptionDescription == null) {\r
+                               assertNull(part.getExceptionMessage());\r
+                       } else {\r
+                               if (log.isTraceEnabled()) {\r
+                                       log.trace("Expected exception message:"\r
+                                                       + exceptionDescription);\r
+                                       log.trace("Reached exception message:"\r
+                                                       + part.getExceptionMessage());\r
+                               }\r
+\r
+                               assertEquals(exceptionDescription, part.getExceptionMessage());\r
+                       }\r
+               }\r
+\r
+               if (expectedTestRunUuid != null) {\r
+                       SimpleResultPart reachedPart = (SimpleResultPart) part;\r
+                       assertNotNull(reachedPart.getTestRunUuid());\r
+                       assertEquals(expectedTestRunUuid, reachedPart.getTestRunUuid());\r
+               } else {\r
+                       if (part instanceof SimpleResultPart) {\r
+                               assertNull(((SimpleResultPart) part).getTestRunUuid());\r
+                       }\r
+\r
+               }\r
+\r
+       }\r
+\r
+       public static void describeTreeTestResult(TreeTestResult ttr) {\r
+               log.info("TreeTestResult #" + ttr.getUuid());\r
+               log.info(" Close date: " + ttr.getCloseDate());\r
+               log.info(" Attributes:");\r
+               for (String key : ttr.getAttributes().keySet())\r
+                       log.info("  " + key + "=" + ttr.getAttributes().get(key));\r
+\r
+               log.info(" Result parts: (size=" + ttr.getResultParts().size() + ")");\r
+               for (TreeSPath path : ttr.getResultParts().keySet()) {\r
+                       log.info(" Path: " + path);\r
+                       PartSubList lst = ttr.getResultParts().get(path);\r
+                       for (TestResultPart part : lst.getParts())\r
+                               log.info("  " + part);\r
+               }\r
+\r
+               log.info(" Elements: (size=" + ttr.getElements().size() + ")");\r
+               for (TreeSPath path : ttr.getElements().keySet()) {\r
+                       SimpleSElement elem = (SimpleSElement) ttr.getElements().get(path);\r
+                       log.info(" Path: " + path + ", Element: " + elem.getLabel());\r
+                       for (String tag : elem.getTags().keySet())\r
+                               log.info("  " + tag + "=" + elem.getTags().get(tag));\r
+               }\r
+\r
+       }\r
+\r
+       /** Makes sure this is a singleton */\r
+       private UnitTestTreeUtil() {\r
+\r
+       }\r
+}\r