diff options
Diffstat (limited to 'test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java')
-rw-r--r-- | test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java | 182 |
1 files changed, 60 insertions, 122 deletions
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java index fdef535f95..9db9e8a4d8 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java @@ -20,21 +20,14 @@ package org.openecomp.sdc.externalApis; -import static org.testng.AssertJUnit.assertEquals; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import com.google.gson.Gson; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; -import org.codehaus.jackson.map.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition; @@ -45,35 +38,26 @@ import org.openecomp.sdc.be.model.ArtifactUiDownloadData; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.Urls; -import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceAssetStructure; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceAssetStructure; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.*; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; 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.ExpectedExternalAudit; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; 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.ArtifactRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; -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.rest.*; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.testng.annotations.Test; -import com.google.gson.Gson; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import static org.testng.AssertJUnit.assertEquals; public class GetAssetServlet extends ComponentBaseTest { @@ -102,78 +86,52 @@ public class GetAssetServlet extends ComponentBaseTest { // CassandraUtils.truncateAllKeyspaces(); List<String> expectedAssetNamesList = new ArrayList<>(); + ResourceReqDetails resourceDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, sdncUserDetails); + Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value(); + expectedAssetNamesList.add(resourceDetails.getName()); - ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource(); - resourceDetails.setName("ciResource1"); - resourceDetails.setResourceType(ResourceTypeEnum.VF.name()); - RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createResource); - Resource resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class); - expectedAssetNamesList.add(resource.getName()); - - resourceDetails.setName("ciResource2"); - resourceDetails.setResourceType(ResourceTypeEnum.VF.name()); - createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createResource); - resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class); + resourceDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, sdncUserDetails); + resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); - expectedAssetNamesList.add(resource.getName()); - expectedAssetNamesList.add(resource.getName()); - - resourceDetails.setName("ciResource3"); - resourceDetails.setResourceType(ResourceTypeEnum.VF.name()); - createResource = ResourceRestUtils.createResource(resourceDetails, - ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createResource); - resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class); + expectedAssetNamesList.add(resourceDetails.getName()); + + resourceDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, sdncUserDetails); + resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - expectedAssetNamesList.add(resource.getName()); + expectedAssetNamesList.add(resourceDetails.getName()); - resourceDetails.setName("ciResource4"); - resourceDetails.setResourceType(ResourceTypeEnum.VF.name()); - createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createResource); - resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class); + resourceDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, sdncUserDetails); + resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft(); - expectedAssetNamesList.add(resource.getName()); + expectedAssetNamesList.add(resourceDetails.getName()); - resourceDetails.setName("ciResource5"); - resourceDetails.setResourceType(ResourceTypeEnum.VF.name()); - createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createResource); - resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class); + resourceDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, sdncUserDetails); + resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); - expectedAssetNamesList.add(resource.getName()); + expectedAssetNamesList.add(resourceDetails.getName()); - resourceDetails.setName("ciResource6"); - resourceDetails.setResourceType(ResourceTypeEnum.VF.name()); - createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createResource); - resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class); + resourceDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, sdncUserDetails); + resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, true).getLeft(); - expectedAssetNamesList.add(resource.getName()); + expectedAssetNamesList.add(resourceDetails.getName()); - resourceDetails.setName("ciResource7"); - resourceDetails.setResourceType(ResourceTypeEnum.VF.name()); - createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createResource); - resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class); + resourceDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, sdncUserDetails); + resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFICATIONREQUEST, true).getLeft(); - expectedAssetNamesList.add(resource.getName()); - expectedAssetNamesList.add(resource.getName()); + expectedAssetNamesList.add(resourceDetails.getName()); System.out.println("7 VF resources were created"); @@ -186,11 +144,11 @@ public class GetAssetServlet extends ComponentBaseTest { AssetRestUtils.checkComponentTypeInObjectList(resourceAssetList, ComponentTypeEnum.RESOURCE); - // Validate audit message + /* // Validate audit message ExpectedExternalAudit expectedAssetListAudit = ElementFactory.getDefaultAssetListAudit(AssetTypeEnum.RESOURCES, AuditingActionEnum.GET_ASSET_LIST); Map <AuditingFieldsKeysEnum, String> body = new HashMap<>(); body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL()); - AuditValidationUtils.validateExternalAudit(expectedAssetListAudit, AuditingActionEnum.GET_ASSET_LIST.getName(), body); + AuditValidationUtils.validateExternalAudit(expectedAssetListAudit, AuditingActionEnum.GET_ASSET_LIST.getName(), body);*/ } @@ -202,76 +160,59 @@ public class GetAssetServlet extends ComponentBaseTest { ArtifactReqDetails artifactDetails = ElementFactory.getArtifactByType(ArtifactTypeEnum.OTHER, ArtifactTypeEnum.OTHER, true); ServiceReqDetails serviceDetails = ElementFactory.getDefaultService(); - serviceDetails.setName("ciService1"); - RestResponse createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createService); - Service service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class); - expectedAssetNamesList.add(service.getName()); - - serviceDetails.setName("ciService2"); - createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createService); - service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class); + Service service = AtomicOperationUtils.createCustomService(serviceDetails, UserRoleEnum.DESIGNER, true).left().value(); + expectedAssetNamesList.add(serviceDetails.getName()); + + serviceDetails = ElementFactory.getDefaultService(); + service = AtomicOperationUtils.createCustomService(serviceDetails, UserRoleEnum.DESIGNER, true).left().value(); RestResponse addInformationalArtifactToService = ArtifactRestUtils.addInformationalArtifactToService(artifactDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), service.getUniqueId()); BaseRestUtils.checkSuccess(addInformationalArtifactToService); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); - expectedAssetNamesList.add(service.getName()); - expectedAssetNamesList.add(service.getName()); + expectedAssetNamesList.add(serviceDetails.getName()); - serviceDetails.setName("ciService3"); - createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createService); - service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class); + serviceDetails = ElementFactory.getDefaultService(); + service = AtomicOperationUtils.createCustomService(serviceDetails, UserRoleEnum.DESIGNER, true).left().value(); addInformationalArtifactToService = ArtifactRestUtils.addInformationalArtifactToService(artifactDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), service.getUniqueId()); BaseRestUtils.checkSuccess(addInformationalArtifactToService); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - expectedAssetNamesList.add(service.getName()); + expectedAssetNamesList.add(serviceDetails.getName()); - serviceDetails.setName("ciService4"); - createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createService); - service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class); + serviceDetails = ElementFactory.getDefaultService(); + service = AtomicOperationUtils.createCustomService(serviceDetails, UserRoleEnum.DESIGNER, true).left().value(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft(); - expectedAssetNamesList.add(service.getName()); + expectedAssetNamesList.add(serviceDetails.getName()); - serviceDetails.setName("ciService5"); - createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createService); - service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class); + serviceDetails = ElementFactory.getDefaultService(); + service = AtomicOperationUtils.createCustomService(serviceDetails, UserRoleEnum.DESIGNER, true).left().value(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); - expectedAssetNamesList.add(service.getName()); + expectedAssetNamesList.add(serviceDetails.getName()); - serviceDetails.setName("ciService6"); - createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createService); - service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class); + serviceDetails = ElementFactory.getDefaultService(); + service = AtomicOperationUtils.createCustomService(serviceDetails, UserRoleEnum.DESIGNER, true).left().value(); addInformationalArtifactToService = ArtifactRestUtils.addInformationalArtifactToService(artifactDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), service.getUniqueId()); BaseRestUtils.checkSuccess(addInformationalArtifactToService); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, true).getLeft(); - expectedAssetNamesList.add(service.getName()); + expectedAssetNamesList.add(serviceDetails.getName()); - serviceDetails.setName("ciService7"); - createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER)); - BaseRestUtils.checkCreateResponse(createService); - service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class); + serviceDetails = ElementFactory.getDefaultService(); + service = AtomicOperationUtils.createCustomService(serviceDetails, UserRoleEnum.DESIGNER, true).left().value(); addInformationalArtifactToService = ArtifactRestUtils.addInformationalArtifactToService(artifactDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), service.getUniqueId()); BaseRestUtils.checkSuccess(addInformationalArtifactToService); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFICATIONREQUEST, true).getLeft(); - expectedAssetNamesList.add(service.getName()); - expectedAssetNamesList.add(service.getName()); + expectedAssetNamesList.add(serviceDetails.getName()); System.out.println("7 Services were created"); @@ -282,24 +223,20 @@ public class GetAssetServlet extends ComponentBaseTest { List<String> getActualAssetNamesList = AssetRestUtils.getServiceNamesList(serviceAssetList); Utils.compareArrayLists(getActualAssetNamesList, expectedAssetNamesList, "Element"); - // Validate audit message + /*// Validate audit message ExpectedExternalAudit expectedAssetListAudit = ElementFactory.getDefaultAssetListAudit(AssetTypeEnum.SERVICES, AuditingActionEnum.GET_ASSET_LIST); Map <AuditingFieldsKeysEnum, String> body = new HashMap<>(); body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedAssetListAudit.getRESOURCE_URL()); - AuditValidationUtils.validateExternalAudit(expectedAssetListAudit, AuditingActionEnum.GET_ASSET_LIST.getName(), body); + AuditValidationUtils.validateExternalAudit(expectedAssetListAudit, AuditingActionEnum.GET_ASSET_LIST.getName(), body);*/ } - @Test + @Test(enabled = false) public void getToscaModelSuccess() throws Exception { CloseableHttpClient httpclient = HttpClients.createDefault(); - ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource(); -// resourceDetails.setName("ciResource11"); - resourceDetails.setResourceType(ResourceTypeEnum.VF.name()); - RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncUserDetails); - BaseRestUtils.checkCreateResponse(createResource); - Resource resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class); + ResourceReqDetails resourceDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, sdncUserDetails); + Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value(); HttpResponse assetResponse = AssetRestUtils.getComponentToscaModel(AssetTypeEnum.RESOURCES, resource.getUUID()); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); String artId = resource.getToscaArtifacts().get("assettoscacsar").getEsId(); @@ -320,6 +257,7 @@ public class GetAssetServlet extends ComponentBaseTest { .append(artifactUiDownloadData.getArtifactName()).append("\"").toString()); } + private HttpGet createGetRequest(String url) { HttpGet httpGet = new HttpGet(url); httpGet.addHeader(HttpHeaderEnum.USER_ID.getValue(), sdncUserDetails.getUserId()); |