summaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-server/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'sdc-workflow-designer-server/src/test/java')
-rw-r--r--sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/planwriter/BpmnPlanArtefactWriterTest.java58
1 files changed, 58 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();
+ }
+
+}