summaryrefslogtreecommitdiffstats
path: root/test-apis-ci
diff options
context:
space:
mode:
Diffstat (limited to 'test-apis-ci')
-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
-rw-r--r--test-apis-ci/src/main/resources/ci/testSuites/service.xml1
4 files changed, 45 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 {
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 @@
<include name="getInterfaceOperationsFromService"/>
<include name="updateInterfaceOperationsOnService"/>
<include name="deleteInterfaceOperationsFromService"/>
+ <include name="testCreateOperationWithLocalInterfaceAndDownloadArtifact"/>
</methods>
</class>
</classes>