Add unit test for bpmn workflow converter 95/15795/2
authorLvbo163 <lv.bo163@zte.com.cn>
Wed, 27 Sep 2017 06:03:35 +0000 (14:03 +0800)
committerLvbo163 <lv.bo163@zte.com.cn>
Wed, 27 Sep 2017 06:10:38 +0000 (14:10 +0800)
Issue-ID: SDC-404

Change-Id: Ie6f897f06b0e759992d3ba6e65c719a84a40f143
Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/convert/BPMN4Tosca2BpmnTest.java [new file with mode: 0644]
sdc-workflow-designer-server/src/test/resources/workflow/workflow.json [new file with mode: 0644]

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 (file)
index 0000000..fc423a1
--- /dev/null
@@ -0,0 +1,39 @@
+/**\r
+ * Copyright (c) 2017 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * and the Apache License 2.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ *     ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner.convert;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.File;\r
+import java.net.URI;\r
+import java.nio.file.Paths;\r
+\r
+import org.apache.velocity.exception.ParseErrorException;\r
+import org.apache.velocity.exception.ResourceNotFoundException;\r
+import org.junit.Test;\r
+import org.onap.sdc.workflowdesigner.converter.Bpmn4Tosca2Bpmn;\r
+\r
+public class BPMN4Tosca2BpmnTest {\r
+    private static String RESOURCES_DIR = "src/test/resources/workflow";\r
+\r
+    @Test\r
+    public void testTransform() throws ResourceNotFoundException, ParseErrorException, Exception {\r
+\r
+        URI srcUri = Paths.get(RESOURCES_DIR, "workflow.json").toUri();\r
+        URI targetUri = Paths.get(RESOURCES_DIR, "bpmnworkflow.bpmn20.xml").toUri();\r
+        BPMN4Tosca2BpmnTest.class.getResource(".");\r
+        Bpmn4Tosca2Bpmn transformer = new Bpmn4Tosca2Bpmn();\r
+        transformer.transform("transformTest", srcUri, targetUri);\r
+        assertTrue(new File(targetUri.getPath()).exists());\r
+    }\r
+\r
+}\r
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 (file)
index 0000000..4799fc9
--- /dev/null
@@ -0,0 +1,17 @@
+{"nodes":[\r
+        {\r
+            "sequenceFlows":[\r
+                {"condition":"","sourceRef":"node0","targetRef":"node1"},\r
+                {"condition":"","sourceRef":"node0","targetRef":"node3"}\r
+            ],\r
+            "parameters":[],"id":"node0","name":"startEvent","type":"startEvent","parentId":"root",\r
+            "position":{"width":30,"height":30,"left":468,"top":55}\r
+        },\r
+        {\r
+            "sequenceFlows":[{"condition":"","sourceRef":"node1","targetRef":"node2"}],\r
+            "input":[],"output":[],"template":{},"id":"node1","name":"endEvent",\r
+            "type":"endEvent","parentId":"root",\r
+            "position":{"width":252.08334350585938,"height":46.66666793823242,"left":432,"top":167}\r
+        }],\r
+"configs":{"restConfigs":[]}\r
+}
\ No newline at end of file