Use versioning, zusammen and session libs from sdc-common-be
[sdc/sdc-workflow-designer.git] / workflow-designer-be / src / test / java / org / onap / sdc / workflow / TestUtil.java
1 /*
2  * Copyright © 2016-2018 European Support Limited
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.sdc.workflow;
18
19 import static org.onap.sdc.workflow.services.impl.ItemType.WORKFLOW;
20
21 import org.onap.sdc.common.versioning.persistence.types.InternalItem;
22 import org.onap.sdc.common.versioning.persistence.types.InternalVersion;
23 import org.onap.sdc.common.versioning.services.types.VersionStatus;
24 import org.onap.sdc.workflow.services.types.Workflow;
25 import org.onap.sdc.workflow.services.types.ArchivingStatus;
26 import org.onap.sdc.common.versioning.services.types.Item;
27 import org.onap.sdc.common.versioning.services.types.ItemStatus;
28
29 public class TestUtil {
30
31     public static Workflow createWorkflow(int workflowNum, boolean createId, ArchivingStatus archivingStatus) {
32         Workflow workflow = new Workflow();
33         if (createId) {
34             workflow.setId(String.valueOf(workflowNum));
35         }
36         workflow.setName("Workflow_" + workflowNum);
37         workflow.setDescription("Description_" + workflowNum);
38         workflow.setArchiving(archivingStatus);
39
40         return workflow;
41     }
42
43     public static Item createItem(int itemNum, boolean setType, boolean setId, ItemStatus archivingStatus) {
44         InternalItem item = new InternalItem();
45         if (setId) {
46             item.setId(String.valueOf(itemNum));
47         }
48         item.setName("Workflow_" + itemNum);
49         item.setDescription("Description_" + itemNum);
50         if (setType) {
51             item.setType(WORKFLOW.name());
52         }
53         item.setStatus(archivingStatus);
54         return item;
55     }
56
57     public static InternalVersion createRetrievedVersion(String id, VersionStatus status) {
58         InternalVersion version = new InternalVersion();
59         version.setId(id);
60         version.setStatus(status);
61         return version;
62     }
63
64
65 }