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;
29 public class ServiceReqDetails extends ComponentReqDetails {
31 protected String serviceType = "MyServiceType";
32 protected String serviceRole = "MyServiceRole";
33 protected String namingPolicy = "MyServiceNamingPolicy";
34 protected Boolean ecompGeneratedNaming = true;
35 protected String instantiationType = ServiceInstantiationType.A_LA_CARTE.getValue();
37 public String getServiceType() {
41 public void setServiceType(String serviceType) {
42 this.serviceType = serviceType;
45 public String getInstantiationType() {
46 return instantiationType;
49 public String getServiceRole() {
53 public void setServiceRole(String serviceRole) {
54 this.serviceRole = serviceRole;
57 public String getNamingPolicy() {
61 public void setNamingPolicy(String namingPolicy) {
62 this.namingPolicy = namingPolicy;
65 public Boolean getEcompGeneratedNaming() {
66 return ecompGeneratedNaming;
69 public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) {
70 this.ecompGeneratedNaming = ecompGeneratedNaming;
73 public ServiceReqDetails(String serviceName, String category, ArrayList<String> tags, String description,
74 String contactId, String icon, String instantiationType) {
75 this.name = serviceName;
77 this.description = description;
78 this.contactId = contactId;
80 projectCode = "12345";
81 CategoryDefinition categoryDefinition = new CategoryDefinition();
82 categoryDefinition.setName(category);
83 categories = new ArrayList<>();
84 categories.add(categoryDefinition);
88 public ServiceReqDetails(Service service) {
89 this.contactId = service.getContactId();
90 this.categories = service.getCategories();
91 this.creatorUserId = service.getCreatorUserId();
92 this.creatorFullName = service.getCreatorFullName();
93 this.description = service.getDescription();
94 this.icon = service.getIcon();
95 this.name = service.getName();
96 this.projectCode = service.getProjectCode();
97 this.tags = service.getTags();
98 this.uniqueId = service.getUniqueId();
99 this.UUID = service.getUUID();
100 this.version = service.getVersion();
104 public ServiceReqDetails() {
105 contactId = "aa1234";
106 projectCode = "12345";
109 public ServiceReqDetails(ServiceReqDetails a, String newServiceName) {
110 a.setName(newServiceName);
114 public String toString() {
115 return "ServiceDetails [name = " + name + ", category = " + getCategory() + ", tags = " + tags + ", description = "
116 + description + ", contactId = " + contactId + ", icon = " + icon + ", instantiation type = " + getInstantiationType() + "]";
119 public ServiceReqDetails(ServiceReqDetails aService) {
120 this(aService.getName(), aService.getCategory(), (ArrayList<String>) aService.getTags(),
121 aService.getDescription(), aService.getContactId(), aService.getIcon(), aService.getInstantiationType());
122 uniqueId = aService.getUniqueId();
123 version = aService.getVersion();
126 public String getCategory() {
127 if (categories != null && categories.size() >= 1) {
128 return categories.get(0).getName();