]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.unit/src/main/java/org/argeo/slc/unit/execution/ExecutionFlowDescriptorTestUtils.java
Introduce execution flow test case
[gpl/argeo-slc.git] / runtime / org.argeo.slc.unit / src / main / java / org / argeo / slc / unit / execution / ExecutionFlowDescriptorTestUtils.java
1 package org.argeo.slc.unit.execution;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 import org.argeo.slc.core.deploy.SimpleExecutables;
7 import org.argeo.slc.core.execution.DefaultExecutionSpec;
8 import org.argeo.slc.core.execution.PrimitiveSpecAttribute;
9 import org.argeo.slc.core.execution.PrimitiveValue;
10 import org.argeo.slc.core.execution.RefSpecAttribute;
11 import org.argeo.slc.core.execution.RefValue;
12 import org.argeo.slc.core.test.BasicTestData;
13 import org.argeo.slc.execution.ExecutionFlowDescriptor;
14 import org.argeo.slc.execution.ExecutionSpecAttribute;
15
16 public class ExecutionFlowDescriptorTestUtils {
17 public static ExecutionFlowDescriptor createSimpleExecutionFlowDescriptor() {
18 ExecutionFlowDescriptor flowDescriptor = new ExecutionFlowDescriptor();
19 flowDescriptor.setName("simpleFlow");
20 Map<String, Object> values = new HashMap<String, Object>();
21 values.put("primitiveInteger", new PrimitiveValue(
22 PrimitiveSpecAttribute.TYPE_INTEGER, 100));
23 values.put("ref1", new RefValue("Just a label"));
24 flowDescriptor.setValues(values);
25
26 flowDescriptor.setExecutionSpec(createRelatedSimpleSpec());
27 return flowDescriptor;
28 }
29
30 protected static DefaultExecutionSpec createRelatedSimpleSpec() {
31 DefaultExecutionSpec spec = new DefaultExecutionSpec();
32 spec.setBeanName("simpleSpec");
33 Map<String, ExecutionSpecAttribute> attributes = new HashMap<String, ExecutionSpecAttribute>();
34
35 PrimitiveSpecAttribute primitiveInteger = new PrimitiveSpecAttribute();
36 primitiveInteger.setType(PrimitiveSpecAttribute.TYPE_INTEGER);
37 primitiveInteger.setValue(50);
38 attributes.put("primitiveInteger", primitiveInteger);
39
40 RefSpecAttribute ref1 = new RefSpecAttribute();
41 ref1.setTargetClass(BasicTestData.class);
42 attributes.put("ref1", ref1);
43
44 spec.setAttributes(attributes);
45
46 return spec;
47 }
48 }