blob: 7236d6e60a3c80fc1de85f7be15b372346a6982b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/**
* Copyright (c) 2017-2018 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();
}
}
|