Fix 'Substitution Node not updated during import'-bug
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / components / ResourceTestUtils.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.be.components;
22
23 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
24 import org.openecomp.sdc.be.model.Resource;
25 import org.openecomp.sdc.be.model.Service;
26 import org.openecomp.sdc.be.model.category.CategoryDefinition;
27
28 import java.util.ArrayList;
29 import java.util.List;
30
31 public class ResourceTestUtils {
32
33     public static Resource prepareResource(int resourceIndex) {
34         Resource r = new Resource();
35         r.setName("resource_" + resourceIndex);
36         r.setDescription("description");
37         r.setVendorName("vendor name");
38         r.setVendorRelease("vendor release");
39         r.setContactId("as123y");
40         r.addCategory("Generic", "Infrastructure");
41         List<String> arr = new ArrayList<>();
42         arr.add("tosca.nodes.Root");
43         r.setDerivedFrom(arr);
44         List<String> arr1 = new ArrayList<>();
45         arr1.add(r.getName());
46         r.setTags(arr1);
47         r.setIcon("borderElement");
48         return r;
49     }
50
51     public static Resource prepareResource(int resourceIndex, ResourceTypeEnum resourceType) {
52         Resource r = new Resource();
53         r.setName("resource_" + resourceIndex);
54         r.setToscaResourceName("resource_" + resourceIndex);
55         r.setDescription("description");
56         r.setVendorName("vendor name");
57         r.setVendorRelease("vendor release");
58         r.setContactId("as123y");
59         r.setResourceType(resourceType);
60         r.addCategory("Generic", "Infrastructure");
61         List<String> arr = new ArrayList<>();
62         arr.add("tosca.nodes.Root");
63         r.setDerivedFrom(arr);
64         List<String> arr1 = new ArrayList<>();
65         arr1.add(r.getName());
66         r.setTags(arr1);
67         r.setIcon("borderElement");
68         return r;
69     }
70
71     public static Service prepareService(int serviceIndex) {
72         Service service = new Service();
73         service.setName("service_" + serviceIndex);
74         service.setDescription("desc");
75         service.setIcon("icon-service-red1");
76         List<String> tags = new ArrayList<>();
77         tags.add(service.getName());
78         service.setTags(tags);
79         CategoryDefinition category = new CategoryDefinition();
80         category.setName("Mobility");
81         List<CategoryDefinition> categories = new ArrayList<>();
82         categories.add(category);
83         service.setCategories(categories);
84         service.setContactId("as123y");
85         service.setProjectCode("123456");
86
87         return service;
88     }
89
90 }