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.ci.tests.datatypes;
23 import org.openecomp.sdc.be.model.Service;
24 import org.openecomp.sdc.be.model.category.CategoryDefinition;
25 import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceInstantiationType;
27 import java.util.ArrayList;
28 import java.util.Collections;
30 public class ServiceReqDetails extends ComponentReqDetails {
32 protected String serviceType = "MyServiceType";
33 protected String serviceRole = "MyServiceRole";
34 protected String namingPolicy = "MyServiceNamingPolicy";
35 protected Boolean ecompGeneratedNaming = true;
36 protected String instantiationType = ServiceInstantiationType.A_LA_CARTE.getValue();
37 protected String serviceFunction = "";
39 public String getServiceType() {
43 public void setServiceType(String serviceType) {
44 this.serviceType = serviceType;
47 public String getInstantiationType() {
48 return instantiationType;
51 public String getServiceRole() {
55 public void setServiceRole(String serviceRole) {
56 this.serviceRole = serviceRole;
59 public String getNamingPolicy() {
63 public void setNamingPolicy(String namingPolicy) {
64 this.namingPolicy = namingPolicy;
67 public Boolean getEcompGeneratedNaming() {
68 return ecompGeneratedNaming;
71 public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) {
72 this.ecompGeneratedNaming = ecompGeneratedNaming;
75 public String getServiceFunction() {
76 return serviceFunction;
79 public void setServiceFunction(String serviceFunction) {
80 this.serviceFunction = serviceFunction;
83 public ServiceReqDetails(String serviceName, String category, ArrayList<String> tags, String description,
84 String contactId, String icon, String instantiationType) {
85 this.name = serviceName;
87 this.description = description;
88 this.contactId = contactId;
90 projectCode = "12345";
91 serviceFunction = "serviceFunction name";
92 CategoryDefinition categoryDefinition = new CategoryDefinition();
93 categoryDefinition.setName(category);
94 categoryDefinition.setIcons(Collections.singletonList(icon));
95 categories = new ArrayList<>();
96 categories.add(categoryDefinition);
100 public ServiceReqDetails(Service service) {
101 this.contactId = service.getContactId();
102 this.categories = service.getCategories();
103 this.creatorUserId = service.getCreatorUserId();
104 this.creatorFullName = service.getCreatorFullName();
105 this.description = service.getDescription();
106 this.icon = service.getIcon();
107 this.name = service.getName();
108 this.projectCode = service.getProjectCode();
109 this.tags = service.getTags();
110 this.uniqueId = service.getUniqueId();
111 this.UUID = service.getUUID();
112 this.version = service.getVersion();
116 public ServiceReqDetails() {
117 contactId = "aa1234";
118 projectCode = "12345";
121 public ServiceReqDetails(ServiceReqDetails a, String newServiceName) {
122 a.setName(newServiceName);
126 public String toString() {
127 return "ServiceDetails [name = " + name + ", category = " + getCategory() + ", tags = " + tags + ", description = "
128 + description + ", contactId = " + contactId + ", icon = " + icon + ", instantiation type = " + getInstantiationType() + "]";
131 public ServiceReqDetails(ServiceReqDetails aService) {
132 this(aService.getName(), aService.getCategory(), (ArrayList<String>) aService.getTags(),
133 aService.getDescription(), aService.getContactId(), aService.getIcon(), aService.getInstantiationType());
134 uniqueId = aService.getUniqueId();
135 version = aService.getVersion();
138 public String getCategory() {
139 if (categories != null && categories.size() >= 1) {
140 return categories.get(0).getName();