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