2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.be.components;
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;
28 import java.util.ArrayList;
29 import java.util.List;
31 public class ResourceTestUtils {
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<String>();
42 arr.add("tosca.nodes.Root");
43 r.setDerivedFrom(arr);
44 List<String> arr1 = new ArrayList<String>();
45 arr1.add(r.getName());
47 r.setIcon("borderElement");
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<String>();
62 arr.add("tosca.nodes.Root");
63 r.setDerivedFrom(arr);
64 List<String> arr1 = new ArrayList<String>();
65 arr1.add(r.getName());
67 r.setIcon("borderElement");
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<String>();
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");