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.onap.sdc.backend.ci.tests.datatypes;
23 import java.util.ArrayList;
24 import java.util.Collections;
27 import org.onap.sdc.backend.ci.tests.datatypes.enums.ServiceInstantiationType;
28 import org.onap.sdc.frontend.ci.tests.datatypes.ModelName;
29 import org.openecomp.sdc.be.model.Service;
30 import org.openecomp.sdc.be.model.category.CategoryDefinition;
32 public class ServiceReqDetails extends ComponentReqDetails {
34 protected String serviceType = "MyServiceType";
35 protected String serviceRole = "MyServiceRole";
36 protected String namingPolicy = "MyServiceNamingPolicy";
37 protected Boolean ecompGeneratedNaming = true;
38 protected String instantiationType = ServiceInstantiationType.A_LA_CARTE.getValue();
39 protected String serviceFunction = "";
42 private String derivedFromGenericType;
45 private String derivedFromGenericVersion;
49 public String getServiceType() {
53 public void setServiceType(String serviceType) {
54 this.serviceType = serviceType;
57 public String getInstantiationType() {
58 return instantiationType;
61 public String getServiceRole() {
65 public void setServiceRole(String serviceRole) {
66 this.serviceRole = serviceRole;
69 public String getNamingPolicy() {
73 public void setNamingPolicy(String namingPolicy) {
74 this.namingPolicy = namingPolicy;
77 public Boolean getEcompGeneratedNaming() {
78 return ecompGeneratedNaming;
81 public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) {
82 this.ecompGeneratedNaming = ecompGeneratedNaming;
85 public String getServiceFunction() {
86 return serviceFunction;
89 public void setServiceFunction(String serviceFunction) {
90 this.serviceFunction = serviceFunction;
93 public ServiceReqDetails(String serviceName, String category, ArrayList<String> tags, String description,
94 String contactId, String icon, String instantiationType) {
95 this.name = serviceName;
97 this.description = description;
98 this.contactId = contactId;
100 projectCode = "12345";
101 serviceFunction = "serviceFunction name";
102 CategoryDefinition categoryDefinition = new CategoryDefinition();
103 categoryDefinition.setName(category);
104 categoryDefinition.setIcons(Collections.singletonList(icon));
105 categories = new ArrayList<>();
106 categories.add(categoryDefinition);
107 models.add(ModelName.DEFAULT_MODEL_NAME.getName());
110 public ServiceReqDetails(Service service) {
111 this.contactId = service.getContactId();
112 this.categories = service.getCategories();
113 this.creatorUserId = service.getCreatorUserId();
114 this.creatorFullName = service.getCreatorFullName();
115 this.description = service.getDescription();
116 this.icon = service.getIcon();
117 this.name = service.getName();
118 this.projectCode = service.getProjectCode();
119 this.tags = service.getTags();
120 this.uniqueId = service.getUniqueId();
121 this.UUID = service.getUUID();
122 this.version = service.getVersion();
123 this.derivedFromGenericType = service.getDerivedFromGenericType();
124 this.derivedFromGenericVersion = service.getDerivedFromGenericVersion();
125 this.models = Collections.singletonList(service.getModel());
128 public ServiceReqDetails() {
129 contactId = "aa1234";
130 projectCode = "12345";
133 public ServiceReqDetails(ServiceReqDetails a, String newServiceName) {
134 a.setName(newServiceName);
138 public String toString() {
139 return "ServiceDetails [name = " + name + ", category = " + getCategory() + ", tags = " + tags + ", description = "
140 + description + ", contactId = " + contactId + ", icon = " + icon + ", instantiation type = " + getInstantiationType() + "]";
143 public ServiceReqDetails(ServiceReqDetails aService) {
144 this(aService.getName(), aService.getCategory(), (ArrayList<String>) aService.getTags(),
145 aService.getDescription(), aService.getContactId(), aService.getIcon(), aService.getInstantiationType());
146 uniqueId = aService.getUniqueId();
147 version = aService.getVersion();
150 public String getCategory() {
151 if (categories != null && categories.size() >= 1) {
152 return categories.get(0).getName();