From ba6a9e6fc163854c96c5178a9b9cd306248a41e0 Mon Sep 17 00:00:00 2001 From: Mojahidul Islam Date: Tue, 9 Jul 2019 11:16:35 +0530 Subject: Incrrct intrfc type populated in tosca for S proxy Incorrect interface type is populated in tosca for Service proxy for Local interface operations Change-Id: If7933d6537a14567297e716f154c2a48f7f34797 Issue-ID: SDC-2423 Signed-off-by: Mojahidul Islam --- .../java/org/openecomp/sdc/ci/tests/api/Urls.java | 2 ++ .../InterfaceOperationsTest.java | 34 ++++++++++++++++++++++ .../sdc/ci/tests/utils/rest/ServiceRestUtils.java | 8 +++++ .../src/main/resources/ci/testSuites/service.xml | 1 + 4 files changed, 45 insertions(+) (limited to 'test-apis-ci') diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java index a4338fb272..956d9b1d8f 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java @@ -424,4 +424,6 @@ public interface Urls { //VSP Validation Operation final String VSP_VALIDATION_CONFIGURATION = SDC_HTTP_METHOD + "://%s:%s/onboarding-api/v1.0/externaltesting/config"; + final String GET_INSTANCE_TOSCA_ARTIFACTS = SDC_HTTP_METHOD + + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/filteredDataByParams?include=toscaArtifacts"; } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/interfaceoperation/InterfaceOperationsTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/interfaceoperation/InterfaceOperationsTest.java index d0513b5ad3..40ac187512 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/interfaceoperation/InterfaceOperationsTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/interfaceoperation/InterfaceOperationsTest.java @@ -15,6 +15,7 @@ import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationOutputDefinition; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.InterfaceDefinition; @@ -31,6 +32,7 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.InterfaceOperationsRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -280,6 +282,38 @@ public class InterfaceOperationsTest extends ComponentBaseTest { Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS); } + @Test + public void testCreateOperationWithLocalInterfaceAndDownloadArtifact() throws Exception{ + Either createDefaultServiceEither = + AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true); + if (createDefaultServiceEither.isRight()) { + fail("Error creating default service"); + } + Service service = createDefaultServiceEither.left().value(); + String serviceUniqueId = service.getUniqueId(); + Operation operation = new Operation(); + operation.setName("LocalOper"); + operation.setWorkflowAssociationType("NONE"); + Map interfaceOperationMap = buildInterfaceDefinitionMap(operation, "Local", null, null); + + RestResponse restResponse = InterfaceOperationsRestUtils.addInterfaceOperations(service, interfaceOperationMap, + user); + + Integer responseCode = restResponse.getErrorCode(); + Integer expectedCode = 200; + Assert.assertEquals(responseCode, expectedCode); + + service = ResponseParser.convertServiceResponseToJavaObject( + ServiceRestUtils.getServiceToscaArtifacts(service.getUniqueId()).getResponse()); + service.setUniqueId(serviceUniqueId); + service.setComponentType(ComponentTypeEnum.SERVICE); + service.setLastUpdaterUserId(user.getUserId()); + Either responseEither = AtomicOperationUtils + .getComponenetArtifactPayload(service, "assettoscacsar"); + + Assert.assertTrue(responseEither.isLeft()); + } + @Test public void addInterfaceOperationsOnService() throws Exception { RestResponse restResponse = InterfaceOperationsRestUtils diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java index c82a772de3..ec132f0f5a 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java @@ -136,6 +136,14 @@ public class ServiceRestUtils extends BaseRestUtils { return getServiceFromUrl(url, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), false); } + public static RestResponse getServiceToscaArtifacts(String serviceId) throws IOException { + + Config config = Utils.getConfig(); + String url = String.format(Urls.GET_INSTANCE_TOSCA_ARTIFACTS, config.getCatalogBeHost(), + config.getCatalogBePort(), "services", serviceId); + return getServiceFromUrl(url, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), false); + } + public static RestResponse getService(ServiceReqDetails serviceReqDetails, User sdncModifierDetails) throws IOException { diff --git a/test-apis-ci/src/main/resources/ci/testSuites/service.xml b/test-apis-ci/src/main/resources/ci/testSuites/service.xml index 5c64fb49cb..770d2bebf0 100644 --- a/test-apis-ci/src/main/resources/ci/testSuites/service.xml +++ b/test-apis-ci/src/main/resources/ci/testSuites/service.xml @@ -16,6 +16,7 @@ + -- cgit 1.2.3-korg