]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.unit/src/main/java/org/argeo/slc/unit/execution/ExecutionFlowDescriptorTestUtils.java
First draft of DAO implementation for JCR.
[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.ArrayList;
4 import java.util.HashMap;
5 import java.util.Map;
6
7 import org.argeo.slc.core.execution.DefaultExecutionSpec;
8 import org.argeo.slc.core.execution.PrimitiveSpecAttribute;
9 import org.argeo.slc.core.execution.PrimitiveUtils;
10 import org.argeo.slc.core.execution.PrimitiveValue;
11 import org.argeo.slc.core.execution.RefSpecAttribute;
12 import org.argeo.slc.core.execution.RefValue;
13 import org.argeo.slc.core.execution.RefValueChoice;
14 import org.argeo.slc.core.test.BasicTestData;
15 import org.argeo.slc.execution.ExecutionFlowDescriptor;
16 import org.argeo.slc.execution.ExecutionSpecAttribute;
17
18 public class ExecutionFlowDescriptorTestUtils {
19 public static ExecutionFlowDescriptor createSimpleExecutionFlowDescriptor() {
20 ExecutionFlowDescriptor flowDescriptor = new ExecutionFlowDescriptor();
21 flowDescriptor.setName("simpleFlow");
22 flowDescriptor.setDescription("my description");
23
24 Map<String, Object> values = new HashMap<String, Object>();
25 values.put("primitiveInteger", new PrimitiveValue(
26 PrimitiveUtils.TYPE_INTEGER, 100));
27
28 RefValue refValue = new RefValue("002");
29 values.put("ref1", refValue);
30 flowDescriptor.setValues(values);
31
32 flowDescriptor.setExecutionSpec(createRelatedSimpleSpec());
33 return flowDescriptor;
34 }
35
36 protected static DefaultExecutionSpec createRelatedSimpleSpec() {
37 DefaultExecutionSpec spec = new DefaultExecutionSpec();
38 spec.setBeanName("simpleSpec");
39 Map<String, ExecutionSpecAttribute> attributes = new HashMap<String, ExecutionSpecAttribute>();
40
41 PrimitiveSpecAttribute primitiveInteger = new PrimitiveSpecAttribute();
42 primitiveInteger.setType(PrimitiveUtils.TYPE_INTEGER);
43 primitiveInteger.setValue(50);
44 attributes.put("primitiveInteger", primitiveInteger);
45
46 RefSpecAttribute ref1 = new RefSpecAttribute();
47 ref1.setTargetClass(BasicTestData.class);
48 ref1.setChoices(new ArrayList<RefValueChoice>());
49 ref1.getChoices().add(new RefValueChoice("001", "desc"));
50 ref1.getChoices().add(new RefValueChoice("002", null));
51 ref1.getChoices().add(new RefValueChoice("003", null));
52 attributes.put("ref1", ref1);
53
54 spec.setAttributes(attributes);
55
56 return spec;
57 }
58 }