aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2020-09-02 14:10:04 -0400
committerKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2020-09-02 16:06:01 -0400
commite170f7c258c5dd147e647139ff2553a5c0fb0325 (patch)
tree891a49c93c7799a7172d0d1f454ac88159893889
parent43b5a2bbbe54e131981fdb96d831efc9169ddf3f (diff)
Bpmn to cnf adapter implementation testing bpmn
BPMN changes related to CNF Adapter Change-Id: I5b41b7b0a3dbc3036bbdce7f1f9cf62832b44c7f Issue-ID: SO-3199 Signed-off-by: Kalkere Ramesh, Sharan <sk720x@att.com>
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn80
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java36
2 files changed, 116 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn
new file mode 100644
index 0000000000..6cd2c20ab9
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+ <bpmn:process id="Process_1" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_0xb4elc</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1ee5kqt">
+ <bpmn:incoming>SequenceFlow_0lc785k</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0xb4elc" sourceRef="StartEvent_1" targetRef="Task_0amo55n" />
+ <bpmn:sequenceFlow id="SequenceFlow_0lc785k" sourceRef="Task_0amo55n" targetRef="EndEvent_1ee5kqt" />
+ <bpmn:serviceTask id="Task_0amo55n" name="Call CnfAdapter" camunda:expression="${CnfAdapter.callCnfAdapter(execution)}">
+ <bpmn:incoming>SequenceFlow_0xb4elc</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0lc785k</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:subProcess id="SubProcess_12ghmoa" name="Java Exception Handling Sub Process" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_1pwqeib" name="error">
+ <bpmn:outgoing>SequenceFlow_0hqxgyk</bpmn:outgoing>
+ <bpmn:errorEventDefinition errorRef="Error_0oqb77k" camunda:errorCodeVariable="BPMN_javaExpCode" camunda:errorMessageVariable="BPMN_javaExpMsg" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1ysk6aa">
+ <bpmn:incoming>SequenceFlow_0hqxgyk</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0hqxgyk" sourceRef="StartEvent_1pwqeib" targetRef="EndEvent_1ysk6aa" />
+ </bpmn:subProcess>
+ </bpmn:process>
+ <bpmn:error id="Error_0oqb77k" name="java.lang.Exception" errorCode="java.lang.Exception" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1ee5kqt_di" bpmnElement="EndEvent_1ee5kqt">
+ <dc:Bounds x="636" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="654" y="142" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xb4elc_di" bpmnElement="SequenceFlow_0xb4elc">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="377" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="293" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0lc785k_di" bpmnElement="SequenceFlow_0lc785k">
+ <di:waypoint xsi:type="dc:Point" x="477" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="636" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="556.5" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1vbkgmd_di" bpmnElement="Task_0amo55n">
+ <dc:Bounds x="377" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_12ghmoa_di" bpmnElement="SubProcess_12ghmoa" isExpanded="true">
+ <dc:Bounds x="225" y="284" width="404" height="165" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_1pwqeib_di" bpmnElement="StartEvent_1pwqeib">
+ <dc:Bounds x="340" y="350" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="346" y="393" width="26" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1ysk6aa_di" bpmnElement="EndEvent_1ysk6aa">
+ <dc:Bounds x="472" y="350" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-235" y="114" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0hqxgyk_di" bpmnElement="SequenceFlow_0hqxgyk">
+ <di:waypoint xsi:type="dc:Point" x="376" y="368" />
+ <di:waypoint xsi:type="dc:Point" x="472" y="368" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="424" y="347" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java
new file mode 100644
index 0000000000..c21b467a95
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java
@@ -0,0 +1,36 @@
+package org.onap.so.bpmn.infrastructure.adapter.cnf.tasks;
+
+import java.io.IOException;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowAction;
+import org.onap.so.client.adapter.cnf.CnfAdapterClient;
+import org.onap.so.client.adapter.cnf.CnfAdapterClientException;
+import org.onap.so.client.adapter.cnf.entities.InstanceRequest;
+import org.onap.so.client.adapter.cnf.entities.InstanceResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class CnfAdapter {
+
+ @Autowired
+ private CnfAdapterClient cnfAdapterClient;
+
+ private static final Logger logger = LoggerFactory.getLogger(CnfAdapter.class);
+
+ public void callCnfAdapter(DelegateExecution execution) throws Exception {
+ try {
+ final String instanceRequest = (String) execution.getVariable("instanceRequest");
+ InstanceRequest request = new ObjectMapper().readValue(instanceRequest, InstanceRequest.class);
+ InstanceResponse response = cnfAdapterClient.createVfModule(request);
+ } catch (Exception ex) {
+ logger.error("Exception in callCnfAdapter", ex);
+ throw ex;
+ }
+ }
+}