summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2018-07-19 12:35:31 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-07-30 10:03:24 +0000
commita8480d1fec5b5696be04eb887f4cbed6b56238be (patch)
tree59f3e71a9f780e3aee6519cfda4080a4ef356729
parent734d54df49905998d1952a8a3b1a5caf38a05fa0 (diff)
Add support for workflowId and workflowVersionId
Enhance operation data model and APIs to support workflowId and workflowVersionId Change-Id: Ib8772027a3e0147ae0bb59811a9b31fe46975ac6 Issue-ID: SDC-1535 Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java5
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/InterfaceOperationTestUtils.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java9
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java11
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java22
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java26
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java20
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java1
-rw-r--r--openecomp-bdd/features/InterfaceOperation/TestInterfaceOperation.feature18
-rw-r--r--openecomp-bdd/resources/json/operation/createOperation.json14
-rw-r--r--openecomp-bdd/stepDefinitions/InterfaceOperationSteps.js21
12 files changed, 79 insertions, 74 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java
index e61e925e97..3fd5df0ba9 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java
@@ -47,7 +47,7 @@ import java.util.*;
@Component("interfaceOperationBusinessLogic")
public class InterfaceOperationBusinessLogic extends ComponentBusinessLogic{
- private static final Logger LOGGER = LoggerFactory.getLogger(ResourceBusinessLogic.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(InterfaceOperationBusinessLogic.class);
@Autowired
private InterfaceOperationValidation interfaceOperationValidation;
@@ -227,6 +227,9 @@ public class InterfaceOperationBusinessLogic extends ComponentBusinessLogic{
dbOperation.setName(updatedOperation.getName());
dbOperation.setDescription(updatedOperation.getDescription());
dbOperation.setInputs(updatedOperation.getInputs());
+ dbOperation.setOutputs(updatedOperation.getOutputs());
+ dbOperation.setWorkflowId(updatedOperation.getWorkflowId());
+ dbOperation.setWorkflowVersionId(updatedOperation.getWorkflowVersionId());
return dbOperation;
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java
index d7d2c6b7ef..98a49b023d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java
@@ -56,6 +56,8 @@ public class InterfaceUIDataConverter {
operationData.setUniqueId(interfaceOperation.getUniqueId());
operationData.setInputs(inputs);
operationData.setOutputs(outputs);
+ operationData.setWorkflowId(interfaceOperation.getWorkflowId());
+ operationData.setWorkflowVersionId(interfaceOperation.getWorkflowVersionId());
return operationData;
}
@@ -84,6 +86,8 @@ public class InterfaceUIDataConverter {
interfaceOperationDataDefinition.setInputParams(inputParams);
interfaceOperationDataDefinition.setOutputParams(outputParams);
interfaceOperationDataDefinition.setArtifactUUID(operationData.getImplementation().getArtifactUUID());
+ interfaceOperationDataDefinition.setWorkflowId(operationData.getWorkflowId());
+ interfaceOperationDataDefinition.setWorkflowVersionId(operationData.getWorkflowVersionId());
return interfaceOperationDataDefinition;
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/InterfaceOperationTestUtils.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/InterfaceOperationTestUtils.java
index 61186f00d5..589e8be62b 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/InterfaceOperationTestUtils.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/InterfaceOperationTestUtils.java
@@ -79,6 +79,8 @@ public interface InterfaceOperationTestUtils {
implementation.setUniqueId("uniqId");
implementation.setArtifactUUID("artifactId");
operation.setImplementation(implementation);
+ operation.setWorkflowId("workflowId");
+ operation.setWorkflowVersionId("workflowVersionId");
Map<String, Operation> operationMap = new HashMap<>();
operationMap.put("op1", operation);
return operationMap;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java
index aa71d7616c..5df58cf6d9 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java
@@ -43,6 +43,7 @@ import org.openecomp.sdc.be.impl.WebAppContextWrapper;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
import org.openecomp.sdc.be.model.jsontitan.operations.*;
+import org.openecomp.sdc.be.model.jsontitan.utils.InterfaceUtils;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.IPropertyOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -208,9 +209,15 @@ public class InterfaceOperationBusinessLogicTest implements InterfaceOperationTe
resourceUpdate = setUpResourceMock();
Either<Resource, ResponseFormat> interfaceOperation = bl.createInterfaceOperation(resourceId, resourceUpdate, user, true);
Assert.assertTrue(interfaceOperation.isLeft());
+ Map<String, Operation> interfaceOperationsFromInterfaces = InterfaceUtils
+ .getInterfaceOperationsFromInterfaces(interfaceOperation.left().value().getInterfaces(),
+ interfaceOperation.left().value());
+ for(Operation operation : interfaceOperationsFromInterfaces.values()) {
+ Assert.assertNotNull(operation.getWorkflowId());
+ Assert.assertNotNull(operation.getWorkflowVersionId());
+ }
}
-
@Test
public void updateInterfaceOperationTest() {
validateUserRoles(Role.ADMIN, Role.DESIGNER);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java
index e15f1159ba..766cae4432 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java
@@ -47,8 +47,6 @@ public class Resource extends Component {
private List<String> defaultCapabilities;
- private Map<String, InterfaceOperationDataDefinition> interfaceOperations;
-
public Resource() {
super(new ResourceMetadataDefinition());
this.getComponentMetadataDefinition().getMetadataDataDefinition().setComponentType(ComponentTypeEnum.RESOURCE);
@@ -152,14 +150,6 @@ public class Resource extends Component {
.setLicenseType(licenseType);
}
- public Map<String, InterfaceOperationDataDefinition> getInterfaceOperations() {
- return interfaceOperations;
- }
-
- public void setInterfaceOperations(Map<String, InterfaceOperationDataDefinition> interfaceOperations) {
- this.interfaceOperations = interfaceOperations;
- }
-
@Override
public int hashCode() {
final int prime = 31;
@@ -214,7 +204,6 @@ public class Resource extends Component {
return false;
} else if (!properties.equals(other.properties))
return false;
-
return super.equals(obj);
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java
index cf4ee08043..2ecb4b444c 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java
@@ -222,28 +222,6 @@ public class ResourceTest extends ModelConfDependentTest{
@Test
- public void testGetInterfaceOperations() throws Exception {
- Resource testSubject;
- Map<String, InterfaceOperationDataDefinition> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getInterfaceOperations();
- }
-
-
- @Test
- public void testSetInterfaceOperations() throws Exception {
- Resource testSubject;
- Map<String, InterfaceOperationDataDefinition> interfaceOperations = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setInterfaceOperations(interfaceOperations);
- }
-
-
- @Test
public void testHashCode() throws Exception {
Resource testSubject;
int result;
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java
index 4607364f53..bbc3164f50 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java
@@ -22,7 +22,15 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import java.io.Serializable;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.*;
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.ARTIFACT_UUID;
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.DESCRIPTION;
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_INPUT_PARAMETERS;
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_OPERATION_TYPE;
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_OUTPUT_PARAMETERS;
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_ID;
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_VERSION_ID;
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME;
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.UNIQUE_ID;
public class InterfaceOperationDataDefinition extends ToscaDataDefinition implements Serializable {
@@ -40,6 +48,8 @@ public class InterfaceOperationDataDefinition extends ToscaDataDefinition implem
setToscaResourceName(iodd.getToscaResourceName());
setOperationType(iodd.getOperationType());
setArtifactUUID(iodd.getArtifactUUID());
+ setWorkflowId(iodd.getWorkflowId());
+ setWorkflowVersionId(iodd.getWorkflowVersionId());
}
public ListDataDefinition<InterfaceOperationParamDataDefinition> getInputParams() {
@@ -88,6 +98,20 @@ public class InterfaceOperationDataDefinition extends ToscaDataDefinition implem
setToscaPresentationValue(TOSCA_RESOURCE_NAME, toscaResourceName);
}
+ public String getWorkflowId(){
+ return (String) getToscaPresentationValue(IO_WORKFLOW_ID);
+ }
+ public void setWorkflowId(String workflowId) {
+ setToscaPresentationValue(IO_WORKFLOW_ID, workflowId);
+ }
+
+ public String getWorkflowVersionId() {
+ return (String) getToscaPresentationValue(IO_WORKFLOW_VERSION_ID);
+ }
+ public void setWorkflowVersionId(String workflowVersionId) {
+ setToscaPresentationValue(IO_WORKFLOW_VERSION_ID, workflowVersionId);
+ }
+
public String getArtifactUUID() {
return (String) getToscaPresentationValue(ARTIFACT_UUID);
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java
index 5363cbbb2a..49c8ba24a5 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java
@@ -26,6 +26,9 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import java.io.Serializable;
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_ID;
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_VERSION_ID;
+
public class OperationDataDefinition extends ToscaDataDefinition implements Serializable {
@@ -46,6 +49,8 @@ public class OperationDataDefinition extends ToscaDataDefinition implements Seri
setOutputs(p.getOutputs());
setName(p.getName());
setUniqueId(p.getUniqueId());
+ setWorkflowId(p.getWorkflowId());
+ setWorkflowVersionId(p.getWorkflowVersionId());
}
@@ -114,4 +119,19 @@ public class OperationDataDefinition extends ToscaDataDefinition implements Seri
public void setName(String name) {
setToscaPresentationValue(JsonPresentationFields.NAME, name);
}
+
+ public String getWorkflowId(){
+ return (String) getToscaPresentationValue(IO_WORKFLOW_ID);
+ }
+ public void setWorkflowId(String workflowId) {
+ setToscaPresentationValue(IO_WORKFLOW_ID, workflowId);
+ }
+
+ public String getWorkflowVersionId() {
+ return (String) getToscaPresentationValue(IO_WORKFLOW_VERSION_ID);
+ }
+ public void setWorkflowVersionId(String workflowVersionId) {
+ setToscaPresentationValue(IO_WORKFLOW_VERSION_ID, workflowVersionId);
+ }
+
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
index 98b91c1628..912e3d94b1 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
@@ -221,6 +221,7 @@ public enum JsonPresentationFields {
IO_PARAM_NAME("paramName", null),
IO_PARAM_ID("paramId", null),
IO_WORKFLOW_ID("workflowId", null),
+ IO_WORKFLOW_VERSION_ID("workflowVersionId", null),
//Interface
INTERFACE ("interface", null),
diff --git a/openecomp-bdd/features/InterfaceOperation/TestInterfaceOperation.feature b/openecomp-bdd/features/InterfaceOperation/TestInterfaceOperation.feature
index fa3647e5c6..dfd754f74e 100644
--- a/openecomp-bdd/features/InterfaceOperation/TestInterfaceOperation.feature
+++ b/openecomp-bdd/features/InterfaceOperation/TestInterfaceOperation.feature
@@ -93,20 +93,4 @@ Feature: Interface Operation Feature
#Submit
Then I want to submit this VF
- And I want to check property "lifecycleState" for value "READY_FOR_CERTIFICATION"
-
- Scenario: Test InterfaceOperation CREATE with output parameters
- #Create Operations
- When I want to create an Operation with outputParameter
- Then I want to check property "uniqueId" exists
-
- #List All Operations
- When I want to list Operations
-
-#Checkin
- When I want to checkin this VF
- Then I want to check property "lifecycleState" for value "NOT_CERTIFIED_CHECKIN"
-
-#Submit
- Then I want to submit this VF
- And I want to check property "lifecycleState" for value "READY_FOR_CERTIFICATION"
+ And I want to check property "lifecycleState" for value "READY_FOR_CERTIFICATION" \ No newline at end of file
diff --git a/openecomp-bdd/resources/json/operation/createOperation.json b/openecomp-bdd/resources/json/operation/createOperation.json
index 394be36187..5d494402e5 100644
--- a/openecomp-bdd/resources/json/operation/createOperation.json
+++ b/openecomp-bdd/resources/json/operation/createOperation.json
@@ -1,12 +1,16 @@
{
"interfaceOperations": {
"create": {
- "description": "create operation",
+ "description": "abcd description",
"inputParams": {
"listToscaDataDefinition": [
{
- "paramName": "inp1",
- "paramId": "68443b9d-9405-458e-811f-b62dd4975fcb.nf_naming"
+ "paramName": "sd",
+ "paramId": "67c72959-0a05-4436-9339-534aa44c9fd0.nf_naming"
+ },
+ {
+ "paramName": "sdf",
+ "paramId": "67c72959-0a05-4436-9339-534aa44c9fd0.nf_naming_code"
}
]
},
@@ -18,7 +22,9 @@
}
]
},
- "operationType": "create"
+ "operationType": "create",
+ "workflowId" : "w_id1",
+ "workflowVersionId" : "w_version_id11"
}
}
} \ No newline at end of file
diff --git a/openecomp-bdd/stepDefinitions/InterfaceOperationSteps.js b/openecomp-bdd/stepDefinitions/InterfaceOperationSteps.js
index 14c5610626..1bfd4c30a6 100644
--- a/openecomp-bdd/stepDefinitions/InterfaceOperationSteps.js
+++ b/openecomp-bdd/stepDefinitions/InterfaceOperationSteps.js
@@ -43,30 +43,16 @@ function makeType() {
When('I want to create an Operation', function() {
let inputData = util.getJSONFromFile('resources/json/operation/createOperation.json');
- //let path = '/catalog/resources/f3dc81bb-85e9-4dfd-bd1b-37f5dc5e5534/interfaceOperations';
- let path = '/catalog/resources/' + this.context.vf.uniqueId +'/interfaceOperations';
-
- inputData.interfaceOperations.create.operationType = makeType();
- inputData.interfaceOperations.create.inputParams.listToscaDataDefinition[0].paramName = util.random();
- inputData.interfaceOperations.create.inputParams.listToscaDataDefinition[0].paramId = this.context.vf.id;
-
- return util.request(this.context, 'POST', path, inputData, false, 'vf').then(result => {
- this.context.item = {uniqueId : result.data.uniqueId, operationType : result.data.operationType};
- this.context.operation = {uniqueId : result.data.uniqueId, operationType : result.data.operationType};
-});
-});
-
-
-When('I want to create an Operation with outputParameter', function() {
- let inputData = util.getJSONFromFile('resources/json/operation/createOperation.json');
- //let path = '/catalog/resources/f3dc81bb-85e9-4dfd-bd1b-37f5dc5e5534/interfaceOperations';
let path = '/catalog/resources/' + this.context.vf.uniqueId +'/interfaceOperations';
inputData.interfaceOperations.create.operationType = makeType();
+ inputData.interfaceOperations.create.description = makeType();
inputData.interfaceOperations.create.inputParams.listToscaDataDefinition[0].paramName = util.random();
inputData.interfaceOperations.create.inputParams.listToscaDataDefinition[0].paramId = this.context.vf.id;
inputData.interfaceOperations.create.outputParams.listToscaDataDefinition[0].paramName = util.random();
inputData.interfaceOperations.create.outputParams.listToscaDataDefinition[0].paramId = this.context.vf.id;
+ inputData.interfaceOperations.create.workflowId = makeType();
+ inputData.interfaceOperations.create.workflowVersionId = makeType();
return util.request(this.context, 'POST', path, inputData, false, 'vf').then(result => {
this.context.item = {uniqueId : result.data.uniqueId, operationType : result.data.operationType};
@@ -75,6 +61,7 @@ When('I want to create an Operation with outputParameter', function() {
});
+
When('I want to list Operations', function () {
let path = '/catalog/resources/' + this.context.vf.uniqueId + '/filteredDataByParams?include=interfaces';
return util.request(this.context, 'GET', path, null, false, 'vf').then((result)=> {