summaryrefslogtreecommitdiffstats
path: root/test-apis-ci/src/main/java/org/openecomp
diff options
context:
space:
mode:
authorMojahidul Islam <mojahidul.islam@amdocs.com>2019-07-09 11:16:35 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-07-09 07:42:27 +0000
commitba6a9e6fc163854c96c5178a9b9cd306248a41e0 (patch)
tree791a036d95048c07bab782b233297701605fd3cf /test-apis-ci/src/main/java/org/openecomp
parentda8b24151295d923cc632dfa2d296b3c67f6cce2 (diff)
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>
Diffstat (limited to 'test-apis-ci/src/main/java/org/openecomp')
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java2
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/interfaceoperation/InterfaceOperationsTest.java34
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java8
3 files changed, 44 insertions, 0 deletions
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;
@@ -281,6 +283,38 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
}
@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 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 {