Skip to content

Commit

Permalink
Fix issue with async and exclusive attributes in Modeler
Browse files Browse the repository at this point in the history
  • Loading branch information
tijsrademakers committed Aug 9, 2020
1 parent 5906d1c commit 6789c75
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.flowable.editor.language.xml;

import static org.assertj.core.api.Assertions.assertThat;

import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.ParallelGateway;
import org.junit.Test;

/**
* @author martin.grofcik
*/
public class ParallelGatewayConverterTest extends AbstractConverterTest {

@Test
public void convertXMLToModel() throws Exception {
BpmnModel bpmnModel = readXMLFile();
validateModel(bpmnModel);
}

@Override
protected String getResource() {
return "parallelgatewaymodel.bpmn";
}

private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("parallelGateway");
assertThat(flowElement).isNotNull();
assertThat(flowElement).isInstanceOf(ParallelGateway.class);

ParallelGateway gateway = (ParallelGateway) flowElement;
assertThat(gateway.isAsynchronous()).isTrue();
assertThat(gateway.isExclusive()).isFalse();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:flowable="http://flowable.org/bpmn"
typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/test">
<process id="parallelGatewayProcess" name="parallelGatewayProcess" isExecutable="true">
<endEvent id="endEvent"></endEvent>
<sequenceFlow id="flow2" sourceRef="startEvent" targetRef="parallelGateway"></sequenceFlow>
<parallelGateway id="parallelGateway" name="parallelGateway" flowable:async="true" flowable:exclusive="false"/>
<startEvent id="startEvent"></startEvent>
<sequenceFlow id="flow1" sourceRef="parallelGateway" targetRef="endEvent"></sequenceFlow>
</process>
</definitions>
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ public void convertToJson(BpmnJsonConverterContext converterContext, BaseElement
}
}
}

} else if (baseElement instanceof Gateway) {
Gateway gateway = (Gateway) baseElement;
propertiesNode.put(PROPERTY_ASYNCHRONOUS, gateway.isAsynchronous());
propertiesNode.put(PROPERTY_EXCLUSIVE, !gateway.isNotExclusive());
}

if (baseElement instanceof FlowElement) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ public void convertJsonToModel() throws Exception {
BpmnModel bpmnModel = readJsonFile();
validateModel(bpmnModel);
}

@Test
public void doubleConversionValidation() throws Exception {
BpmnModel bpmnModel = readJsonFile();
bpmnModel = convertToJsonAndBack(bpmnModel);
validateModel(bpmnModel);
}

@Override
protected String getResource() {
Expand Down

0 comments on commit 6789c75

Please sign in to comment.