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>
@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;
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;
}
operationData.setUniqueId(interfaceOperation.getUniqueId());
operationData.setInputs(inputs);
operationData.setOutputs(outputs);
+ operationData.setWorkflowId(interfaceOperation.getWorkflowId());
+ operationData.setWorkflowVersionId(interfaceOperation.getWorkflowVersionId());
return operationData;
}
interfaceOperationDataDefinition.setInputParams(inputParams);
interfaceOperationDataDefinition.setOutputParams(outputParams);
interfaceOperationDataDefinition.setArtifactUUID(operationData.getImplementation().getArtifactUUID());
+ interfaceOperationDataDefinition.setWorkflowId(operationData.getWorkflowId());
+ interfaceOperationDataDefinition.setWorkflowVersionId(operationData.getWorkflowVersionId());
return interfaceOperationDataDefinition;
}
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;
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;
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);
private List<String> defaultCapabilities;
- private Map<String, InterfaceOperationDataDefinition> interfaceOperations;
-
public Resource() {
super(new ResourceMetadataDefinition());
this.getComponentMetadataDefinition().getMetadataDataDefinition().setComponentType(ComponentTypeEnum.RESOURCE);
.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;
return false;
} else if (!properties.equals(other.properties))
return false;
-
return super.equals(obj);
}
}
- @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;
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 {
setToscaResourceName(iodd.getToscaResourceName());
setOperationType(iodd.getOperationType());
setArtifactUUID(iodd.getArtifactUUID());
+ setWorkflowId(iodd.getWorkflowId());
+ setWorkflowVersionId(iodd.getWorkflowVersionId());
}
public ListDataDefinition<InterfaceOperationParamDataDefinition> getInputParams() {
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);
}
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 {
setOutputs(p.getOutputs());
setName(p.getName());
setUniqueId(p.getUniqueId());
+ setWorkflowId(p.getWorkflowId());
+ setWorkflowVersionId(p.getWorkflowVersionId());
}
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);
+ }
+
}
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),
#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
{
"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"
}
]
},
}
]
},
- "operationType": "create"
+ "operationType": "create",
+ "workflowId" : "w_id1",
+ "workflowVersionId" : "w_version_id11"
}
}
}
\ No newline at end of file
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};
});
+
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)=> {