diff options
Diffstat (limited to 'sdc-workflow-designer-server/src/test')
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>
+
|