aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLvbo163 <lv.bo163@zte.com.cn>2017-09-27 17:05:21 +0800
committerLvbo163 <lv.bo163@zte.com.cn>2017-09-27 17:05:21 +0800
commit78f074e7aaa6daa5af34089b19c70d11fdc758d9 (patch)
treea97efd1290912e45fa7c09b2398f53d8efebd1ff
parentd6ba0b7ccf2d6a8a3c94ee062acab3ecf8d5bd2d (diff)
add unit test for bpmn workflow template convert
Issue-ID: SDC-409 Change-Id: I7a7b09c9d9f07b580a9bd6be158bdf606a77717f Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
-rw-r--r--sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/planwriter/BpmnPlanArtefactWriterTest.java58
-rw-r--r--sdc-workflow-designer-server/src/test/resources/workflow/template-test.bpmn20.xml12
2 files changed, 70 insertions, 0 deletions
diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/planwriter/BpmnPlanArtefactWriterTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/planwriter/BpmnPlanArtefactWriterTest.java
new file mode 100644
index 00000000..342b566c
--- /dev/null
+++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/planwriter/BpmnPlanArtefactWriterTest.java
@@ -0,0 +1,58 @@
+/**
+ * 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.planwriter;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.junit.Test;
+import org.onap.sdc.workflowdesigner.model.Process;
+import org.onap.sdc.workflowdesigner.writer.BpmnPlanArtefactWriter;
+
+public class BpmnPlanArtefactWriterTest {
+
+ @Test
+ public void testWritePlan() throws Exception {
+ BpmnPlanArtefactWriter writer = new BpmnPlanArtefactWriter(mockProcss());
+ String result = writer.completePlanTemplate();
+ assertEquals(result, getResult());
+ }
+
+ private Process mockProcss() {
+ Process process = new Process("templateTest");
+
+ return process;
+ }
+
+ public String getResult() throws IOException {
+ StringBuffer buffer = new StringBuffer();
+
+ String path = "src/test/resources/workflow/template-test.bpmn20.xml";
+ BufferedReader reader = new BufferedReader(new FileReader(new File(path)));
+
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ buffer.append(line).append("\r\n");
+ }
+
+ if (reader != null) {
+ reader.close();
+ }
+
+ return buffer.toString();
+ }
+
+}
diff --git a/sdc-workflow-designer-server/src/test/resources/workflow/template-test.bpmn20.xml b/sdc-workflow-designer-server/src/test/resources/workflow/template-test.bpmn20.xml
new file mode 100644
index 00000000..e7084c6f
--- /dev/null
+++ b/sdc-workflow-designer-server/src/test/resources/workflow/template-test.bpmn20.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
+ xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
+ typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath"
+ targetNamespace="http://www.activiti.org/test">
+ <process id="templateTest" isExecutable="true">
+
+ </process>
+</definitions>
+