summaryrefslogtreecommitdiffstats
path: root/test-apis-ci
diff options
context:
space:
mode:
authorys9693 <ys9693@att.com>2020-01-19 13:50:02 +0200
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-01-22 12:33:31 +0000
commit16a9fce0e104a38371a9e5a567ec611ae3fc7f33 (patch)
tree03a2aff3060ddb5bc26a90115805a04becbaffc9 /test-apis-ci
parentaa83a2da4f911c3ac89318b8e9e8403b072942e1 (diff)
Catalog alignment
Issue-ID: SDC-2724 Signed-off-by: ys9693 <ys9693@att.com> Change-Id: I52b4aacb58cbd432ca0e1ff7ff1f7dd52099c6fe
Diffstat (limited to 'test-apis-ci')
-rw-r--r--test-apis-ci/pom.xml4
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java14
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java2
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java1002
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java4
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java137
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java4
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java12
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/AssetLifeCycle.java44
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetFilteredAssetServlet.java4
10 files changed, 118 insertions, 1109 deletions
diff --git a/test-apis-ci/pom.xml b/test-apis-ci/pom.xml
index 807b59d63b..68e0df0a9d 100644
--- a/test-apis-ci/pom.xml
+++ b/test-apis-ci/pom.xml
@@ -88,14 +88,12 @@
<groupId>org.openecomp.sdc</groupId>
<artifactId>common-app-api</artifactId>
<version>${project.version}</version>
- <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openecomp.sdc.be</groupId>
<artifactId>common-be</artifactId>
<version>${project.version}</version>
- <scope>compile</scope>
</dependency>
<!-- CHECK CATLOG MODEL -->
@@ -103,7 +101,6 @@
<groupId>org.openecomp.sdc.be</groupId>
<artifactId>catalog-model</artifactId>
<version>${project.version}</version>
- <scope>compile</scope>
</dependency>
<!-- catalog dao -->
@@ -111,7 +108,6 @@
<groupId>org.openecomp.sdc.be</groupId>
<artifactId>catalog-dao</artifactId>
<version>${project.version}</version>
- <scope>compile</scope>
</dependency>
<!-- functional java -->
<dependency>
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java
index 76c17f0375..85e7cf6b29 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java
@@ -25,6 +25,7 @@ import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceInstantiationType;
import java.util.ArrayList;
+import java.util.Collections;
public class ServiceReqDetails extends ComponentReqDetails {
@@ -32,7 +33,8 @@ public class ServiceReqDetails extends ComponentReqDetails {
protected String serviceRole = "MyServiceRole";
protected String namingPolicy = "MyServiceNamingPolicy";
protected Boolean ecompGeneratedNaming = true;
- protected String instantiationType = ServiceInstantiationType.A_LA_CARTE.getValue();
+ protected String instantiationType = ServiceInstantiationType.A_LA_CARTE.getValue();
+ protected String serviceFunction = "";
public String getServiceType() {
return serviceType;
@@ -70,6 +72,14 @@ public class ServiceReqDetails extends ComponentReqDetails {
this.ecompGeneratedNaming = ecompGeneratedNaming;
}
+ public String getServiceFunction() {
+ return serviceFunction;
+ }
+
+ public void setServiceFunction(String serviceFunction) {
+ this.serviceFunction = serviceFunction;
+ }
+
public ServiceReqDetails(String serviceName, String category, ArrayList<String> tags, String description,
String contactId, String icon, String instantiationType) {
this.name = serviceName;
@@ -78,8 +88,10 @@ public class ServiceReqDetails extends ComponentReqDetails {
this.contactId = contactId;
this.icon = icon;
projectCode = "12345";
+ serviceFunction = "serviceFunction name";
CategoryDefinition categoryDefinition = new CategoryDefinition();
categoryDefinition.setName(category);
+ categoryDefinition.setIcons(Collections.singletonList(icon));
categories = new ArrayList<>();
categories.add(categoryDefinition);
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java
index bfd64c34f7..7b959d8ddf 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java
@@ -153,7 +153,7 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest {
updatedResourceDetails.setLastUpdaterFullName("Viktor Tzoy");
updatedResourceDetails.setCreationDate(new Long(4444));
updatedResourceDetails.setLastUpdateDate(new Long("534535"));
- updatedResourceDetails.setLifecycleState(LifecycleStateEnum.READY_FOR_CERTIFICATION);
+ updatedResourceDetails.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN);
updatedResourceDetails.setCost("6.1");
updatedResourceDetails.setLicenseType("Installation");
updatedResourceDetails.setUUID("dfsfsdf");
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java
deleted file mode 100644
index 5bb01d5dd6..0000000000
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java
+++ /dev/null
@@ -1,1002 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.ci.tests.execute.service;
-
-import org.junit.Rule;
-import org.junit.rules.TestName;
-import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
-import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
-import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
-import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-import org.openecomp.sdc.ci.tests.utils.DbUtils;
-import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
-import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
-import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
-import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
-import org.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static org.testng.AssertJUnit.*;
-
-public class ChangeServiceDistributionStatusApiTest extends ComponentBaseTest {
-
- protected ResourceReqDetails resourceDetails;
- protected ServiceReqDetails serviceDetails;
- protected User sdncDesignerDetails;
- protected User sdncAdminDetails;
- protected User sdncGovernorDeatails;
- protected User sdncTesterDetails;
- protected User sdncOpsDetails;
- protected ComponentInstanceReqDetails resourceInstanceReqDetails;
- protected Component resourceDetailsVFCcomp;
- protected Component serviceDetailsCompp;
-
- private String userRemarks = "commentTest";
-
- private List<String> variablesAsList;
-
- @Rule
- public static TestName name = new TestName();
-
- public ChangeServiceDistributionStatusApiTest() throws Exception {
- super(name, ChangeServiceDistributionStatusApiTest.class.getName());
-
- }
-
- @BeforeMethod
- public void init() throws Exception {
-
- variablesAsList = new ArrayList<String>();
- sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- sdncAdminDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
- sdncGovernorDeatails = ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR);
- sdncTesterDetails = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
- sdncOpsDetails = ElementFactory.getDefaultUser(UserRoleEnum.OPS);
- resourceDetailsVFCcomp = AtomicOperationUtils
- .createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceDetailsVFCcomp, UserRoleEnum.DESIGNER,
- true, true);
-
- AtomicOperationUtils.changeComponentState(resourceDetailsVFCcomp, UserRoleEnum.DESIGNER,
- LifeCycleStatesEnum.CERTIFY, true);
- Service serviceServ = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVFCcomp, serviceServ,
- UserRoleEnum.DESIGNER, true);
-
- serviceDetails = new ServiceReqDetails(serviceServ);
-
- }
-
- // -----------------------------------------------T E S T
- // S--------------------------------------------//
-
- @Test
- public void approveNotCertifiedService_checkout() throws Exception {
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncAdminDetails, 403, serviceDetails.getVersion());
-
- variablesAsList = Arrays.asList(serviceDetails.getVersion(), serviceDetails.getName());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name(),
- variablesAsList, changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- validateAudit("DApprove", LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- "403", ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, sdncAdminDetails);
- }
-
- @Test
- public void approveNotCertifiedService_checkedin() throws Exception {
- RestResponse checkinResp = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails,
- serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
- assertEquals(200, checkinResp.getErrorCode().intValue());
-
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncAdminDetails, 403, serviceDetails.getVersion());
-
- variablesAsList = Arrays.asList(serviceDetails.getVersion(), serviceDetails.getName());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name(),
- variablesAsList, changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- validateAudit("DApprove", LifecycleStateEnum.NOT_CERTIFIED_CHECKIN,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- "403", ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, sdncAdminDetails);
- }
-
- @Test
- public void approveNotCertifiedService_inProgress() throws Exception {
- RestResponse certReqResp = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails,
- serviceDetails.getVersion(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
- assertEquals(200, certReqResp.getErrorCode().intValue());
-
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncAdminDetails, 403, serviceDetails.getVersion());
-
- variablesAsList = Arrays.asList(serviceDetails.getVersion(), serviceDetails.getName());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name(),
- variablesAsList, changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- // ErrorInfo errorInfo =
- // utils.parseYaml(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name());
- // String auditAction="DApprove";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(serviceDetails,
- // version, sdncAdminDetails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.READY_FOR_CERTIFICATION.name());
- // expectedResourceAuditJavaObject.setDprevStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- // expectedResourceAuditJavaObject.setStatus("403");
- // expectedResourceAuditJavaObject.setDesc(String.format(errorInfo.getMessageId()
- // + ": " + errorInfo.getMessage(), version,
- // serviceDetails.getServiceName()));
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DApprove", LifecycleStateEnum.READY_FOR_CERTIFICATION,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- "403", ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, sdncAdminDetails);
-
- }
-
- @Test
- public void approveNotCertifiedService_readyForCer() throws Exception {
- approveNotCertifiedService_inProgress();
- DbUtils.deleteFromEsDbByPattern("_all");
-
- RestResponse startCertResp = LifecycleRestUtils.changeServiceState(serviceDetails, sdncAdminDetails,
- serviceDetails.getVersion(), LifeCycleStatesEnum.STARTCERTIFICATION);
- assertEquals(200, startCertResp.getErrorCode().intValue());
-
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncAdminDetails, 403, serviceDetails.getVersion());
-
- variablesAsList = Arrays.asList(serviceDetails.getVersion(), serviceDetails.getName());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name(),
- variablesAsList, changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- // ErrorInfo errorInfo =
- // utils.parseYaml(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name());
- // String auditAction="DApprove";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(serviceDetails,
- // version, sdncAdminDetails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.name());
- // expectedResourceAuditJavaObject.setPrevState("");
- // expectedResourceAuditJavaObject.setDprevStatus("");
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- // expectedResourceAuditJavaObject.setStatus("403");
- // expectedResourceAuditJavaObject.setDesc(String.format(errorInfo.getMessageId()
- // + ": " + errorInfo.getMessage(), version,
- // serviceDetails.getServiceName()));
- // expectedResourceAuditJavaObject.setPrevVersion("0.1");
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DApprove", LifecycleStateEnum.CERTIFICATION_IN_PROGRESS,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- "403", ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, sdncAdminDetails);
- }
-
- @Test
- public void rejectNotCertifiedService_checkeout() throws Exception {
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncAdminDetails, 403, serviceDetails.getVersion());
-
- variablesAsList = Arrays.asList(serviceDetails.getVersion(), serviceDetails.getName());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name(),
- variablesAsList, changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- // ErrorInfo errorInfo =
- // utils.parseYaml(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name());
- // String auditAction="DReject";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(serviceDetails,
- // version, sdncAdminDetails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.name());
- // expectedResourceAuditJavaObject.setPrevState("");
- // expectedResourceAuditJavaObject.setDprevStatus("");
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- // expectedResourceAuditJavaObject.setStatus("403");
- // expectedResourceAuditJavaObject.setDesc(String.format(errorInfo.getMessageId()
- // + ": " + errorInfo.getMessage(), version,
- // serviceDetails.getServiceName()));
- // expectedResourceAuditJavaObject.setPrevVersion("0.1");
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DReject", LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- "403", ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, sdncAdminDetails);
- }
-
- @Test
- public void rejectNotCertifiedService_checkedin() throws Exception {
- RestResponse startCertResp = LifecycleRestUtils.changeServiceState(serviceDetails, sdncAdminDetails,
- serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
- assertEquals(200, startCertResp.getErrorCode().intValue());
-
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncAdminDetails, 403, serviceDetails.getVersion());
-
- variablesAsList = Arrays.asList(serviceDetails.getVersion(), serviceDetails.getName());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name(),
- variablesAsList, changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- // ErrorInfo errorInfo =
- // utils.parseYaml(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name());
- // String auditAction="DReject";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(serviceDetails,
- // version, sdncAdminDetails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.name());
- // expectedResourceAuditJavaObject.setPrevState("");
- // expectedResourceAuditJavaObject.setDprevStatus("");
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- // expectedResourceAuditJavaObject.setStatus("403");
- // expectedResourceAuditJavaObject.setDesc(String.format(errorInfo.getMessageId()
- // + ": " + errorInfo.getMessage(), version,
- // serviceDetails.getServiceName()));
- // expectedResourceAuditJavaObject.setPrevVersion("0.1");
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DReject", LifecycleStateEnum.NOT_CERTIFIED_CHECKIN,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- "403", ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, sdncAdminDetails);
- }
-
- @Test
- public void rejectNotCertifiedService_inProgress() throws Exception {
- RestResponse startCertResp = LifecycleRestUtils.changeServiceState(serviceDetails, sdncAdminDetails,
- serviceDetails.getVersion(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
- assertEquals(200, startCertResp.getErrorCode().intValue());
-
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncAdminDetails, 403, serviceDetails.getVersion());
-
- variablesAsList = Arrays.asList(serviceDetails.getVersion(), serviceDetails.getName());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name(),
- variablesAsList, changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- // ErrorInfo errorInfo =
- // utils.parseYaml(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name());
- // String auditAction="DReject";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(serviceDetails,
- // version, sdncAdminDetails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.READY_FOR_CERTIFICATION.name());
- // expectedResourceAuditJavaObject.setPrevState("");
- // expectedResourceAuditJavaObject.setDprevStatus("");
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- // expectedResourceAuditJavaObject.setStatus("403");
- // expectedResourceAuditJavaObject.setDesc(String.format(errorInfo.getMessageId()
- // + ": " + errorInfo.getMessage(), version,
- // serviceDetails.getServiceName()));
- // expectedResourceAuditJavaObject.setPrevVersion("0.1");
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DReject", LifecycleStateEnum.READY_FOR_CERTIFICATION,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- "403", ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, sdncAdminDetails);
- }
-
- @Test
- public void rejectNotCertifiedService_readyForCer() throws Exception {
- rejectNotCertifiedService_inProgress();
- DbUtils.deleteFromEsDbByPattern("_all");
-
- RestResponse startCertResp = LifecycleRestUtils.changeServiceState(serviceDetails, sdncAdminDetails,
- serviceDetails.getVersion(), LifeCycleStatesEnum.STARTCERTIFICATION);
- assertEquals(200, startCertResp.getErrorCode().intValue());
-
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncAdminDetails, 403, serviceDetails.getVersion());
-
- variablesAsList = Arrays.asList(serviceDetails.getVersion(), serviceDetails.getName());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name(),
- variablesAsList, changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- // ErrorInfo errorInfo =
- // utils.parseYaml(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION.name());
- // String auditAction="DReject";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(serviceDetails,
- // version, sdncAdminDetails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.name());
- // expectedResourceAuditJavaObject.setPrevState("");
- // expectedResourceAuditJavaObject.setDprevStatus("");
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- // expectedResourceAuditJavaObject.setStatus("403");
- // expectedResourceAuditJavaObject.setDesc(String.format(errorInfo.getMessageId()
- // + ": " + errorInfo.getMessage(), version,
- // serviceDetails.getServiceName()));
- // expectedResourceAuditJavaObject.setPrevVersion("0.1");
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DReject", LifecycleStateEnum.CERTIFICATION_IN_PROGRESS,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- "403", ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, sdncAdminDetails);
-
- }
-
- @Test
- public void approveCertifiedService_bysdncGovernorDeatails() throws Exception {
-
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncGovernorDeatails, 200, certifyService.getVersion());
- getDistrubtionStatusValue(changeDistStatusAndValidate, DistributionStatusEnum.DISTRIBUTION_APPROVED);
-
- RestResponse getService = ServiceRestUtils.getService(certifyService, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_APPROVED);
-
- validateAudit("DApprove", LifecycleStateEnum.CERTIFIED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- DistributionStatusEnum.DISTRIBUTION_APPROVED, null, null, sdncGovernorDeatails);
- }
-
- @Test
- public void approveCertifiedService_bysdncAdminDetails() throws Exception {
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
-
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncAdminDetails, 200, certifyService.getVersion());
- getDistrubtionStatusValue(changeDistStatusAndValidate, DistributionStatusEnum.DISTRIBUTION_APPROVED);
-
- RestResponse getService = ServiceRestUtils.getService(certifyService, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_APPROVED);
-
- validateAudit("DApprove", LifecycleStateEnum.CERTIFIED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- DistributionStatusEnum.DISTRIBUTION_APPROVED, null, null, sdncAdminDetails);
- }
-
- @Test
- public void approveCertifiedService_byDesigner() throws Exception {
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
-
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncDesignerDetails, 409, certifyService.getVersion());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(certifyService, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- // ErrorInfo errorInfo =
- // utils.parseYaml(ActionStatus.RESTRICTED_OPERATION.name());
- // String auditAction="DApprove";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(certifyService,
- // certifyService.getVersion(), sdncDesignerDetails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFIED.name());
- // expectedResourceAuditJavaObject.setDprevStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setStatus("409");
- // expectedResourceAuditJavaObject.setDesc(errorInfo.getMessageId() + ":
- // " + errorInfo.getMessage());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DApprove", LifecycleStateEnum.CERTIFIED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, "409", ActionStatus.RESTRICTED_OPERATION,
- sdncDesignerDetails);
- }
-
- @Test
- public void approveCertifiedService_byTester() throws Exception {
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncTesterDetails, 409, certifyService.getVersion());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(certifyService, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- // ErrorInfo errorInfo =
- // utils.parseYaml(ActionStatus.RESTRICTED_OPERATION.name());
- // String auditAction="DApprove";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(certifyService,
- // certifyService.getVersion(), sdncTesterDetails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFIED.name());
- // expectedResourceAuditJavaObject.setDprevStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setStatus("409");
- // expectedResourceAuditJavaObject.setDesc(errorInfo.getMessageId() + ":
- // " + errorInfo.getMessage());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DApprove", LifecycleStateEnum.CERTIFIED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, "409", ActionStatus.RESTRICTED_OPERATION,
- sdncTesterDetails);
- }
-
- @Test
- public void approveCertifiedService_byOps() throws Exception {
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncOpsDetails, 409, certifyService.getVersion());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(certifyService, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- validateAudit("DApprove", LifecycleStateEnum.CERTIFIED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, "409", ActionStatus.RESTRICTED_OPERATION,
- sdncOpsDetails);
-
- }
-
- @Test
- public void rejectCertifiedService_bysdncGovernorDeatails() throws Exception {
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncGovernorDeatails, 200, certifyService.getVersion());
- getDistrubtionStatusValue(changeDistStatusAndValidate, DistributionStatusEnum.DISTRIBUTION_REJECTED);
-
- RestResponse getService = ServiceRestUtils.getService(certifyService, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_REJECTED);
-
- // String auditAction="DReject";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(certifyService,
- // certifyService.getVersion(), sdncGovernorDeatails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFIED.name());
- // expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.name());
- // expectedResourceAuditJavaObject.setDprevStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_REJECTED.name());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- // expectedResourceAuditJavaObject.setPrevVersion("0.1");
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DReject", LifecycleStateEnum.CERTIFIED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- DistributionStatusEnum.DISTRIBUTION_REJECTED, null, null, sdncGovernorDeatails);
-
- }
-
- @Test
- public void rejectCertifiedService_bysdncAdminDetails() throws Exception {
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncAdminDetails, 200, certifyService.getVersion());
- getDistrubtionStatusValue(changeDistStatusAndValidate, DistributionStatusEnum.DISTRIBUTION_REJECTED);
-
- RestResponse getService = ServiceRestUtils.getService(certifyService, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_REJECTED);
-
- // String auditAction="DReject";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(certifyService,
- // certifyService.getVersion(), sdncAdminDetails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFIED.name());
- // expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.name());
- // expectedResourceAuditJavaObject.setDprevStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_REJECTED.name());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- // expectedResourceAuditJavaObject.setPrevVersion("0.1");
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DReject", LifecycleStateEnum.CERTIFIED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- DistributionStatusEnum.DISTRIBUTION_REJECTED, null, null, sdncAdminDetails);
- }
-
- @Test
- public void rejectCertifiedService_byDesigner() throws Exception {
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncDesignerDetails, 409, certifyService.getVersion());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(certifyService, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- // ErrorInfo errorInfo =
- // utils.parseYaml(ActionStatus.RESTRICTED_OPERATION.name());
- // String auditAction="DReject";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(certifyService,
- // certifyService.getVersion(), sdncDesignerDetails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFIED.name());
- // expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.name());
- // expectedResourceAuditJavaObject.setDprevStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setStatus("409");
- // expectedResourceAuditJavaObject.setDesc(errorInfo.getMessageId() + ":
- // " + errorInfo.getMessage());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- // expectedResourceAuditJavaObject.setPrevVersion("0.1");
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DReject", LifecycleStateEnum.CERTIFIED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, "409", ActionStatus.RESTRICTED_OPERATION,
- sdncDesignerDetails);
- }
-
- @Test
- public void rejectCertifiedService_byTester() throws Exception {
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncTesterDetails, 409, certifyService.getVersion());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(certifyService, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- // ErrorInfo errorInfo =
- // utils.parseYaml(ActionStatus.RESTRICTED_OPERATION.name());
- // String auditAction="DReject";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(certifyService,
- // certifyService.getVersion(), sdncTesterDetails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFIED.name());
- // expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.name());
- // expectedResourceAuditJavaObject.setDprevStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setStatus("409");
- // expectedResourceAuditJavaObject.setDesc(errorInfo.getMessageId() + ":
- // " + errorInfo.getMessage());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- // expectedResourceAuditJavaObject.setPrevVersion("0.1");
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DReject", LifecycleStateEnum.CERTIFIED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, "409", ActionStatus.RESTRICTED_OPERATION,
- sdncTesterDetails);
- }
-
- @Test
- public void rejectCertifiedService_byOps() throws Exception {
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncOpsDetails, 409, certifyService.getVersion());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(certifyService, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- // ErrorInfo errorInfo =
- // utils.parseYaml(ActionStatus.RESTRICTED_OPERATION.name());
- // String auditAction="DReject";
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(certifyService,
- // certifyService.getVersion(), sdncOpsDetails);
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.CERTIFIED.name());
- // expectedResourceAuditJavaObject.setPrevState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.name());
- // expectedResourceAuditJavaObject.setDprevStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setDcurrStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED.name());
- // expectedResourceAuditJavaObject.setStatus("409");
- // expectedResourceAuditJavaObject.setDesc(errorInfo.getMessageId() + ":
- // " + errorInfo.getMessage());
- // expectedResourceAuditJavaObject.setComment(userRemarks);
- // expectedResourceAuditJavaObject.setPrevVersion("0.1");
- //
- // AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject,
- // auditAction);
-
- validateAudit("DReject", LifecycleStateEnum.CERTIFIED, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED,
- DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED, "409", ActionStatus.RESTRICTED_OPERATION,
- sdncOpsDetails);
- }
-
- @Test
- public void approveServiceNotFound() throws Exception {
- String previuosId = serviceDetails.getUniqueId();
- serviceDetails.setUniqueId("dummyId");
-
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncAdminDetails, 404, serviceDetails.getVersion());
- serviceDetails.setUniqueId(previuosId);
-
- variablesAsList = Arrays.asList("dummyId");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), variablesAsList,
- changeDistStatusAndValidate.getResponse());
-
- }
-
- @Test
- public void rejectServiceNotFound() throws Exception {
- String previuosId = serviceDetails.getUniqueId();
- serviceDetails.setUniqueId("dummyId");
-
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncAdminDetails, 404, serviceDetails.getVersion());
- serviceDetails.setUniqueId(previuosId);
-
- variablesAsList = Arrays.asList("dummyId");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), variablesAsList,
- changeDistStatusAndValidate.getResponse());
-
- }
-
- @Test
- public void rejectService_emptyComment() throws Exception {
- userRemarks = "";
-
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncAdminDetails, 400, certifyService.getVersion());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_CONTENT.name(), new ArrayList<String>(),
- changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- }
-
- @Test
- public void rejectService_nullComment() throws Exception {
- userRemarks = null;
-
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncAdminDetails, 400, certifyService.getVersion());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_CONTENT.name(), new ArrayList<String>(),
- changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
- }
-
- @Test
- public void rejectService_spaceComment() throws Exception {
- userRemarks = " ";
-
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncAdminDetails, 400, certifyService.getVersion());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_CONTENT.name(), new ArrayList<String>(),
- changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- }
-
- @Test
- public void approveService_emptyComment() throws Exception {
- userRemarks = "";
-
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncAdminDetails, 400, certifyService.getVersion());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_CONTENT.name(), new ArrayList<String>(),
- changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- }
-
- @Test
- public void approveService_nullComment() throws Exception {
- userRemarks = null;
-
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncAdminDetails, 400, certifyService.getVersion());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_CONTENT.name(), new ArrayList<String>(),
- changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- }
-
- @Test
- public void approveService_spaceComment() throws Exception {
- userRemarks = " ";
-
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse changeDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncAdminDetails, 400, certifyService.getVersion());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_CONTENT.name(), new ArrayList<String>(),
- changeDistStatusAndValidate.getResponse());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
-
- }
-
- @Test
- public void distributionStatusChange_approve_Reject_AprroveBysdncAdminDetails() throws Exception {
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
-
- RestResponse approveDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncGovernorDeatails, 200, certifyService.getVersion());
- getDistrubtionStatusValue(approveDistStatusAndValidate, DistributionStatusEnum.DISTRIBUTION_APPROVED);
-
- DbUtils.deleteFromEsDbByPattern("_all");
- RestResponse rejectDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_REJECTED, sdncGovernorDeatails, 200, certifyService.getVersion());
- getDistrubtionStatusValue(rejectDistStatusAndValidate, DistributionStatusEnum.DISTRIBUTION_REJECTED);
-
- validateAudit("DReject", LifecycleStateEnum.CERTIFIED, DistributionStatusEnum.DISTRIBUTION_APPROVED,
- DistributionStatusEnum.DISTRIBUTION_REJECTED, null, null, sdncGovernorDeatails);
-
- DbUtils.deleteFromEsDbByPattern("_all");
- RestResponse secondApproveDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncAdminDetails, 200, certifyService.getVersion());
- getDistrubtionStatusValue(secondApproveDistStatusAndValidate, DistributionStatusEnum.DISTRIBUTION_APPROVED);
-
- validateAudit("DApprove", LifecycleStateEnum.CERTIFIED, DistributionStatusEnum.DISTRIBUTION_REJECTED,
- DistributionStatusEnum.DISTRIBUTION_APPROVED, null, null, sdncAdminDetails);
-
- }
-
- @Test
- public void distributeNotCertifiedServiceTest() throws Exception {
- RestResponse approveDistStatusAndValidate = changeDistStatusAndValidate(DistributionStatusEnum.DISTRIBUTED,
- sdncGovernorDeatails, 200, serviceDetails.getVersion());
-
- RestResponse getService = ServiceRestUtils.getService(serviceDetails, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTED);
-
- }
-
- @Test
- public void distributeCertifiedServiceTest() throws Exception {
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse approveDistStatusAndValidate = changeDistStatusAndValidate(DistributionStatusEnum.DISTRIBUTED,
- sdncGovernorDeatails, 200, certifyService.getVersion());
-
- RestResponse getService = ServiceRestUtils.getService(certifyService, sdncDesignerDetails);
- getDistrubtionStatusValue(getService, DistributionStatusEnum.DISTRIBUTED);
-
- }
-
- @Test
- public void approveCheckedoutCertifiedServiceTest() throws Exception {
- RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser
- .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
- ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
- RestResponse approveDistStatusAndValidate = changeDistStatusAndValidate(
- DistributionStatusEnum.DISTRIBUTION_APPROVED, sdncGovernorDeatails, 200, certifyService.getVersion());
- getDistrubtionStatusValue(approveDistStatusAndValidate, DistributionStatusEnum.DISTRIBUTION_APPROVED);
-
- RestResponse checkoutResp = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails,
- serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKOUT);
- assertEquals(200, checkoutResp.getErrorCode().intValue());
- // Utils r = new Utils();
-
- String distributionStatus = ResponseParser.getValueFromJsonResponse(checkoutResp.getResponse(),
- "distributionStatus");
- // Utils r1 = new Utils();
- String lifecycleState = ResponseParser.getValueFromJsonResponse(checkoutResp.getResponse(), "lifecycleState");
-
- assertTrue("NOT_CERTIFIED_CHECKOUT".equals(lifecycleState));
- assertTrue("DISTRIBUTION_NOT_APPROVED".equals(distributionStatus));
- }
-
- private RestResponse changeDistStatusAndValidate(DistributionStatusEnum distStatus, User user, int errorCode,
- String serviceVersion) throws Exception {
- RestResponse distributionResponse = LifecycleRestUtils.changeDistributionStatus(serviceDetails, serviceVersion,
- user, userRemarks, distStatus);
- assertNotNull(distributionResponse);
- assertNotNull(distributionResponse.getErrorCode());
- assertEquals(errorCode, distributionResponse.getErrorCode().intValue());
-
- if (userRemarks == " " || userRemarks == null) {
- userRemarks = "";
- }
-
- return distributionResponse;
- }
-
- private void getDistrubtionStatusValue(RestResponse response, DistributionStatusEnum expectedDistributionValue)
- throws Exception {
- String actualDistributionValue = ResponseParser.getValueFromJsonResponse(response.getResponse(),
- "distributionStatus");
- assertEquals(expectedDistributionValue.name(), actualDistributionValue);
- }
-
- private void validateAudit(String Action, LifecycleStateEnum currState, DistributionStatusEnum dPrevStatus,
- DistributionStatusEnum dCurrStatus, String status, ActionStatus errorInfoFromFile, User user)
- throws Exception {
-
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ServiceValidationUtils
- .constructFieldsForAuditValidation(serviceDetails, serviceDetails.getVersion(), user);
- expectedResourceAuditJavaObject.setAction(Action);
- expectedResourceAuditJavaObject.setResourceType("Service");
- expectedResourceAuditJavaObject.setCurrState(currState.name());
- expectedResourceAuditJavaObject.setDprevStatus(dPrevStatus.name());
- expectedResourceAuditJavaObject.setDcurrStatus(dCurrStatus.name());
- expectedResourceAuditJavaObject.setComment(userRemarks);
- expectedResourceAuditJavaObject.setDesc("OK");
-
- if (errorInfoFromFile != null) {
- ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(errorInfoFromFile.name());
- expectedResourceAuditJavaObject
- .setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variablesAsList));
- }
-
- if (status != null)
- expectedResourceAuditJavaObject.setStatus(status);
-
- if (currState != LifecycleStateEnum.CERTIFIED) {
- expectedResourceAuditJavaObject.setModifierName("");
- }
-
- AuditValidationUtils.validateAuditDistribution(expectedResourceAuditJavaObject, Action);
- }
-
- // private ServiceReqDetails certifyService() throws Exception
- // {
- // ServiceReqDetails certifyService =
- // LifecycleRestUtils.certifyService(serviceDetails,
- // serviceDetails.getVersion(), sdncAdminDetails);
- //// version = certifyService.getVersion();
- //
- // return certifyService;
- // }
-
-}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java
index 5a56af5d4c..c5a55614d9 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java
@@ -174,7 +174,7 @@ public class GovernorWorkspaceApiTest extends ComponentBaseTest {
throws Exception {
RestResponse res = LifecycleRestUtils.sendApproveDistribution(user, serviceDetails.getUniqueId(), userRemarks);
assertEquals(200, res.getErrorCode().intValue());
- ServiceValidationUtils.validateDistrubtionStatusValue(res, DistributionStatusEnum.DISTRIBUTION_APPROVED);
+ ServiceValidationUtils.validateDistrubtionStatusValue(res, DistributionStatusEnum.DISTRIBUTED);
}
protected void rejectDistributionStatusOfService(ServiceReqDetails serviceDetails, User user) throws Exception {
@@ -185,7 +185,7 @@ public class GovernorWorkspaceApiTest extends ComponentBaseTest {
throws Exception {
RestResponse res = LifecycleRestUtils.rejectDistribution(serviceDetails, version, user, userRemarks);
assertEquals(200, res.getErrorCode().intValue());
- ServiceValidationUtils.validateDistrubtionStatusValue(res, DistributionStatusEnum.DISTRIBUTION_REJECTED);
+ ServiceValidationUtils.validateDistrubtionStatusValue(res, DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
}
protected JSONArray getFollowedListAsJsonArray(User user) throws Exception {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
index 43c93e47a6..f0efd96079 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
@@ -64,7 +64,9 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import static org.junit.Assert.assertFalse;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
@@ -308,13 +310,13 @@ public final class AtomicOperationUtils {
// *********** LIFECYCLE ***************
- public static Pair<Component, RestResponse> changeComponentState(Component component, UserRoleEnum userRole, LifeCycleStatesEnum targetState, Boolean validateState) throws Exception {
+ public static Pair<Component, RestResponse> changeComponentState(Component component, UserRoleEnum userRole, LifeCycleStatesEnum targetState, Boolean validateState) throws Exception {
- Boolean isValidationFailed = false;
- RestResponse lifeCycleStatesResponse = null;
- User defaultUser;
+ Boolean isValidationFailed = false;
+ RestResponse lifeCycleStatesResponse = null;
+ User defaultUser;
- LifeCycleStatesEnum currentCompState = LifeCycleStatesEnum.findByCompState(component.getLifecycleState().toString());
+ LifeCycleStatesEnum currentCompState = LifeCycleStatesEnum.findByCompState(component.getLifecycleState().toString());
if (currentCompState == targetState) {
component = getComponentObject(component, userRole);
@@ -325,30 +327,17 @@ public final class AtomicOperationUtils {
if (currentCompState.equals(LifeCycleStatesEnum.CHECKIN) && targetState.equals(LifeCycleStatesEnum.CHECKOUT)) {
lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKIN.toString());
lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKOUT.toString());
-// TODO Andrey added component type condition
} else {
- if (componentType.equals("Resource")) {
- lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKOUT.toString());
- lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKIN.toString());
- lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CERTIFY.toString());
- } else {
- lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKOUT.toString());
- lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKIN.toString());
- lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CERTIFICATIONREQUEST.toString());
- lifeCycleStatesEnumList.add(LifeCycleStatesEnum.STARTCERTIFICATION.toString());
- lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CERTIFY.toString());
- }
+ lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKOUT.toString());
+ lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CHECKIN.toString());
+ lifeCycleStatesEnumList.add(LifeCycleStatesEnum.CERTIFY.toString());
}
for (int i = 0; i < lifeCycleStatesEnumList.size(); i++) {
if (lifeCycleStatesEnumList.get(i).equals(currentCompState.name())) {
int a;
a = (i == lifeCycleStatesEnumList.size() - 1) ? 0 : i + 1;
for (int n = a; n < lifeCycleStatesEnumList.size(); n++) {
- if ((lifeCycleStatesEnumList.get(n).equals(LifeCycleStatesEnum.STARTCERTIFICATION.name()) || lifeCycleStatesEnumList.get(n).equals(LifeCycleStatesEnum.CERTIFY.name())) && !componentType.equals("Resource")) {
- defaultUser = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
- } else {
- defaultUser = ElementFactory.getDefaultUser(userRole);
- }
+ defaultUser = ElementFactory.getDefaultUser(userRole);
lifeCycleStatesResponse = LifecycleRestUtils.changeComponentState(component, defaultUser, LifeCycleStatesEnum.findByState(lifeCycleStatesEnumList.get(n)));
if (lifeCycleStatesResponse.getErrorCode() != LifecycleRestUtils.STATUS_CODE_SUCCESS)
isValidationFailed = true;
@@ -362,7 +351,6 @@ public final class AtomicOperationUtils {
if (validateState && isValidationFailed) {
assertTrue("change state to [" + targetState.getState() + "] failed" + lifeCycleStatesResponse.getResponse(), false);
-
return Pair.of(componentJavaObject, lifeCycleStatesResponse);
}
@@ -383,7 +371,7 @@ public final class AtomicOperationUtils {
ServiceReqDetails serviceDetails = new ServiceReqDetails(service);
RestResponse distributionService = null;
- RestResponse approveDistribution = LifecycleRestUtils.changeDistributionStatus(serviceDetails, null, governotUser, "approveService", DistributionStatusEnum.DISTRIBUTION_APPROVED);
+ RestResponse approveDistribution = LifecycleRestUtils.changeDistributionStatus(serviceDetails, null, governotUser, "approveService", DistributionStatusEnum.DISTRIBUTED);
if (approveDistribution.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS) {
distributionService = LifecycleRestUtils.changeDistributionStatus(serviceDetails, null, opsUser, "approveService", DistributionStatusEnum.DISTRIBUTED);
}
@@ -442,31 +430,39 @@ public final class AtomicOperationUtils {
return addComponentInstanceToComponentContainer(compInstParent, compContainer, UserRoleEnum.DESIGNER, false);
}
- public static Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer(Component compInstParent, Component compContainer, UserRoleEnum userRole, Boolean validateState) {
- try {
- User defaultUser = ElementFactory.getDefaultUser(userRole);
- ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(compInstParent);
- RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, defaultUser, compContainer);
-
- if (validateState) {
- if (createComponentInstance.getErrorCode() == ServiceRestUtils.STATUS_CODE_NOT_FOUND)
- {
- throw new SkipException("Open bug DE262001");
- }
- else{
- assertTrue("error - " + createComponentInstance.getErrorCode() + "instead - " + ServiceRestUtils.STATUS_CODE_CREATED, createComponentInstance.getErrorCode() == ServiceRestUtils.STATUS_CODE_CREATED);
- }
- }
-
- if (createComponentInstance.getErrorCode() == ResourceRestUtils.STATUS_CODE_CREATED) {
- ComponentInstance componentInstance = ResponseParser.convertComponentInstanceResponseToJavaObject(createComponentInstance.getResponse());
- return Either.left(componentInstance);
- }
- return Either.right(createComponentInstance);
- } catch (Exception e) {
- throw new AtomicOperationException(e);
- }
- }
+ public static Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer(Component compInstParent,
+ Component compContainer,
+ UserRoleEnum userRole,
+ Boolean validateState) {
+ try {
+ User defaultUser = ElementFactory.getDefaultUser(userRole);
+ ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(compInstParent);
+ if (componentInstanceDetails.getOriginType() == null){
+ componentInstanceDetails.setOriginType(((Resource) compInstParent).getResourceType().toString());
+ }
+ RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails,
+ defaultUser, compContainer);
+
+ if (validateState) {
+ if (createComponentInstance.getErrorCode() == ServiceRestUtils.STATUS_CODE_NOT_FOUND) {
+ throw new SkipException("Open bug DE262001");
+ } else {
+ assertTrue("error - " + createComponentInstance.getErrorCode() + "instead - " +
+ ServiceRestUtils.STATUS_CODE_CREATED,
+ createComponentInstance.getErrorCode() == ServiceRestUtils.STATUS_CODE_CREATED);
+ }
+ }
+
+ if (createComponentInstance.getErrorCode() == ResourceRestUtils.STATUS_CODE_CREATED) {
+ ComponentInstance componentInstance = ResponseParser
+ .convertComponentInstanceResponseToJavaObject(createComponentInstance.getResponse());
+ return Either.left(componentInstance);
+ }
+ return Either.right(createComponentInstance);
+ } catch (Exception e) {
+ throw new AtomicOperationException(e);
+ }
+ }
public static Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer(Component compInstParent, Component compContainer, UserRoleEnum userRole, Boolean validateState, String positionX, String positionY) {
try {
@@ -607,6 +603,26 @@ public final class AtomicOperationUtils {
}
+ public static Either<Pair<Component, ComponentInstance>, RestResponse> updateComponentInstance(ComponentInstanceReqDetails componentInstanceReqDetails, User sdncModifierDetails, Component container, boolean validateState) throws Exception {
+
+ RestResponse updateComponentInstance = ComponentInstanceRestUtils.updateComponentInstance(componentInstanceReqDetails, sdncModifierDetails, container.getUniqueId(), container.getComponentType());
+ if (validateState) {
+ assertTrue("Update ComponentInstance failed: " + updateComponentInstance.getResponseMessage(), updateComponentInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+ if (updateComponentInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS) {
+ String componentType = container.getComponentType().getValue();
+ Component componentObject;
+ if(componentType.equals("Resource")){
+ componentObject = getResourceObject(container.getUniqueId());
+ }else{
+ componentObject = getServiceObject(container.getUniqueId());
+ }
+ ComponentInstance componentInstanceJavaObject = ResponseParser.convertComponentInstanceResponseToJavaObject(updateComponentInstance.getResponse());
+ return Either.left(Pair.of(componentObject, componentInstanceJavaObject));
+ }
+ return Either.right(updateComponentInstance);
+ }
+
public static Either<Pair<Component, ComponentInstance>, RestResponse> changeComponentInstanceVersion(Component containerDetails, ComponentInstance componentInstanceToReplace, Component newInstance, UserRoleEnum userRole, Boolean validateState)
throws Exception {
User defaultUser = ElementFactory.getDefaultUser(userRole);
@@ -627,6 +643,20 @@ public final class AtomicOperationUtils {
return Either.right(changeComponentInstanceVersionResp);
}
+ public static ComponentInstance getComponentInstanceByName(Component component, String name) {
+ ComponentInstance componentInstance = component.getComponentInstances()
+ .stream()
+ .filter(ci->ci.getName().equals(name))
+ .findFirst()
+ .orElse(null);
+ if (componentInstance == null) {
+ List<String> componentInstancesNameList = component.getComponentInstances().stream().map(ComponentInstance::getName).collect(Collectors.toList());
+ assertFalse("Instance name " + name + " not found in container " + component.getComponentType() + " named [" + component.getName()
+ + "]. Component instances available are: " + componentInstancesNameList.toString(), true);
+ }
+ return componentInstance;
+ }
+
// *********** PROPERTIES *****************
public static Either<ComponentInstanceProperty, RestResponse> addCustomPropertyToResource(PropertyReqDetails propDetails, Resource resourceDetails, UserRoleEnum userRole, Boolean validateState) throws Exception {
@@ -1016,4 +1046,13 @@ public final class AtomicOperationUtils {
return null;
}
+ public static Pair<Component, ComponentInstance> updateComponentInstanceName(String newName, Component component, String canvasElementName, User user, Boolean validateState) throws Exception {
+ ComponentInstanceReqDetails componentInstanceReqDetails = ElementFactory.getDefaultComponentInstance();
+ ComponentInstance componentInstanceByName = AtomicOperationUtils.getComponentInstanceByName(component, canvasElementName);
+ componentInstanceReqDetails.setName(newName);
+ componentInstanceReqDetails.setComponentUid(componentInstanceByName.getComponentUid());
+ componentInstanceReqDetails.setUniqueId(componentInstanceByName.getUniqueId());
+ return AtomicOperationUtils.updateComponentInstance(componentInstanceReqDetails, user, component, validateState).left().value();
+ }
+
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java
index 44e7b56426..72cad8c3ca 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java
@@ -374,13 +374,9 @@ public class LifecycleRestUtils extends BaseRestUtils {
// String environmentName = ConfigurationManager.getConfigurationManager().getDistributionEngineConfiguration().getEnvironments().get(0);
DistributionStatusEnum distributionStatusEnum = DistributionStatusEnum.findState(reqDistributionStatus.getValue());
switch(distributionStatusEnum){
- case DISTRIBUTION_APPROVED:
- return sendApproveDistribution(user, uniqueId, userRemarks);
case DISTRIBUTED:
String url = String.format(Urls.ACTIVATE_DISTRIBUTION, config.getCatalogBeHost(), config.getCatalogBePort(), uniqueId, environmentName);
return sendDistrState(user, userRemarks, url);
- case DISTRIBUTION_REJECTED:
- return rejectDistribution(user, userRemarks, uniqueId);
default:
return null;
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java
index 9bfcfcf962..62d491a3b1 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java
@@ -26,7 +26,7 @@ import com.google.gson.JsonParser;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.resources.data.ESArtifactData;
+import org.openecomp.sdc.be.resources.data.DAOArtifactData;
import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
@@ -106,14 +106,14 @@ public class ArtifactValidationUtils {
counter);
}
- public static ESArtifactData parseArtifactRespFromES(RestResponse resResponse) throws Exception {
+ public static DAOArtifactData parseArtifactRespFromES(RestResponse resResponse) throws Exception {
String bodyToParse = resResponse.getResponse();
JsonElement jElement = new JsonParser().parse(bodyToParse);
JsonElement jsourceElement = jElement.getAsJsonObject().get("_source");
ObjectMapper mapper = new ObjectMapper();
- return mapper.readValue(jsourceElement.toString(), ESArtifactData.class);
+ return mapper.readValue(jsourceElement.toString(), DAOArtifactData.class);
}
@@ -174,13 +174,13 @@ public class ArtifactValidationUtils {
}
public static void validateEsArtifactReqVsResp(ArtifactReqDetails expectedArtifactInfo,
- ESArtifactData esArtifactData) throws Exception {
+ DAOArtifactData DAOArtifactData) throws Exception {
String expectedArtifactUid = expectedArtifactInfo.getUniqueId();
if (expectedArtifactUid == null)
expectedArtifactUid = "";
- assertEquals("artifact name is not correct ", expectedArtifactUid, esArtifactData.getId());
+ assertEquals("artifact name is not correct ", expectedArtifactUid, DAOArtifactData.getId());
- String actualPayload = Decoder.encode(esArtifactData.getData().array());
+ String actualPayload = Decoder.encode(DAOArtifactData.getData().array());
assertEquals("artifact payloadData is not correct ", expectedArtifactInfo.getPayload(), actualPayload);
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/AssetLifeCycle.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/AssetLifeCycle.java
index abfa37b711..427d3774c1 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/AssetLifeCycle.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/AssetLifeCycle.java
@@ -444,26 +444,10 @@ public class AssetLifeCycle extends ComponentBaseTest {
@DataProvider(name="invalidStatesForService")
public static Object[][] dataProviderInvalidStatesForService() {
return new Object[][] {
- {LifeCycleStatesEnum.CHECKIN, LifeCycleStatesEnum.CHECKIN, COMPONENT_ALREADY_CHECKED_IN, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, "409", ActionStatus.COMPONENT_ALREADY_CHECKED_IN, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), null},
- {LifeCycleStatesEnum.CHECKIN, LifeCycleStatesEnum.STARTCERTIFICATION, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
- {LifeCycleStatesEnum.CHECKIN, LifeCycleStatesEnum.CERTIFY, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
-
- {LifeCycleStatesEnum.CHECKOUT, LifeCycleStatesEnum.CHECKOUT, COMPONENT_IN_CHECKOUT_STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, "403", ActionStatus.COMPONENT_IN_CHECKOUT_STATE, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), null},
- {LifeCycleStatesEnum.CHECKOUT, LifeCycleStatesEnum.STARTCERTIFICATION, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
- {LifeCycleStatesEnum.CHECKOUT, LifeCycleStatesEnum.CERTIFY, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
-
- {LifeCycleStatesEnum.CERTIFICATIONREQUEST, LifeCycleStatesEnum.CERTIFICATIONREQUEST, COMPONENT_SENT_FOR_CERTIFICATION, LifecycleStateEnum.READY_FOR_CERTIFICATION, LifecycleStateEnum.READY_FOR_CERTIFICATION, "403", ActionStatus.COMPONENT_SENT_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), null},
- {LifeCycleStatesEnum.CERTIFICATIONREQUEST, LifeCycleStatesEnum.CERTIFY, RESTRICTED_OPERATION, LifecycleStateEnum.READY_FOR_CERTIFICATION, LifecycleStateEnum.READY_FOR_CERTIFICATION, "409", ActionStatus.RESTRICTED_OPERATION, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), null},
-
- {LifeCycleStatesEnum.STARTCERTIFICATION, LifeCycleStatesEnum.CHECKIN, COMPONENT_IN_CERT_IN_PROGRESS_STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, "403", ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ElementFactory.getDefaultUser(UserRoleEnum.TESTER)},
- {LifeCycleStatesEnum.STARTCERTIFICATION, LifeCycleStatesEnum.CHECKOUT, COMPONENT_IN_CERT_IN_PROGRESS_STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, "403", ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ElementFactory.getDefaultUser(UserRoleEnum.TESTER)},
- {LifeCycleStatesEnum.STARTCERTIFICATION, LifeCycleStatesEnum.CERTIFICATIONREQUEST, COMPONENT_IN_CERT_IN_PROGRESS_STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, "403", ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ElementFactory.getDefaultUser(UserRoleEnum.TESTER)},
- {LifeCycleStatesEnum.STARTCERTIFICATION, LifeCycleStatesEnum.STARTCERTIFICATION, COMPONENT_IN_CERT_IN_PROGRESS_STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS, "403", ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
-
- {LifeCycleStatesEnum.CERTIFY, LifeCycleStatesEnum.CHECKIN, COMPONENT_ALREADY_CERTIFIED, LifecycleStateEnum.CERTIFIED, LifecycleStateEnum.CERTIFIED, "403", ActionStatus.COMPONENT_ALREADY_CERTIFIED, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ElementFactory.getDefaultUser(UserRoleEnum.TESTER)},
- {LifeCycleStatesEnum.CERTIFY, LifeCycleStatesEnum.CERTIFICATIONREQUEST, COMPONENT_ALREADY_CERTIFIED, LifecycleStateEnum.CERTIFIED, LifecycleStateEnum.CERTIFIED, "403", ActionStatus.COMPONENT_ALREADY_CERTIFIED, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ElementFactory.getDefaultUser(UserRoleEnum.TESTER)},
- {LifeCycleStatesEnum.CERTIFY, LifeCycleStatesEnum.STARTCERTIFICATION, COMPONENT_ALREADY_CERTIFIED, LifecycleStateEnum.CERTIFIED, LifecycleStateEnum.CERTIFIED, "403", ActionStatus.COMPONENT_ALREADY_CERTIFIED, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
- {LifeCycleStatesEnum.CERTIFY, LifeCycleStatesEnum.CERTIFY, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.CERTIFIED, LifecycleStateEnum.CERTIFIED, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), null},
+ {LifeCycleStatesEnum.CHECKIN, LifeCycleStatesEnum.CHECKIN, COMPONENT_ALREADY_CHECKED_IN, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN, "409", ActionStatus.COMPONENT_ALREADY_CHECKED_IN, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), null},
+ {LifeCycleStatesEnum.CHECKOUT, LifeCycleStatesEnum.CHECKOUT, COMPONENT_IN_CHECKOUT_STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, "403", ActionStatus.COMPONENT_IN_CHECKOUT_STATE, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), null},
+ {LifeCycleStatesEnum.CERTIFY, LifeCycleStatesEnum.CHECKIN, COMPONENT_ALREADY_CERTIFIED, LifecycleStateEnum.CERTIFIED, LifecycleStateEnum.CERTIFIED, "403", ActionStatus.COMPONENT_ALREADY_CERTIFIED, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)},
+ {LifeCycleStatesEnum.CERTIFY, LifeCycleStatesEnum.CERTIFY, COMPONENT_NOT_READY_FOR_CERTIFICATION, LifecycleStateEnum.CERTIFIED, LifecycleStateEnum.CERTIFIED, "403", ActionStatus.COMPONENT_NOT_READY_FOR_CERTIFICATION, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), null},
};
}
@@ -472,11 +456,7 @@ public class AssetLifeCycle extends ComponentBaseTest {
public void invalidStatesForService(LifeCycleStatesEnum initState, LifeCycleStatesEnum targetState, int errorCode,
LifecycleStateEnum preState, LifecycleStateEnum currState, String status,
ActionStatus actionStatus, User user, User operationUser) throws Exception {
-
- if(initState.equals(LifeCycleStatesEnum.STARTCERTIFICATION) && targetState.equals(LifeCycleStatesEnum.CHECKIN)){
- throw new SkipException("Open bug DE270217 or TDP number: 154592");
- }
-
+
getExtendTest().log(Status.INFO, String.format("initState: %s, targetState: %s, errorCode: %s,"
+ " preState: %s, currState: %s, status: %s, actionStatus: %s, user: %s, operationUser: %s", initState, targetState, errorCode, preState,
currState, status, actionStatus, user, operationUser));
@@ -493,10 +473,6 @@ public class AssetLifeCycle extends ComponentBaseTest {
restResponse = LifecycleRestUtils.checkOutService(service.getUUID(), user);
} else if(targetState.equals(LifeCycleStatesEnum.CHECKIN)) {
restResponse = LifecycleRestUtils.checkInService(service.getUUID(), user);
- } else if(targetState.equals(LifeCycleStatesEnum.CERTIFICATIONREQUEST)) {
- restResponse = LifecycleRestUtils.certificationRequestService(service.getUUID(), user);
- } else if(targetState.equals(LifeCycleStatesEnum.STARTCERTIFICATION)) {
- restResponse = LifecycleRestUtils.startTestingService(service.getUUID(), user);
} else if(targetState.equals(LifeCycleStatesEnum.CERTIFY)) {
restResponse = LifecycleRestUtils.certifyService(service.getUUID(), user);
}
@@ -540,11 +516,7 @@ public class AssetLifeCycle extends ComponentBaseTest {
getExtendTest().log(Status.INFO, String.format("initState: %s, targetState: %s, errorCode: %s,"
+ " preState: %s, currState: %s, status: %s, actionStatus: %s, user: %s, operationUser: %s", initState, targetState, errorCode, preState,
currState, status, actionStatus, user, operationUser));
-
- if(initState.equals(LifeCycleStatesEnum.STARTCERTIFICATION) && targetState.equals(LifeCycleStatesEnum.CHECKIN)){
- throw new SkipException("Open bug DE270217 or TDP number: 154592");
- }
-
+
Either<Resource, RestResponse> createdComponent = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true);
Component resourceDetails = createdComponent.left().value();
@@ -556,10 +528,6 @@ public class AssetLifeCycle extends ComponentBaseTest {
restResponse = LifecycleRestUtils.checkOutResource(resourceDetails.getUUID(), user);
} else if(targetState.equals(LifeCycleStatesEnum.CHECKIN)) {
restResponse = LifecycleRestUtils.checkInResource(resourceDetails.getUUID(), user);
- /*} else if(targetState.equals(LifeCycleStatesEnum.CERTIFICATIONREQUEST)) {
- restResponse = LifecycleRestUtils.certificationRequestResource(resourceDetails.getUUID(), user);
- } else if(targetState.equals(LifeCycleStatesEnum.STARTCERTIFICATION)) {
- restResponse = LifecycleRestUtils.startTestingResource(resourceDetails.getUUID(), user);*/
} else if(targetState.equals(LifeCycleStatesEnum.CERTIFY)) {
restResponse = LifecycleRestUtils.certifyResource(resourceDetails.getUUID(), user);
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetFilteredAssetServlet.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetFilteredAssetServlet.java
index fd230d4943..94d1047ddb 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetFilteredAssetServlet.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetFilteredAssetServlet.java
@@ -517,7 +517,7 @@ public class GetFilteredAssetServlet extends ComponentBaseTest {
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
ServiceReqDetails certifyService = new ServiceReqDetails(service);
- LifecycleRestUtils.changeDistributionStatus(certifyService, certifyService.getVersion(), ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR), null, DistributionStatusEnum.DISTRIBUTION_APPROVED);
+ LifecycleRestUtils.changeDistributionStatus(certifyService, certifyService.getVersion(), ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR), null, DistributionStatusEnum.DISTRIBUTED);
AtomicOperationUtils.distributeService(service, false);
expectedAssetNamesList.add(service.getName());
@@ -529,7 +529,7 @@ public class GetFilteredAssetServlet extends ComponentBaseTest {
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
certifyService = new ServiceReqDetails(service);
- LifecycleRestUtils.changeDistributionStatus(certifyService, certifyService.getVersion(), ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR), null, DistributionStatusEnum.DISTRIBUTION_APPROVED);
+ LifecycleRestUtils.changeDistributionStatus(certifyService, certifyService.getVersion(), ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR), null, DistributionStatusEnum.DISTRIBUTED);
AtomicOperationUtils.distributeService(service, false);
expectedAssetNamesList.add(service.getName());