use of org.activiti.bpmn.converter.util.InputStreamProvider in project Activiti by Activiti.
the class PrefixConversionTest method shouldConvertWithoutDoublingTheBPMN2PrefixWhenAbpmnFileWithPrefixIsGiven.
@Test
public void shouldConvertWithoutDoublingTheBPMN2PrefixWhenAbpmnFileWithPrefixIsGiven() throws IOException {
final InputStream originalXMLStream = this.getClass().getClassLoader().getResourceAsStream("checkConversionPrefix.bpmn");
final InputStream copiedXMLStream = this.getClass().getClassLoader().getResourceAsStream("checkConversionPrefix.bpmn");
BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
byte[] byteOriginalXMLStream = new byte[originalXMLStream.available()];
originalXMLStream.read(byteOriginalXMLStream);
BpmnModel bpmnModel = bpmnXMLConverter.convertToBpmnModel(new InputStreamProvider() {
@Override
public InputStream getInputStream() {
return copiedXMLStream;
}
}, false, false);
byte[] bytesReconvertedXMLModel = bpmnXMLConverter.convertToXML(bpmnModel);
String stringifyOriginalXML = new String(byteOriginalXMLStream);
String stringifyReconvertedModel = new String(bytesReconvertedXMLModel);
assertThat(stringifyReconvertedModel).isXmlEqualTo(stringifyOriginalXML);
}
use of org.activiti.bpmn.converter.util.InputStreamProvider in project Activiti by Activiti.
the class ProcessWithCompensationConverterTest method testConvertingAfterAutoLayout.
@Test
public void testConvertingAfterAutoLayout() {
final InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ProcessWithCompensationAssociation.bpmn20.xml");
BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
BpmnModel bpmnModel1 = bpmnXMLConverter.convertToBpmnModel(new InputStreamProvider() {
@Override
public InputStream getInputStream() {
return inputStream;
}
}, false, false);
if (bpmnModel1.getLocationMap().size() == 0) {
BpmnAutoLayout bpmnLayout = new BpmnAutoLayout(bpmnModel1);
bpmnLayout.execute();
}
byte[] xmlByte = bpmnXMLConverter.convertToXML(bpmnModel1);
final InputStream byteArrayInputStream = new ByteArrayInputStream(xmlByte);
BpmnModel bpmnModel2 = bpmnXMLConverter.convertToBpmnModel(new InputStreamProvider() {
@Override
public InputStream getInputStream() {
return byteArrayInputStream;
}
}, false, false);
assertThat(bpmnModel1.getLocationMap()).hasSize(10);
assertThat(bpmnModel2.getLocationMap()).hasSize(10);
assertThat(bpmnModel1.getFlowLocationMap()).hasSize(7);
assertThat(bpmnModel2.getFlowLocationMap()).hasSize(7);
}
Aggregations