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 <mojahidul.islam@amdocs.com>
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 a4338fb..956d9b1 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 @@
//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 d0513b5..40ac187 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.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.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;
@@ -281,6 +283,38 @@
}
@Test
+ public void testCreateOperationWithLocalInterfaceAndDownloadArtifact() throws Exception{
+ Either<Service, RestResponse> 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<String, Object> 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<String, RestResponse> responseEither = AtomicOperationUtils
+ .getComponenetArtifactPayload(service, "assettoscacsar");
+
+ Assert.assertTrue(responseEither.isLeft());
+ }
+
+ @Test
public void addInterfaceOperationsOnService() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
.addInterfaceOperations(service, buildInterfaceDefinitionForService(),
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 c82a772..ec132f0 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 @@
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 5c64fb4..770d2be 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 @@
<include name="getInterfaceOperationsFromService"/>
<include name="updateInterfaceOperationsOnService"/>
<include name="deleteInterfaceOperationsFromService"/>
+ <include name="testCreateOperationWithLocalInterfaceAndDownloadArtifact"/>
</methods>
</class>
</classes>