aboutsummaryrefslogtreecommitdiffstats
path: root/test-apis-ci/src/main
diff options
context:
space:
mode:
authorpriyanshu <pagarwal@amdocs.com>2019-04-09 09:24:51 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-04-10 06:01:38 +0000
commit163c4dfc0480a128f3243f8c466dccba41011e96 (patch)
treea4b1c30b41e92e61546091efd39c92e6e6877be6 /test-apis-ci/src/main
parentef6ec63b05fb93adef0edb392b0a33de97203876 (diff)
Internal API for interface artifact upload
Internal API for interface artifact upload Change-Id: I9934a6d6aa11680b883f51ba8f231aeb866f2487 Issue-ID: SDC-2226 Signed-off-by: priyanshu <pagarwal@amdocs.com>
Diffstat (limited to 'test-apis-ci/src/main')
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java1
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java147
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/interfaceoperation/InterfaceOperationsTest.java66
3 files changed, 162 insertions, 52 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 1f1c90764b..ad699d07ae 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
@@ -408,6 +408,7 @@ public interface Urls {
final String UPDATE_INTERFACE_OPERATIONS = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/interfaceOperations";
final String GET_INTERFACE_OPERATIONS = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/interfaces/%s/operations/%s";
final String DELETE_INTERFACE_OPERATIONS = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/interfaces/%s/operations/%s";
+ final String UPLOAD_INTERFACE_OPERATION_ARTIFACT = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/interfaces/%s/operations/%s/artifacts/%s";
//Requirements
String CREATE_REQUIREMENT = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/requirements";
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
index c735169e77..81a165afc9 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
@@ -42,6 +42,7 @@ import org.json.simple.parser.ParseException;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
@@ -54,6 +55,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.interfaceoperation.InterfaceOperationsTest;
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.*;
@@ -73,6 +75,10 @@ import java.util.Map;
public class ArtifactServletTest extends ComponentBaseTest {
+ private static final String ARTIFACT_NAME_STR = "artifactName";
+ private static final String ARTIFACT_TYPE_STR = "artifactType";
+ private static final String ARTIFACT_DESCRIPTION_STR = "description";
+ private static final String ARTIFACT_PAYLOAD_DATA_STR = "payloadData";
private static Logger log = LoggerFactory.getLogger(ArtifactServletTest.class.getName());
protected static final String UPLOAD_ARTIFACT_PAYLOAD = "UHVUVFktVXNlci1LZXktRmlsZS0yOiBzc2gtcnNhDQpFbmNyeXB0aW9uOiBhZXMyNTYtY2JjDQpDb21tZW5wOA0K";
protected static final String UPLOAD_ARTIFACT_NAME = "TLV_prv.ppk";
@@ -84,6 +90,8 @@ public class ArtifactServletTest extends ComponentBaseTest {
protected String serviceVersion;
protected Resource resourceDetailsVFCcomp;
protected Service defaultService1;
+ protected Resource resource;
+ protected Resource pnfResource;
protected User sdncUserDetails;
@@ -106,6 +114,14 @@ public class ArtifactServletTest extends ComponentBaseTest {
Either<Service, RestResponse> defaultService1e = AtomicOperationUtils
.createDefaultService(UserRoleEnum.DESIGNER, true);
defaultService1 = defaultService1e.left().value();
+
+ Either<Resource, RestResponse> createDefaultResourceEither =
+ AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true);
+ resource = createDefaultResourceEither.left().value();
+
+ Either<Resource, RestResponse> createDefaultPNFResourceEither =
+ AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true);
+ pnfResource = createDefaultPNFResourceEither.left().value();
}
@Test
@@ -161,12 +177,12 @@ public class ArtifactServletTest extends ComponentBaseTest {
String artifactId = getLifecycleArtifactUid(response);
Map<String, Object> jsonBody = new HashMap<String, Object>();
- jsonBody.put("artifactName", "TLV_prv.ppk");
+ jsonBody.put(ARTIFACT_NAME_STR, "TLV_prv.ppk");
jsonBody.put("artifactDisplayName", "configure");
- jsonBody.put("artifactType", "SHELL");
+ jsonBody.put(ARTIFACT_TYPE_STR, "SHELL");
jsonBody.put("mandatory", "false");
String newDescription = "new something";
- jsonBody.put("description", newDescription);
+ jsonBody.put(ARTIFACT_DESCRIPTION_STR, newDescription);
jsonBody.put("artifactLabel", "configure");
userBodyJson = gson.toJson(jsonBody);
@@ -193,7 +209,7 @@ public class ArtifactServletTest extends ComponentBaseTest {
responseMap = (JSONObject) responseMap.get("operations");
responseMap = (JSONObject) responseMap.get(operationName.toLowerCase());
responseMap = (JSONObject) responseMap.get("implementation");
- String description = (String) responseMap.get("description");
+ String description = (String) responseMap.get(ARTIFACT_DESCRIPTION_STR);
AssertJUnit.assertEquals("the new description value was not set", newDescription, description);
@@ -214,12 +230,12 @@ public class ArtifactServletTest extends ComponentBaseTest {
protected String createUploadArtifactBodyJson() {
Map<String, Object> jsonBody = new HashMap<String, Object>();
- jsonBody.put("artifactName", UPLOAD_ARTIFACT_NAME);
+ jsonBody.put(ARTIFACT_NAME_STR, UPLOAD_ARTIFACT_NAME);
jsonBody.put("artifactDisplayName", "configure");
- jsonBody.put("artifactType", "SHELL");
+ jsonBody.put(ARTIFACT_TYPE_STR, "SHELL");
jsonBody.put("mandatory", "false");
- jsonBody.put("description", "ff");
- jsonBody.put("payloadData", UPLOAD_ARTIFACT_PAYLOAD);
+ jsonBody.put(ARTIFACT_DESCRIPTION_STR, "ff");
+ jsonBody.put(ARTIFACT_PAYLOAD_DATA_STR, UPLOAD_ARTIFACT_PAYLOAD);
jsonBody.put("artifactLabel", "configure");
return gson.toJson(jsonBody);
}
@@ -310,10 +326,10 @@ public class ArtifactServletTest extends ComponentBaseTest {
protected String createLoadArtifactBody() {
Map<String, Object> json = new HashMap<String, Object>();
- json.put("artifactName", "install_apache2.sh");
- json.put("artifactType", "SHELL");
- json.put("description", "ddd");
- json.put("payloadData", "UEsDBAoAAAAIAAeLb0bDQz");
+ json.put(ARTIFACT_NAME_STR, "install_apache2.sh");
+ json.put(ARTIFACT_TYPE_STR, "SHELL");
+ json.put(ARTIFACT_DESCRIPTION_STR, "ddd");
+ json.put(ARTIFACT_PAYLOAD_DATA_STR, "UEsDBAoAAAAIAAeLb0bDQz");
json.put("artifactLabel", "name123");
String jsonStr = gson.toJson(json);
@@ -442,8 +458,8 @@ public class ArtifactServletTest extends ComponentBaseTest {
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
Map<String, Object> json = new HashMap<String, Object>();
- json.put("description", "desc");
- json.put("payloadData", "UEsDBAoAAAAIAAeLb0bDQz");
+ json.put(ARTIFACT_DESCRIPTION_STR, "desc");
+ json.put(ARTIFACT_PAYLOAD_DATA_STR, "UEsDBAoAAAAIAAeLb0bDQz");
json.put("Content-MD5", "YTg2Mjg4MWJhNmI5NzBiNzdDFkMWI=");
String jsonBody = gson.toJson(json);
@@ -466,10 +482,10 @@ public class ArtifactServletTest extends ComponentBaseTest {
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HashMap<String, Object> json = new HashMap<String, Object>();
- json.put("artifactName", "install_apache.sh");
- json.put("artifactType", "SHELL");
- json.put("description", "kjglkh");
- json.put("payloadData", "UEsDBYTEIWUYIFHWFMABCNAoAAAAIAAeLb0bDQz");
+ json.put(ARTIFACT_NAME_STR, "install_apache.sh");
+ json.put(ARTIFACT_TYPE_STR, "SHELL");
+ json.put(ARTIFACT_DESCRIPTION_STR, "kjglkh");
+ json.put(ARTIFACT_PAYLOAD_DATA_STR, "UEsDBYTEIWUYIFHWFMABCNAoAAAAIAAeLb0bDQz");
json.put("artifactLabel", "name123");
String url = String.format(Urls.ADD_ARTIFACT_TO_RESOURCE, config.getCatalogBeHost(),
config.getCatalogBePort(), resourceDetailsVFCcomp.getUniqueId());
@@ -575,10 +591,10 @@ public class ArtifactServletTest extends ComponentBaseTest {
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
Map<String, Object> json = new HashMap<String, Object>();
- json.put("artifactName", "install_apache.sh");
- json.put("artifactType", "SHELL11");
- json.put("description", "fff");
- json.put("payloadData", "UEsDBAoAAAAIAAeLb0bDQz");
+ json.put(ARTIFACT_NAME_STR, "install_apache.sh");
+ json.put(ARTIFACT_TYPE_STR, "SHELL11");
+ json.put(ARTIFACT_DESCRIPTION_STR, "fff");
+ json.put(ARTIFACT_PAYLOAD_DATA_STR, "UEsDBAoAAAAIAAeLb0bDQz");
json.put("artifactLabel", "name123");
String jsonStr = gson.toJson(json);
@@ -643,4 +659,91 @@ public class ArtifactServletTest extends ComponentBaseTest {
}
AssertJUnit.assertTrue(isExist);
}
+
+ @Test
+ public void addInterfaceOperationArtifactOnResource() throws Exception {
+ try (CloseableHttpClient httpclient = HttpClients.createDefault()){
+ Map<String, Object> artifactData = new HashMap<>();
+ artifactData.put(ARTIFACT_NAME_STR, "TestWF-1_0.bpmn");
+ artifactData.put(ARTIFACT_TYPE_STR, "WORKFLOW");
+ artifactData.put(ARTIFACT_DESCRIPTION_STR, "Resource Workflow Artifact Description");
+ artifactData.put(ARTIFACT_PAYLOAD_DATA_STR, "Test Data of Resource");
+
+ String jsonStr = gson.toJson(artifactData);
+ RestResponse restResponse = InterfaceOperationsRestUtils.addInterfaceOperations(resource,
+ new InterfaceOperationsTest().buildInterfaceDefinitionForResource(resource,
+ null, null),
+ ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ String interfaceDefStr = ResponseParser.getListFromJson(restResponse, "interfaces").get(0).toString();
+ InterfaceDefinition interfaceDefinition = ResponseParser.convertInterfaceDefinitionResponseToJavaObject(interfaceDefStr);
+ String interfaceUUID = interfaceDefinition.getUniqueId();
+ String operationUUID = interfaceDefinition.getOperationsMap().keySet().stream().findFirst().orElse(null);
+ String artifactUUID = interfaceDefinition.getOperationsMap().values().stream().findFirst().get().getImplementation().getArtifactUUID();
+
+ String url = String.format(Urls.UPLOAD_INTERFACE_OPERATION_ARTIFACT, config.getCatalogBeHost(),
+ config.getCatalogBePort(), ComponentTypeEnum.findParamByType(resource.getComponentType()),
+ resource.getUUID(), interfaceUUID, operationUUID, artifactUUID);
+ CloseableHttpResponse result = httpclient.execute(createPostAddArtifactRequeast(jsonStr, url, true));
+ int status = result.getStatusLine().getStatusCode();
+ AssertJUnit.assertEquals("add informational artifact request returned status: " + status, 200, status);
+ }
+ }
+
+ @Test
+ public void addInterfaceOperationArtifactOnPNFResource() throws Exception {
+ try (CloseableHttpClient httpclient = HttpClients.createDefault()){
+ Map<String, Object> artifactData = new HashMap<>();
+ artifactData.put(ARTIFACT_NAME_STR, "TestWF-1_0.bpmn");
+ artifactData.put(ARTIFACT_TYPE_STR, "WORKFLOW");
+ artifactData.put(ARTIFACT_DESCRIPTION_STR, "PNF Resource Workflow Artifact Description");
+ artifactData.put(ARTIFACT_PAYLOAD_DATA_STR, "Test Data of PNF Resource");
+
+ String jsonStr = gson.toJson(artifactData);
+ RestResponse restResponse = InterfaceOperationsRestUtils.addInterfaceOperations(pnfResource,
+ new InterfaceOperationsTest().buildInterfaceDefinitionForResource(pnfResource,
+ null, null),
+ ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ String interfaceDefStr = ResponseParser.getListFromJson(restResponse, "interfaces").get(0).toString();
+ InterfaceDefinition interfaceDefinition = ResponseParser.convertInterfaceDefinitionResponseToJavaObject(interfaceDefStr);
+ String interfaceUUID = interfaceDefinition.getUniqueId();
+ String operationUUID = interfaceDefinition.getOperationsMap().keySet().stream().findFirst().orElse(null);
+ String artifactUUID = interfaceDefinition.getOperationsMap().values().stream().findFirst().get().getImplementation().getArtifactUUID();
+
+ String url = String.format(Urls.UPLOAD_INTERFACE_OPERATION_ARTIFACT, config.getCatalogBeHost(),
+ config.getCatalogBePort(), ComponentTypeEnum.findParamByType(pnfResource.getComponentType()),
+ pnfResource.getUUID(), interfaceUUID, operationUUID, artifactUUID);
+ CloseableHttpResponse result = httpclient.execute(createPostAddArtifactRequeast(jsonStr, url, true));
+ int status = result.getStatusLine().getStatusCode();
+ AssertJUnit.assertEquals("add informational artifact request returned status: " + status, 200, status);
+ }
+ }
+
+ @Test
+ public void addInterfaceOperationArtifactOnService() throws Exception {
+ try (CloseableHttpClient httpclient = HttpClients.createDefault()){
+ Map<String, Object> artifactData = new HashMap<>();
+ artifactData.put(ARTIFACT_NAME_STR, "TestWF-1_0.bpmn");
+ artifactData.put(ARTIFACT_TYPE_STR, "WORKFLOW");
+ artifactData.put(ARTIFACT_DESCRIPTION_STR, "Service Workflow Artifact Description");
+ artifactData.put(ARTIFACT_PAYLOAD_DATA_STR, "Test Data of Service");
+
+ String jsonStr = gson.toJson(artifactData);
+ RestResponse restResponse = InterfaceOperationsRestUtils.addInterfaceOperations(defaultService1,
+ new InterfaceOperationsTest().buildInterfaceDefinitionForService(),
+ ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ String interfaceDefinitionStr = ResponseParser.getListFromJson(restResponse, "interfaces").get(0).toString();
+ InterfaceDefinition interfaceDefinition = ResponseParser.convertInterfaceDefinitionResponseToJavaObject(interfaceDefinitionStr);
+ String interfaceUUID = interfaceDefinition.getUniqueId();
+ String operationUUID = interfaceDefinition.getOperationsMap().keySet().stream().findFirst().orElse(null);
+ String artifactUUID = interfaceDefinition.getOperationsMap().values().stream().findFirst().get().getImplementation().getArtifactUUID();
+
+ String url = String.format(Urls.UPLOAD_INTERFACE_OPERATION_ARTIFACT, config.getCatalogBeHost(),
+ config.getCatalogBePort(), ComponentTypeEnum.findParamByType(defaultService1.getComponentType()),
+ defaultService1.getUUID(), interfaceUUID, operationUUID, artifactUUID);
+ CloseableHttpResponse result = httpclient.execute(createPostAddArtifactRequeast(jsonStr, url, true));
+ int status = result.getStatusLine().getStatusCode();
+ AssertJUnit.assertEquals("add informational artifact request returned status: " + status, 200, status);
+ }
+ }
+
}
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 f26f175f9d..d0513b5ad3 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
@@ -9,6 +9,7 @@ import java.util.HashMap;
import java.util.Map;
import fj.data.Either;
+import org.apache.commons.collections4.CollectionUtils;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
@@ -41,6 +42,9 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
private static final String INTERFACES = "interfaces";
private static final String TOSCA_PRESENTATION = "toscaPresentation";
private static final User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ private static final String WORKFLOW_ID_STR = "WorkflowId";
+ private static final String WORKFLOW_VERSION_ID_STR = "workflowVersionId";
+ private static final String WORKFLOW_ASSOCIATION_TYPE_NONE_STR = "NONE";
private static Service service;
private static Resource resource;
@@ -76,26 +80,29 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
// Create default PNF resource
Either<Resource, RestResponse> createDefaultPNFResourceEither =
- AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true);
+ AtomicOperationUtils.createResourceByType(ResourceTypeEnum.PNF, UserRoleEnum.DESIGNER, true);
if (createDefaultPNFResourceEither.isRight()) {
fail("Error creating default pnf resource");
}
pnfResource = createDefaultPNFResourceEither.left().value();
}
- private Map<String, Object> buildInterfaceDefinitionForResource(String resourceInterfaceUniqueId,
+ public Map<String, Object> buildInterfaceDefinitionForResource(Resource resource,
+ String resourceInterfaceUniqueId,
String resourceOperationUniqueId) {
Operation operation = new Operation();
operation.setName("TestOperationOnResource");
- operation.setWorkflowId("WorkflowId");
- operation.setWorkflowVersionId("workflowVersionId");
- operation.setWorkflowAssociationType("NONE");
- PropertyDefinition property =
- resource.getInputs().stream().filter(a -> a.getName().equalsIgnoreCase("nf_naming")).findFirst()
- .orElse(new InputDefinition());
- ListDataDefinition<OperationInputDefinition> operationInputDefinitionList = new ListDataDefinition<>();
- operationInputDefinitionList.add(createOperationInputDefinition("TestInput1", property.getUniqueId()));
- operation.setInputs(operationInputDefinitionList);
+ operation.setWorkflowId(WORKFLOW_ID_STR);
+ operation.setWorkflowVersionId(WORKFLOW_VERSION_ID_STR);
+ operation.setWorkflowAssociationType(WORKFLOW_ASSOCIATION_TYPE_NONE_STR);
+ if(CollectionUtils.isNotEmpty(resource.getInputs())){
+ PropertyDefinition property =
+ resource.getInputs().stream().filter(a -> a.getName().equalsIgnoreCase("nf_naming")).findFirst()
+ .orElse(new InputDefinition());
+ ListDataDefinition<OperationInputDefinition> operationInputDefinitionList = new ListDataDefinition<>();
+ operationInputDefinitionList.add(createOperationInputDefinition("TestInput1", property.getUniqueId()));
+ operation.setInputs(operationInputDefinitionList);
+ }
ListDataDefinition<OperationOutputDefinition> operationOutputDefinitionList = new ListDataDefinition<>();
operationOutputDefinitionList.add(createOperationOutputDefinition("TestOutput1"));
operation.setOutputs(operationOutputDefinitionList);
@@ -106,15 +113,17 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
private Map<String, Object> buildInterfaceDefinitionOfGlobalTypeForResource(Resource resource) {
Operation operation = new Operation();
operation.setName("create");
- operation.setWorkflowId("WorkflowId");
- operation.setWorkflowVersionId("workflowVersionId");
+ operation.setWorkflowId(WORKFLOW_ID_STR);
+ operation.setWorkflowVersionId(WORKFLOW_VERSION_ID_STR);
operation.setWorkflowAssociationType("NONE");
- PropertyDefinition property =
- resource.getInputs().stream().filter(a -> a.getName().equalsIgnoreCase("nf_naming")).findFirst()
- .orElse(new InputDefinition());
- ListDataDefinition<OperationInputDefinition> operationInputDefinitionList = new ListDataDefinition<>();
- operationInputDefinitionList.add(createOperationInputDefinition("TestInput1", property.getUniqueId()));
- operation.setInputs(operationInputDefinitionList);
+ if(CollectionUtils.isNotEmpty(resource.getInputs())){
+ PropertyDefinition property =
+ resource.getInputs().stream().filter(a -> a.getName().equalsIgnoreCase("nf_naming")).findFirst()
+ .orElse(new InputDefinition());
+ ListDataDefinition<OperationInputDefinition> operationInputDefinitionList = new ListDataDefinition<>();
+ operationInputDefinitionList.add(createOperationInputDefinition("TestInput1", property.getUniqueId()));
+ operation.setInputs(operationInputDefinitionList);
+ }
ListDataDefinition<OperationOutputDefinition> operationOutputDefinitionList = new ListDataDefinition<>();
operationOutputDefinitionList.add(createOperationOutputDefinition("TestOutput1"));
operation.setOutputs(operationOutputDefinitionList);
@@ -175,11 +184,11 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
return objectAsMap;
}
- private Map<String, Object> buildInterfaceDefinitionForService() {
+ public Map<String, Object> buildInterfaceDefinitionForService() {
Operation operation = new Operation();
operation.setName("TestOperationOnService");
- operation.setWorkflowId("WorkflowId");
- operation.setWorkflowVersionId("workflowVersionId");
+ operation.setWorkflowId(WORKFLOW_ID_STR);
+ operation.setWorkflowVersionId(WORKFLOW_VERSION_ID_STR);
operation.setWorkflowAssociationType("NONE");
return buildInterfaceDefinitionMap(operation, "TestInterface", serviceInterfaceUniqueId,
serviceOperationUniqueId);
@@ -189,8 +198,8 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
public void addInterfaceOperationsOnResource() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
.addInterfaceOperations(resource,
- buildInterfaceDefinitionForResource(resourceInterfaceUniqueId, resourceOperationUniqueId),
- user);
+ buildInterfaceDefinitionForResource(resource, resourceInterfaceUniqueId,
+ resourceOperationUniqueId), user);
logger.info("addInterfaceOperationsOnResource Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
String interfaceDefinitionStr = ResponseParser.getListFromJson(restResponse, INTERFACES).get(0).toString();
@@ -213,7 +222,7 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
public void updateInterfaceOperationsOnResource() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
.updateInterfaceOperations(resource,
- buildInterfaceDefinitionForResource(resourceInterfaceUniqueId, resourceOperationUniqueId),
+ buildInterfaceDefinitionForResource(resource, resourceInterfaceUniqueId, resourceOperationUniqueId),
user);
logger.info("updateInterfaceOperationsOnResource Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
@@ -231,7 +240,7 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
@Test
public void addInterfaceOperationsOnPNFResource() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
- .addInterfaceOperations(pnfResource, buildInterfaceDefinitionForResource(pnfResourceInterfaceUniqueId,
+ .addInterfaceOperations(pnfResource, buildInterfaceDefinitionForResource(pnfResource, pnfResourceInterfaceUniqueId,
pnfResourceOperationUniqueId), user);
logger.info("addInterfaceOperationsOnPNFResource Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
@@ -256,7 +265,7 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
public void updateInterfaceOperationsOnPNFResource() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
.updateInterfaceOperations(pnfResource,
- buildInterfaceDefinitionForResource(pnfResourceInterfaceUniqueId,
+ buildInterfaceDefinitionForResource(pnfResource, pnfResourceInterfaceUniqueId,
pnfResourceOperationUniqueId), user);
logger.info("updateInterfaceOperationsOnPNFResource Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
@@ -320,9 +329,6 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
logger.info("addInterfaceOperationsOnResource Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
- String interfaceDefinitionStr = ResponseParser.getListFromJson(restResponse, INTERFACES).get(0).toString();
- InterfaceDefinition interfaceDefinition =
- ResponseParser.convertInterfaceDefinitionResponseToJavaObject(interfaceDefinitionStr);
}
@Test