--- /dev/null
+/**\r
+ * Copyright (c) 2017 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the Apache License, Version 2.0\r
+ * and the Eclipse Public License v1.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.planwriter;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+\r
+import java.io.BufferedReader;\r
+import java.io.File;\r
+import java.io.FileReader;\r
+import java.io.IOException;\r
+\r
+import org.junit.Test;\r
+import org.onap.sdc.workflowdesigner.model.Process;\r
+import org.onap.sdc.workflowdesigner.writer.BpmnPlanArtefactWriter;\r
+\r
+public class BpmnPlanArtefactWriterTest {\r
+\r
+ @Test\r
+ public void testWritePlan() throws Exception {\r
+ BpmnPlanArtefactWriter writer = new BpmnPlanArtefactWriter(mockProcss());\r
+ String result = writer.completePlanTemplate();\r
+ assertEquals(result, getResult());\r
+ }\r
+\r
+ private Process mockProcss() {\r
+ Process process = new Process("templateTest");\r
+\r
+ return process;\r
+ }\r
+\r
+ public String getResult() throws IOException {\r
+ StringBuffer buffer = new StringBuffer();\r
+\r
+ String path = "src/test/resources/workflow/template-test.bpmn20.xml";\r
+ BufferedReader reader = new BufferedReader(new FileReader(new File(path)));\r
+\r
+ String line = null;\r
+ while ((line = reader.readLine()) != null) {\r
+ buffer.append(line).append("\r\n");\r
+ }\r
+\r
+ if (reader != null) {\r
+ reader.close();\r
+ }\r
+\r
+ return buffer.toString();\r
+ }\r
+\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"\r
+ xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"\r
+ typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath"\r
+ targetNamespace="http://www.activiti.org/test">\r
+ <process id="templateTest" isExecutable="true">\r
+\r
+ </process>\r
+</definitions>\r
+\r