aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-server
diff options
context:
space:
mode:
authorLvbo163 <lv.bo163@zte.com.cn>2017-09-27 14:03:35 +0800
committerLvbo163 <lv.bo163@zte.com.cn>2017-09-27 14:10:38 +0800
commitd80dca72097ee2adb414ffa2523e06a9ec893e0f (patch)
tree27085db48f5f68406adcc99cbb39a2336c137f65 /sdc-workflow-designer-server
parent836867d7ae5c90c72072e7b0ffe5c43c8c5be120 (diff)
Add unit test for bpmn workflow converter
Issue-ID: SDC-404 Change-Id: Ie6f897f06b0e759992d3ba6e65c719a84a40f143 Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-server')
-rw-r--r--sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/convert/BPMN4Tosca2BpmnTest.java39
-rw-r--r--sdc-workflow-designer-server/src/test/resources/workflow/workflow.json17
2 files changed, 56 insertions, 0 deletions
diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/convert/BPMN4Tosca2BpmnTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/convert/BPMN4Tosca2BpmnTest.java
new file mode 100644
index 00000000..fc423a1a
--- /dev/null
+++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/convert/BPMN4Tosca2BpmnTest.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2017 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.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.convert;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.net.URI;
+import java.nio.file.Paths;
+
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.junit.Test;
+import org.onap.sdc.workflowdesigner.converter.Bpmn4Tosca2Bpmn;
+
+public class BPMN4Tosca2BpmnTest {
+ private static String RESOURCES_DIR = "src/test/resources/workflow";
+
+ @Test
+ public void testTransform() throws ResourceNotFoundException, ParseErrorException, Exception {
+
+ URI srcUri = Paths.get(RESOURCES_DIR, "workflow.json").toUri();
+ URI targetUri = Paths.get(RESOURCES_DIR, "bpmnworkflow.bpmn20.xml").toUri();
+ BPMN4Tosca2BpmnTest.class.getResource(".");
+ Bpmn4Tosca2Bpmn transformer = new Bpmn4Tosca2Bpmn();
+ transformer.transform("transformTest", srcUri, targetUri);
+ assertTrue(new File(targetUri.getPath()).exists());
+ }
+
+}
diff --git a/sdc-workflow-designer-server/src/test/resources/workflow/workflow.json b/sdc-workflow-designer-server/src/test/resources/workflow/workflow.json
new file mode 100644
index 00000000..4799fc99
--- /dev/null
+++ b/sdc-workflow-designer-server/src/test/resources/workflow/workflow.json
@@ -0,0 +1,17 @@
+{"nodes":[
+ {
+ "sequenceFlows":[
+ {"condition":"","sourceRef":"node0","targetRef":"node1"},
+ {"condition":"","sourceRef":"node0","targetRef":"node3"}
+ ],
+ "parameters":[],"id":"node0","name":"startEvent","type":"startEvent","parentId":"root",
+ "position":{"width":30,"height":30,"left":468,"top":55}
+ },
+ {
+ "sequenceFlows":[{"condition":"","sourceRef":"node1","targetRef":"node2"}],
+ "input":[],"output":[],"template":{},"id":"node1","name":"endEvent",
+ "type":"endEvent","parentId":"root",
+ "position":{"width":252.08334350585938,"height":46.66666793823242,"left":432,"top":167}
+ }],
+"configs":{"restConfigs":[]}
+} \ No newline at end of file