use of org.activiti.bpmn.converter.BpmnXMLConverter in project Activiti by Activiti.
the class LaneExtensionTest method testLaneExtensionElement.
@Test
@Deployment
public void testLaneExtensionElement() {
ProcessDefinition processDefinition = activitiRule.getRepositoryService().createProcessDefinitionQuery().processDefinitionKey("swimlane-extension").singleResult();
BpmnModel bpmnModel = activitiRule.getRepositoryService().getBpmnModel(processDefinition.getId());
byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);
System.out.println(new String(xml));
Process bpmnProcess = bpmnModel.getMainProcess();
for (Lane l : bpmnProcess.getLanes()) {
Map<String, List<ExtensionElement>> extensions = l.getExtensionElements();
Assert.assertTrue(extensions.size() > 0);
}
}
use of org.activiti.bpmn.converter.BpmnXMLConverter in project Activiti by Activiti.
the class ImportExportTest method readXMLFile.
protected BpmnModel readXMLFile() throws Exception {
InputStream xmlStream = this.getClass().getClassLoader().getResourceAsStream(getResource());
StreamSource xmlSource = new InputStreamSource(xmlStream);
BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xmlSource, false, false, processEngineConfiguration.getXmlEncoding());
return bpmnModel;
}
use of org.activiti.bpmn.converter.BpmnXMLConverter in project Activiti by Activiti.
the class ImportExportTest method testConvertXMLToModel.
public void testConvertXMLToModel() throws Exception {
BpmnModel bpmnModel = readXMLFile();
bpmnModel = exportAndReadXMLFile(bpmnModel);
byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);
org.activiti.engine.repository.Deployment deployment = processEngine.getRepositoryService().createDeployment().name("test1").addString("test1.bpmn20.xml", new String(xml)).deploy();
String processInstanceKey = runtimeService.startProcessInstanceByKey("process").getId();
Execution execution = runtimeService.createExecutionQuery().processInstanceId(processInstanceKey).messageEventSubscriptionName("InterruptMessage").singleResult();
assertNotNull(execution);
}
use of org.activiti.bpmn.converter.BpmnXMLConverter in project Activiti by Activiti.
the class ImportExportTest method exportAndReadXMLFile.
protected BpmnModel exportAndReadXMLFile(BpmnModel bpmnModel) throws Exception {
byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel, processEngineConfiguration.getXmlEncoding());
StreamSource xmlSource = new InputStreamSource(new ByteArrayInputStream(xml));
BpmnModel parsedModel = new BpmnXMLConverter().convertToBpmnModel(xmlSource, false, false, processEngineConfiguration.getXmlEncoding());
return parsedModel;
}
use of org.activiti.bpmn.converter.BpmnXMLConverter in project Activiti by Activiti.
the class CallActivityTest method loadBPMNModel.
protected BpmnModel loadBPMNModel(String bpmnModelFilePath) throws Exception {
InputStream xmlStream = this.getClass().getClassLoader().getResourceAsStream(bpmnModelFilePath);
StreamSource xmlSource = new InputStreamSource(xmlStream);
BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xmlSource, false, false, processEngineConfiguration.getXmlEncoding());
return bpmnModel;
}
Aggregations