From e170f7c258c5dd147e647139ff2553a5c0fb0325 Mon Sep 17 00:00:00 2001 From: "Kalkere Ramesh, Sharan (sk720x)" Date: Wed, 2 Sep 2020 14:10:04 -0400 Subject: 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 --- .../adapter/cnf/tasks/CnfAdapter.java | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java (limited to 'bpmn/so-bpmn-tasks') 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; + } + } +} -- cgit 1.2.3-korg