aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-server/src/main/java/org
diff options
context:
space:
mode:
authorYuanHu <yuan.hu1@zte.com.cn>2018-03-28 09:02:58 +0800
committerYuanHu <yuan.hu1@zte.com.cn>2018-03-28 09:02:58 +0800
commit4fd794f4f23237fbc18e4d5319d639d85b21aacb (patch)
tree8c82dcaa981268d42f590420a86677b12cffda7f /sdc-workflow-designer-server/src/main/java/org
parent0e813dd358952d25d49de4833d09964dba5e42a0 (diff)
Add Unit Test & Remove redundant code
Add Unit Test & Remove redundant code Issue-ID: SDC-1078 Change-Id: I83ee83f3265386373749463c43dced047d4aa407 Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-server/src/main/java/org')
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java56
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java52
2 files changed, 26 insertions, 82 deletions
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java
deleted file mode 100644
index 0b4f2edb..00000000
--- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.converter;
-
-import java.net.URI;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardOpenOption;
-
-import org.onap.sdc.workflowdesigner.model.Process;
-import org.onap.sdc.workflowdesigner.parser.Bpmn4ToscaJsonParser;
-import org.onap.sdc.workflowdesigner.writer.BpmnPlanArtefactWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Bpmn4Tosca2Bpmn {
-
- private static Logger log = LoggerFactory.getLogger(Bpmn4Tosca2Bpmn.class);
-
- /**
- * Transforms the given BPMN4Tosca Json management into a bpmn plan that can
- * be excuted by activiti.
- * <p>
- *
- * @param srcBpmn4ToscaJsonFile
- * @param targetBpmnArchive
- * @throws Exception
- */
- public void transform(String processId, URI srcBpmn4ToscaJsonFile, URI targetBpmnArchive) throws Exception {
- log.info("transform start");
-
- // parse json object
- Bpmn4ToscaJsonParser parser = new Bpmn4ToscaJsonParser();
- Process process = parser.parse(processId, srcBpmn4ToscaJsonFile);
-
- // transform bpmn template
- BpmnPlanArtefactWriter writer = new BpmnPlanArtefactWriter(process);
- String workflowString = writer.completePlanTemplate();
-
- // write bpmn to file
- Path targetPath = Paths.get(targetBpmnArchive);
- Files.write(targetPath, workflowString.getBytes(), StandardOpenOption.CREATE);
- log.info("transform end");
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java
index fe736890..0f0e2dd8 100644
--- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java
@@ -14,9 +14,9 @@ package org.onap.sdc.workflowdesigner.resources;
import java.io.IOException;
import java.net.URI;
-import java.nio.file.Paths;
+//import java.nio.file.Paths;
import java.util.List;
-import java.util.UUID;
+//import java.util.UUID;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
@@ -32,14 +32,14 @@ import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.eclipse.jetty.http.HttpStatus;
-import org.onap.sdc.workflowdesigner.common.WorkflowDesignerException;
-import org.onap.sdc.workflowdesigner.externalservice.sdc.SDCServiceProxy;
-import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.WorkflowArtifactInfo;
+//import org.onap.sdc.workflowdesigner.common.WorkflowDesignerException;
+//import org.onap.sdc.workflowdesigner.externalservice.sdc.SDCServiceProxy;
+//import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.WorkflowArtifactInfo;
import org.onap.sdc.workflowdesigner.model.Process;
import org.onap.sdc.workflowdesigner.parser.Bpmn4ToscaJsonParser;
-import org.onap.sdc.workflowdesigner.resources.entity.WorkflowInfo;
+//import org.onap.sdc.workflowdesigner.resources.entity.WorkflowInfo;
import org.onap.sdc.workflowdesigner.utils.FileCommonUtils;
-import org.onap.sdc.workflowdesigner.utils.JsonUtils;
+//import org.onap.sdc.workflowdesigner.utils.JsonUtils;
import org.onap.sdc.workflowdesigner.utils.RestUtils;
import org.onap.sdc.workflowdesigner.writer.BpmnPlanArtefactWriter;
import org.slf4j.Logger;
@@ -63,7 +63,7 @@ public class WorkflowModelerResource {
private static final Logger logger = LoggerFactory.getLogger(WorkflowModelerResource.class);
private static final String WORKFLOW_JSON_TEMP_FILE_NAME = "temp_workflow.json";
- private static final String WORKFLOW_XML_TEMP_FILE_NAME = "temp_workflow.xml";
+// private static final String WORKFLOW_XML_TEMP_FILE_NAME = "temp_workflow.xml";
/**
@@ -112,10 +112,10 @@ public class WorkflowModelerResource {
@ApiParam(value = "Model Content", required = true) String json) {
try {
FileCommonUtils.write(WORKFLOW_JSON_TEMP_FILE_NAME, json);
-
- URI srcUri = Paths.get(".", WORKFLOW_JSON_TEMP_FILE_NAME).toUri();
- String processName = "plan_" + UUID.randomUUID().toString();
- // TODO for Nexus-IQ
+
+ // TODO for Nexus-IQ
+// URI srcUri = Paths.get(".", WORKFLOW_JSON_TEMP_FILE_NAME).toUri();
+// String processName = "plan_" + UUID.randomUUID().toString();
// String bpmn = buildBPMN(srcUri, processName);
// String jsonBpmn = insertJson2Bpmn(json, bpmn);
@@ -163,20 +163,20 @@ public class WorkflowModelerResource {
}
- /**
- * @param json
- * @param bpmn
- * @throws WorkflowDesignerException
- */
- private void save2SDC(String json, String bpmn) throws WorkflowDesignerException {
- WorkflowInfo workflowInfo = JsonUtils.fromJson(json, WorkflowInfo.class);
- WorkflowArtifactInfo workflowArtifactInfo =
- new WorkflowArtifactInfo(workflowInfo.getName(), workflowInfo.getDescription(), bpmn);
-
- SDCServiceProxy sdcProxy = new SDCServiceProxy();
- sdcProxy.saveWorkflowArtifact(workflowInfo.getUuid(), workflowInfo.getOperationId(),
- workflowInfo.getId(), workflowArtifactInfo);
- }
+// /**
+// * @param json
+// * @param bpmn
+// * @throws WorkflowDesignerException
+// */
+// private void save2SDC(String json, String bpmn) throws WorkflowDesignerException {
+// WorkflowInfo workflowInfo = JsonUtils.fromJson(json, WorkflowInfo.class);
+// WorkflowArtifactInfo workflowArtifactInfo =
+// new WorkflowArtifactInfo(workflowInfo.getName(), workflowInfo.getDescription(), bpmn);
+//
+// SDCServiceProxy sdcProxy = new SDCServiceProxy();
+// sdcProxy.saveWorkflowArtifact(workflowInfo.getUuid(), workflowInfo.getOperationId(),
+// workflowInfo.getId(), workflowArtifactInfo);
+// }
/**
*