Add collaboration feature
[sdc.git] / openecomp-be / lib / openecomp-core-lib / openecomp-zusammen-lib / openecomp-zusammen-plugin / src / test / java / org / openecomp / core / zusammen / plugin / collaboration / TestUtils.java
1 /*
2  * Copyright © 2016-2017 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.openecomp.core.zusammen.plugin.collaboration;
18
19 import com.amdocs.zusammen.datatypes.Id;
20 import com.amdocs.zusammen.datatypes.SessionContext;
21 import com.amdocs.zusammen.datatypes.UserInfo;
22 import com.amdocs.zusammen.datatypes.item.ElementContext;
23 import com.amdocs.zusammen.datatypes.item.Info;
24 import com.amdocs.zusammen.datatypes.item.ItemVersion;
25 import com.amdocs.zusammen.datatypes.item.ItemVersionData;
26 import com.amdocs.zusammen.datatypes.item.Relation;
27
28 import java.util.Arrays;
29
30 public class TestUtils {
31
32   public static SessionContext createSessionContext(UserInfo user, String tenant) {
33     SessionContext context = new SessionContext();
34     context.setUser(user);
35     context.setTenant(tenant);
36     return context;
37   }
38
39   public static ElementContext createElementContext(Id itemId, Id versionId) {
40     ElementContext elementContext = new ElementContext();
41     elementContext.setItemId(itemId);
42     elementContext.setVersionId(versionId);
43     return elementContext;
44   }
45
46   public static Info createInfo(String value) {
47     Info info = new Info();
48     info.setName(value);
49     info.addProperty("Name", "name_" + value);
50     info.addProperty("Desc", "desc_" + value);
51     return info;
52   }
53
54   public static ItemVersion createItemVersion(Id id, Id baseId, String name, boolean dirty) {
55     ItemVersion version = new ItemVersion();
56     version.setId(id);
57     version.setBaseId(baseId);
58     ItemVersionData data = new ItemVersionData();
59     data.setInfo(TestUtils.createInfo(name));
60     data.setRelations(Arrays.asList(new Relation(), new Relation()));
61     version.setData(data);
62     return version;
63   }
64 }