2 * Copyright (c) 2017 ZTE Corporation.
\r
3 * All rights reserved. This program and the accompanying materials
\r
4 * are made available under the Apache License, Version 2.0
\r
5 * and the Eclipse Public License v1.0 which both accompany this distribution,
\r
6 * and are available at http://www.eclipse.org/legal/epl-v10.html
\r
7 * and http://www.apache.org/licenses/LICENSE-2.0
\r
10 * ZTE - initial API and implementation and/or initial documentation
\r
12 package org.onap.sdc.workflowdesigner.planwriter;
\r
14 import static org.junit.Assert.assertEquals;
\r
16 import java.io.BufferedReader;
\r
17 import java.io.File;
\r
18 import java.io.FileReader;
\r
19 import java.io.IOException;
\r
21 import org.junit.Test;
\r
22 import org.onap.sdc.workflowdesigner.model.Process;
\r
23 import org.onap.sdc.workflowdesigner.writer.BpmnPlanArtefactWriter;
\r
25 public class BpmnPlanArtefactWriterTest {
\r
28 public void testWritePlan() throws Exception {
\r
29 BpmnPlanArtefactWriter writer = new BpmnPlanArtefactWriter(mockProcss());
\r
30 String result = writer.completePlanTemplate();
\r
31 assertEquals(result, getResult());
\r
34 private Process mockProcss() {
\r
35 Process process = new Process("templateTest");
\r
40 public String getResult() throws IOException {
\r
41 StringBuffer buffer = new StringBuffer();
\r
43 String path = "src/test/resources/workflow/template-test.bpmn20.xml";
\r
44 BufferedReader reader = new BufferedReader(new FileReader(new File(path)));
\r
47 while ((line = reader.readLine()) != null) {
\r
48 buffer.append(line).append("\r\n");
\r
51 if (reader != null) {
\r
55 return buffer.toString();
\r