From 34e590f37109dd9ff9aa4e12af04ee98779aa9e1 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Wed, 11 Mar 2009 13:13:21 +0000 Subject: [PATCH] XML format for executions git-svn-id: https://svn.argeo.org/slc/trunk@2246 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- org.argeo.slc/pom.xml | 13 +++++ .../java/org/argeo/slc/deploy/Deployment.java | 2 +- .../{process => execution}/Executable.java | 2 +- .../argeo/slc/execution/ExecutionFlow.java | 1 - .../org/argeo/slc/process/RealizedFlow.java | 44 ++++++++++++++++ .../org/argeo/slc/process/SlcExecution.java | 9 ++++ .../argeo/slc/process/SlcExecutionSpec.java | 27 ---------- .../slc/process/SlcExecutionSpecField.java | 41 --------------- .../org/argeo/slc/test/ExecutableTestRun.java | 2 +- runtime/org.argeo.slc.support.castor/pom.xml | 51 ++++++++++--------- .../execution/PrimitiveFieldHandler.java | 31 ++--------- .../org/argeo/slc/castor/execution.xml | 24 ++++++--- .../org/argeo/slc/castor/process.xml | 45 +++++++--------- .../ExecutionModuleDescriptorCastorTest.java | 30 +++++++++++ .../slc/castor/SlcExecutionCastorTest.java | 21 ++++++++ .../castor/SlcExecutionSpecCastorTest.java | 27 ---------- .../execution/old/ExecutionFlowFactory.java | 2 +- .../org.argeo.slc.support.hibernate/pom.xml | 6 +++ .../process/SlcExecutionSpec.hbm.xml | 27 ---------- .../hibernate/spring/applicationContext.xml | 3 -- .../execution/AbstractExecutionValue.java | 5 ++ .../core/execution/DefaultExecutionFlow.java | 2 +- .../slc/core/execution/PrimitiveAccessor.java | 9 ++++ .../execution/PrimitiveSpecAttribute.java | 9 ++-- .../slc/core/execution/PrimitiveValue.java | 12 ++++- .../argeo/slc/core/execution/RefValue.java | 10 +++- .../argeo/slc/core/execution/tasks/Echo.java | 2 +- .../ExecutionFlowDescriptorTestUtils.java | 48 +++++++++++++++++ .../unit/process/SlcExecutionTestUtils.java | 0 .../test/tree/TreeTestResultTestUtils.java | 0 .../slc/unit/test/tree/UnitTestTreeUtil.java | 0 31 files changed, 284 insertions(+), 221 deletions(-) rename runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/{process => execution}/Executable.java (82%) create mode 100644 runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/RealizedFlow.java delete mode 100644 runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionSpec.java delete mode 100644 runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionSpecField.java create mode 100644 runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java delete mode 100644 runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionSpecCastorTest.java delete mode 100644 runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecutionSpec.hbm.xml create mode 100644 runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/AbstractExecutionValue.java create mode 100644 runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveAccessor.java create mode 100644 runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/execution/ExecutionFlowDescriptorTestUtils.java rename runtime/org.argeo.slc.support.simple/src/{main => test}/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java (100%) rename runtime/org.argeo.slc.support.simple/src/{main => test}/java/org/argeo/slc/unit/test/tree/TreeTestResultTestUtils.java (100%) rename runtime/org.argeo.slc.support.simple/src/{main => test}/java/org/argeo/slc/unit/test/tree/UnitTestTreeUtil.java (100%) diff --git a/org.argeo.slc/pom.xml b/org.argeo.slc/pom.xml index 203eb669f..ef9663569 100644 --- a/org.argeo.slc/pom.xml +++ b/org.argeo.slc/pom.xml @@ -89,6 +89,13 @@ limitations under the License. target/classes/META-INF/MANIFEST.MF + + + + test-jar + + + org.apache.maven.plugins @@ -268,6 +275,12 @@ limitations under the License. org.argeo.slc.support.simple ${project.version} + + org.argeo.slc.runtime + org.argeo.slc.support.simple + ${project.version} + tests + org.argeo.slc.runtime org.argeo.slc.support.ant diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/Deployment.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/Deployment.java index 7e471f590..13d393136 100644 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/Deployment.java +++ b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/Deployment.java @@ -1,7 +1,7 @@ package org.argeo.slc.deploy; import org.argeo.slc.build.Distribution; -import org.argeo.slc.process.Executable; +import org.argeo.slc.execution.Executable; public interface Deployment extends Executable{ public DeployedSystem getDeployedSystem(); 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/execution/Executable.java similarity index 82% rename from runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/Executable.java rename to runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/Executable.java index 129b1c636..bc804bdf1 100644 --- 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/execution/Executable.java @@ -1,4 +1,4 @@ -package org.argeo.slc.process; +package org.argeo.slc.execution; /** Any object which can perform processing */ public interface Executable { diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java index ce6a80583..ed9272e01 100644 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java +++ b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java @@ -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/RealizedFlow.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/RealizedFlow.java new file mode 100644 index 000000000..c47308eef --- /dev/null +++ b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/RealizedFlow.java @@ -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; + } + +} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecution.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecution.java index a52fea533..cfef48033 100644 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecution.java +++ b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecution.java @@ -22,6 +22,15 @@ public class SlcExecution { private Map attributes = new TreeMap(); private List steps = new ArrayList(); + private List realizedFlows = new ArrayList(); + + public List getRealizedFlows() { + return realizedFlows; + } + + public void setRealizedFlows(List realizedFlows) { + this.realizedFlows = realizedFlows; + } public List getSteps() { return steps; 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 index 72ab0e48d..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionSpec.java +++ /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 executionSpecFields = new HashMap(); - - public Long getTid() { - return tid; - } - - public void setTid(Long tid) { - this.tid = tid; - } - - public Map getExecutionSpecFields() { - return executionSpecFields; - } - - public void setExecutionSpecFields( - Map 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 index 88bd6501c..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionSpecField.java +++ /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; - } - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/ExecutableTestRun.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/ExecutableTestRun.java index 5b8811377..37843d183 100644 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/ExecutableTestRun.java +++ b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/ExecutableTestRun.java @@ -1,6 +1,6 @@ package org.argeo.slc.test; -import org.argeo.slc.process.Executable; +import org.argeo.slc.execution.Executable; /** A test run that can be executed */ public interface ExecutableTestRun extends TestRun, Executable { diff --git a/runtime/org.argeo.slc.support.castor/pom.xml b/runtime/org.argeo.slc.support.castor/pom.xml index 263bf7d70..a1c8fb791 100644 --- a/runtime/org.argeo.slc.support.castor/pom.xml +++ b/runtime/org.argeo.slc.support.castor/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 org.argeo.slc @@ -38,30 +39,28 @@ org.argeo.slc.* 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 com.springsource.org.castor - + @@ -74,6 +73,12 @@ org.argeo.slc.runtime org.argeo.slc.support.simple + + org.argeo.slc.runtime + org.argeo.slc.support.simple + tests + test + org.springframework.ws diff --git a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java index e27a3af79..bee2acb66 100644 --- a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java +++ b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java @@ -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) { diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml index 4c9a256cc..a0489e810 100644 --- a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml +++ b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml @@ -37,7 +37,8 @@ - + @@ -60,7 +61,8 @@ - + @@ -90,7 +92,9 @@ + handler="org.argeo.slc.castor.execution.PrimitiveFieldHandler"> + + - + + + + + + handler="org.argeo.slc.castor.execution.PrimitiveFieldHandler"> + + - + diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml index be807ff0f..401e7a663 100644 --- a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml +++ b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml @@ -15,6 +15,10 @@ + + + @@ -35,6 +39,19 @@ + + + + + + + + + + + + @@ -48,32 +65,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ 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 index 000000000..5adbd62c3 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java @@ -0,0 +1,30 @@ +package org.argeo.slc.castor; + +import java.util.ArrayList; +import java.util.List; + +import org.argeo.slc.execution.ExecutionFlowDescriptor; +import org.argeo.slc.execution.ExecutionModuleDescriptor; +import org.argeo.slc.execution.ExecutionSpec; +import org.argeo.slc.unit.execution.ExecutionFlowDescriptorTestUtils; + +public class ExecutionModuleDescriptorCastorTest extends AbstractCastorTestCase { + public void testMarshUnmarsh() throws Exception { + ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); + moduleDescriptor.setName("test.moodule"); + moduleDescriptor.setVersion("1.0.0"); + + ExecutionFlowDescriptor flowDescriptor = ExecutionFlowDescriptorTestUtils + .createSimpleExecutionFlowDescriptor(); + + List flows = new ArrayList(); + flows.add(flowDescriptor); + moduleDescriptor.setExecutionFlows(flows); + + List specs = new ArrayList(); + specs.add(flowDescriptor.getExecutionSpec()); + moduleDescriptor.setExecutionSpecs(specs); + + marshUnmarsh(moduleDescriptor, false); + } +} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java index a8f724f25..bfd6a7e11 100644 --- a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java +++ b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java @@ -1,12 +1,17 @@ package org.argeo.slc.castor; import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; import java.util.UUID; +import org.argeo.slc.execution.ExecutionFlowDescriptor; import org.argeo.slc.msg.process.SlcExecutionRequest; import org.argeo.slc.msg.process.SlcExecutionStepsRequest; +import org.argeo.slc.process.RealizedFlow; import org.argeo.slc.process.SlcExecution; import org.argeo.slc.process.SlcExecutionStep; +import org.argeo.slc.unit.execution.ExecutionFlowDescriptorTestUtils; import org.argeo.slc.unit.process.SlcExecutionTestUtils; import org.springframework.xml.transform.StringResult; @@ -63,4 +68,20 @@ public class SlcExecutionCastorTest extends AbstractCastorTestCase { SlcExecutionRequest msgUpdateUnm = unmarshal(msgUpdateXml); assertNotNull(msgUpdateUnm); } + + public void testMarshUnmarsh() throws Exception { + SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution(); + List realizedFlows = new ArrayList(); + RealizedFlow realizedFlow = new RealizedFlow(); + ExecutionFlowDescriptor flowDescriptor = ExecutionFlowDescriptorTestUtils + .createSimpleExecutionFlowDescriptor(); + realizedFlow.setModuleName("test.module"); + realizedFlow.setModuleVersion("1.0.0"); + realizedFlow.setFlowDescriptor(flowDescriptor); + realizedFlow.setExecutionSpec(flowDescriptor.getExecutionSpec()); + realizedFlows.add(realizedFlow); + slcExec.setRealizedFlows(realizedFlows); + + marshUnmarsh(slcExec, false); + } } 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 index 51d4c47ee..000000000 --- a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionSpecCastorTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.argeo.slc.castor; - -import org.argeo.slc.process.SlcExecutionSpec; -import org.argeo.slc.process.SlcExecutionSpecField; - -public class SlcExecutionSpecCastorTest extends AbstractCastorTestCase { - public void testMarshalling() throws Exception { - SlcExecutionSpec spec = new SlcExecutionSpec(); - - SlcExecutionSpecField field1 = new SlcExecutionSpecField(); - field1.setLabel("Field1"); - field1.setType("text"); - field1.setDefaultValue("def"); - spec.getExecutionSpecFields().put("field1", field1); - - SlcExecutionSpecField field2 = new SlcExecutionSpecField(); - field2.setLabel("Field2"); - field2.setType("list"); - field2.setListValues("def,nodef"); - field2.setDefaultValue("def"); - spec.getExecutionSpecFields().put("field2", field2); - - SlcExecutionSpec specUnm = marshUnmarsh(spec,false); - - - } -} diff --git a/runtime/org.argeo.slc.support.equinox/src/main/java/org/argeo/slc/execution/old/ExecutionFlowFactory.java b/runtime/org.argeo.slc.support.equinox/src/main/java/org/argeo/slc/execution/old/ExecutionFlowFactory.java index c38d866d7..8b35dda71 100644 --- a/runtime/org.argeo.slc.support.equinox/src/main/java/org/argeo/slc/execution/old/ExecutionFlowFactory.java +++ b/runtime/org.argeo.slc.support.equinox/src/main/java/org/argeo/slc/execution/old/ExecutionFlowFactory.java @@ -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 executables = new ArrayList(); diff --git a/runtime/org.argeo.slc.support.hibernate/pom.xml b/runtime/org.argeo.slc.support.hibernate/pom.xml index 6b3b43828..2ec107925 100644 --- a/runtime/org.argeo.slc.support.hibernate/pom.xml +++ b/runtime/org.argeo.slc.support.hibernate/pom.xml @@ -60,6 +60,12 @@ org.argeo.slc.runtime org.argeo.slc.support.simple + + org.argeo.slc.runtime + org.argeo.slc.support.simple + tests + test + javax.transaction 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 index e86cffe31..000000000 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/process/SlcExecutionSpec.hbm.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/spring/applicationContext.xml b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/spring/applicationContext.xml index 08064c4af..ed5252933 100644 --- a/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/spring/applicationContext.xml +++ b/runtime/org.argeo.slc.support.hibernate/src/main/resources/org/argeo/slc/hibernate/spring/applicationContext.xml @@ -42,9 +42,6 @@ org/argeo/slc/hibernate/process/SlcExecutionStep.hbm.xml - - org/argeo/slc/hibernate/process/SlcExecutionSpec.hbm.xml - org/argeo/slc/hibernate/runtime/SlcAgentDescriptor.hbm.xml 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 index 000000000..ce69a4f98 --- /dev/null +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/AbstractExecutionValue.java @@ -0,0 +1,5 @@ +package org.argeo.slc.core.execution; + +public class AbstractExecutionValue { + +} 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 e2c343de3..b0e212abf 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 @@ -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 index 000000000..c3859d5b2 --- /dev/null +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveAccessor.java @@ -0,0 +1,9 @@ +package org.argeo.slc.core.execution; + +public interface PrimitiveAccessor { + public String getType(); + + public Object getValue(); + + public void setValue(Object value); +} diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveSpecAttribute.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveSpecAttribute.java index daddc0aa8..da2a6a0d8 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveSpecAttribute.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveSpecAttribute.java @@ -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"; diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveValue.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveValue.java index e29d67e90..01793268a 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveValue.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/PrimitiveValue.java @@ -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; } diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/RefValue.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/RefValue.java index bc5336caa..516a15e3b 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/RefValue.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/RefValue.java @@ -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; } diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/Echo.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/Echo.java index 51e06602f..eeead3888 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/Echo.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/Echo.java @@ -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/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 index 000000000..14a34c7fb --- /dev/null +++ b/runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/execution/ExecutionFlowDescriptorTestUtils.java @@ -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 values = new HashMap(); + 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 attributes = new HashMap(); + + 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/main/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 similarity index 100% rename from runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java rename to runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java 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/test/java/org/argeo/slc/unit/test/tree/TreeTestResultTestUtils.java similarity index 100% rename from runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/unit/test/tree/TreeTestResultTestUtils.java rename to runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/test/tree/TreeTestResultTestUtils.java 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/test/java/org/argeo/slc/unit/test/tree/UnitTestTreeUtil.java similarity index 100% rename from runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/unit/test/tree/UnitTestTreeUtil.java rename to runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/unit/test/tree/UnitTestTreeUtil.java -- 2.39.2