2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.unit
.execution
;
18 import java
.util
.ArrayList
;
19 import java
.util
.HashMap
;
22 import org
.argeo
.slc
.core
.execution
.DefaultExecutionSpec
;
23 import org
.argeo
.slc
.core
.execution
.PrimitiveAccessor
;
24 import org
.argeo
.slc
.core
.execution
.PrimitiveSpecAttribute
;
25 import org
.argeo
.slc
.core
.execution
.PrimitiveValue
;
26 import org
.argeo
.slc
.core
.execution
.RefSpecAttribute
;
27 import org
.argeo
.slc
.core
.execution
.RefValue
;
28 import org
.argeo
.slc
.core
.execution
.RefValueChoice
;
29 import org
.argeo
.slc
.core
.test
.BasicTestData
;
30 import org
.argeo
.slc
.execution
.ExecutionFlowDescriptor
;
31 import org
.argeo
.slc
.execution
.ExecutionSpecAttribute
;
33 public class ExecutionFlowDescriptorTestUtils
{
34 public static ExecutionFlowDescriptor
createSimpleExecutionFlowDescriptor() {
35 ExecutionFlowDescriptor flowDescriptor
= new ExecutionFlowDescriptor();
36 flowDescriptor
.setName("simpleFlow");
37 flowDescriptor
.setDescription("my description");
39 Map
<String
, Object
> values
= new HashMap
<String
, Object
>();
40 values
.put("primitiveInteger", new PrimitiveValue(
41 PrimitiveAccessor
.TYPE_INTEGER
, 100));
43 RefValue refValue
= new RefValue("002");
44 values
.put("ref1", refValue
);
45 flowDescriptor
.setValues(values
);
47 flowDescriptor
.setExecutionSpec(createRelatedSimpleSpec());
48 return flowDescriptor
;
51 protected static DefaultExecutionSpec
createRelatedSimpleSpec() {
52 DefaultExecutionSpec spec
= new DefaultExecutionSpec();
53 spec
.setBeanName("simpleSpec");
54 Map
<String
, ExecutionSpecAttribute
> attributes
= new HashMap
<String
, ExecutionSpecAttribute
>();
56 PrimitiveSpecAttribute primitiveInteger
= new PrimitiveSpecAttribute();
57 primitiveInteger
.setType(PrimitiveAccessor
.TYPE_INTEGER
);
58 primitiveInteger
.setValue(50);
59 attributes
.put("primitiveInteger", primitiveInteger
);
61 RefSpecAttribute ref1
= new RefSpecAttribute();
62 ref1
.setTargetClass(BasicTestData
.class);
63 ref1
.setChoices(new ArrayList
<RefValueChoice
>());
64 ref1
.getChoices().add(new RefValueChoice("001", "desc"));
65 ref1
.getChoices().add(new RefValueChoice("002", null));
66 ref1
.getChoices().add(new RefValueChoice("003", null));
67 attributes
.put("ref1", ref1
);
69 spec
.setAttributes(attributes
);