Merge "Add SO native workflows to result list" into dublin
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
index 890b547..e8171ac 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
@@ -73,6 +73,7 @@
private static Logger logger = LoggerFactory.getLogger(WorkflowSpecificationsHandler.class);
private static final String ARTIFACT_TYPE_WORKFLOW = "workflow";
+ private static final String NATIVE_WORKFLOW = "native";
@Path("/{version:[vV]1}/workflows")
@GET
@@ -88,6 +89,12 @@
mapper1.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
List<Workflow> workflows = catalogDbClient.findWorkflowByModelUUID(vnfModelVersionId);
+
+ List<Workflow> nativeWorkflows = catalogDbClient.findWorkflowBySource(NATIVE_WORKFLOW);
+ if (nativeWorkflows != null && nativeWorkflows.size() != 0) {
+ workflows.addAll(nativeWorkflows);
+ }
+
WorkflowSpecifications workflowSpecifications = mapWorkflowsToWorkflowSpecifications(workflows);
String jsonResponse = null;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
index 915018f..0beab1b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
@@ -297,6 +297,17 @@
workflow.setWorkflowActivitySpecSequence(workflowActivitySpecSequences);
workflows.add(workflow);
+ Workflow workflowNative = new Workflow();
+ workflowNative.setArtifactUUID("da6478e4-ea33-3346-ac12-ab121284a333");
+ workflowNative.setArtifactName("VnfInPlaceUpdate.bpmn");
+ workflowNative.setVersion(1.0);
+ workflowNative.setDescription("native workflow");
+ workflowNative.setName("VnfInPlaceUpdate");
+ workflowNative.setOperationName("inPlaceSoftwareUpdate");
+ workflowNative.setSource("native");
+ workflowNative.setResourceTarget("vnf");
+ workflows.add(workflowNative);
+
WorkflowSpecifications workflowSpecifications =
workflowSpecificationsHandler.mapWorkflowsToWorkflowSpecifications(workflows);
ObjectMapper mapper = new ObjectMapper();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecifications.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecifications.json
index 5556c60..545fbbe 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecifications.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecifications.json
@@ -108,6 +108,22 @@
}
]
}
+ },
+ {
+ "workflowSpecification": {
+
+ "artifactInfo": {
+ "artifactType": "workflow",
+ "artifactUuid": "da6478e4-ea33-3346-ac12-ab121284a333",
+ "artifactName": "VnfInPlaceUpdate.bpmn",
+ "artifactVersion": "1.0",
+ "artifactDescription": "native workflow",
+ "workflowName": "VnfInPlaceUpdate",
+ "operationName": "inPlaceSoftwareUpdate",
+ "workflowSource": "native",
+ "workflowResourceTarget": "vnf"
+ }
+ }
}
]
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsQuery_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsQuery_Response.json
index cbbf0b6..8919dbb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsQuery_Response.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsQuery_Response.json
@@ -458,6 +458,35 @@
"href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/activitySpec"
}
}
+ },
+ {
+ "artifactUUID": "da6478e4-ea33-3346-ac12-ab121284a333",
+ "artifactName": "VnfInPlaceUpdate.bpmn",
+ "name": "VnfInPlaceUpdate",
+ "operationName": "inPlaceSoftwareUpdate",
+ "version": 1,
+ "description": "native workflow",
+ "body": null,
+ "resourceTarget": "vnf",
+ "source": "native",
+ "timeoutMinutes": null,
+ "artifactChecksum": null,
+ "created": null,
+ "vnfResourceWorkflow": null,
+ "workflowActivitySpecSequence": [],
+ "id": null,
+ "workflow": null,
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52"
+ },
+ "workflowActivitySpecSequence": {
+ "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence"
+ },
+ "activitySpec": {
+ "href": "http://localhost:8090/workflows/b5fa707a-f55a-11e7-a796-005056856d52/activitySpec"
+ }
+ }
}
]
},