forked from flowable/flowable-engine
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add validation check for BPMN event variable listener with empty vari…
…able name (flowable#3908)
- Loading branch information
1 parent
727841e
commit 473fc25
Showing
7 changed files
with
211 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...test/java/org/flowable/editor/language/xml/VariableListenerEventDefinitionParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* 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 static org.flowable.bpmn.constants.BpmnXMLConstants.ELEMENT_EVENT_VARIABLELISTENERDEFINITION; | ||
|
||
import org.flowable.bpmn.model.BpmnModel; | ||
import org.flowable.bpmn.model.EventSubProcess; | ||
import org.flowable.bpmn.model.FlowElement; | ||
import org.flowable.bpmn.model.StartEvent; | ||
import org.flowable.editor.language.xml.util.BpmnXmlConverterTest; | ||
|
||
class VariableListenerEventDefinitionParserTest { | ||
|
||
@BpmnXmlConverterTest("missingVariableListenerVariableName.bpmn") | ||
void validateModel(BpmnModel model) { | ||
|
||
FlowElement flowElement = model.getMainProcess().getFlowElement("eventSubProcess"); | ||
assertThat(flowElement).isInstanceOf(EventSubProcess.class); | ||
EventSubProcess subProcess = (EventSubProcess) flowElement; | ||
assertThat(subProcess.getId()).isEqualTo("eventSubProcess"); | ||
flowElement = subProcess.getFlowElement("variableListenerStartEvent"); | ||
assertThat(flowElement).isInstanceOf(StartEvent.class); | ||
StartEvent startEvent = (StartEvent) flowElement; | ||
assertThat(startEvent.getId()).isEqualTo("variableListenerStartEvent"); | ||
assertThat(startEvent.getExtensionElements().get(ELEMENT_EVENT_VARIABLELISTENERDEFINITION)).isNull(); | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
modules/flowable-bpmn-converter/src/test/resources/missingVariableListenerVariableName.bpmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:design="http://flowable.org/design" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://flowable.org/test" design:palette="flowable-work-process-palette"> | ||
<process id="missingVariableListenerVariableName" name="missingVariableListenerVariableName" isExecutable="true" flowable:candidateStarterGroups="flowableUser"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[BPMNDiagram]]></design:stencilid> | ||
<design:creationdate><![CDATA[2024-06-11T06:08:01.488Z]]></design:creationdate> | ||
<design:modificationdate><![CDATA[2024-06-11T06:11:42.890Z]]></design:modificationdate> | ||
</extensionElements> | ||
<subProcess id="eventSubProcess" name="Event-subprocess" triggeredByEvent="true"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[EventSubprocess]]></design:stencilid> | ||
</extensionElements> | ||
<userTask id="subTask" name="subTask" flowable:assignee="${initiator}" flowable:formFieldValidation="false"> | ||
<extensionElements> | ||
<flowable:task-candidates-type><![CDATA[all]]></flowable:task-candidates-type> | ||
<design:stencilid><![CDATA[FormTask]]></design:stencilid> | ||
<design:stencilsuperid><![CDATA[Task]]></design:stencilsuperid> | ||
</extensionElements> | ||
</userTask> | ||
<startEvent id="variableListenerStartEvent" isInterrupting="false"> | ||
<extensionElements> | ||
<flowable:variableListenerEventDefinition variableChangeType="all"></flowable:variableListenerEventDefinition> | ||
<flowable:work-form-field-validation><![CDATA[false]]></flowable:work-form-field-validation> | ||
<design:stencilid><![CDATA[StartVariableListenerEvent]]></design:stencilid> | ||
</extensionElements> | ||
</startEvent> | ||
<endEvent id="subEndEvent"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[EndNoneEvent]]></design:stencilid> | ||
</extensionElements> | ||
</endEvent> | ||
<sequenceFlow id="bpmnSequenceFlow_6" sourceRef="subTask" targetRef="subEndEvent"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid> | ||
</extensionElements> | ||
</sequenceFlow> | ||
<sequenceFlow id="bpmnSequenceFlow_4" sourceRef="variableListenerStartEvent" targetRef="subTask"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid> | ||
</extensionElements> | ||
</sequenceFlow> | ||
</subProcess> | ||
<userTask id="mainTask" name="mainTask" flowable:assignee="${initiator}" flowable:formFieldValidation="false"> | ||
<extensionElements> | ||
<flowable:task-candidates-type><![CDATA[all]]></flowable:task-candidates-type> | ||
<design:stencilid><![CDATA[FormTask]]></design:stencilid> | ||
<design:stencilsuperid><![CDATA[Task]]></design:stencilsuperid> | ||
</extensionElements> | ||
</userTask> | ||
<startEvent id="mainStartEvent" flowable:initiator="initiator" flowable:formFieldValidation="false"> | ||
<extensionElements> | ||
<flowable:work-form-field-validation><![CDATA[false]]></flowable:work-form-field-validation> | ||
<design:stencilid><![CDATA[StartNoneEvent]]></design:stencilid> | ||
</extensionElements> | ||
</startEvent> | ||
<endEvent id="mainEndEvent"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[EndNoneEvent]]></design:stencilid> | ||
</extensionElements> | ||
</endEvent> | ||
<sequenceFlow id="bpmnSequenceFlow_10" sourceRef="mainTask" targetRef="mainEndEvent"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid> | ||
</extensionElements> | ||
</sequenceFlow> | ||
<sequenceFlow id="bpmnSequenceFlow_8" sourceRef="mainStartEvent" targetRef="mainTask"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid> | ||
</extensionElements> | ||
</sequenceFlow> | ||
</process> | ||
</definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...esources/org/flowable/engine/test/validation/missingVariableEventListenerVariableName.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:design="http://flowable.org/design" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://flowable.org/test" design:palette="flowable-work-process-palette"> | ||
<process id="missingVariableListenerVariableName" name="missingVariableListenerVariableName" isExecutable="true" flowable:candidateStarterGroups="flowableUser"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[BPMNDiagram]]></design:stencilid> | ||
<design:creationdate><![CDATA[2024-06-11T06:08:01.488Z]]></design:creationdate> | ||
<design:modificationdate><![CDATA[2024-06-11T06:11:42.890Z]]></design:modificationdate> | ||
</extensionElements> | ||
<subProcess id="eventSubProcess" name="Event-subprocess" triggeredByEvent="true"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[EventSubprocess]]></design:stencilid> | ||
</extensionElements> | ||
<userTask id="subTask" name="subTask" flowable:assignee="${initiator}" flowable:formFieldValidation="false"> | ||
<extensionElements> | ||
<flowable:task-candidates-type><![CDATA[all]]></flowable:task-candidates-type> | ||
<design:stencilid><![CDATA[FormTask]]></design:stencilid> | ||
<design:stencilsuperid><![CDATA[Task]]></design:stencilsuperid> | ||
</extensionElements> | ||
</userTask> | ||
<startEvent id="variableListenerStartEvent" isInterrupting="false"> | ||
<extensionElements> | ||
<flowable:variableListenerEventDefinition variableChangeType="all"></flowable:variableListenerEventDefinition> | ||
<flowable:work-form-field-validation><![CDATA[false]]></flowable:work-form-field-validation> | ||
</extensionElements> | ||
</startEvent> | ||
<endEvent id="subEndEvent"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[EndNoneEvent]]></design:stencilid> | ||
</extensionElements> | ||
</endEvent> | ||
<sequenceFlow id="bpmnSequenceFlow_6" sourceRef="subTask" targetRef="subEndEvent"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid> | ||
</extensionElements> | ||
</sequenceFlow> | ||
<sequenceFlow id="bpmnSequenceFlow_4" sourceRef="variableListenerStartEvent" targetRef="subTask"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid> | ||
</extensionElements> | ||
</sequenceFlow> | ||
</subProcess> | ||
<userTask id="mainTask" name="mainTask" flowable:assignee="${initiator}" flowable:formFieldValidation="false"> | ||
<extensionElements> | ||
<flowable:task-candidates-type><![CDATA[all]]></flowable:task-candidates-type> | ||
<design:stencilid><![CDATA[FormTask]]></design:stencilid> | ||
<design:stencilsuperid><![CDATA[Task]]></design:stencilsuperid> | ||
</extensionElements> | ||
</userTask> | ||
<startEvent id="mainStartEvent" flowable:initiator="initiator" flowable:formFieldValidation="false"> | ||
<extensionElements> | ||
<flowable:work-form-field-validation><![CDATA[false]]></flowable:work-form-field-validation> | ||
<design:stencilid><![CDATA[StartNoneEvent]]></design:stencilid> | ||
</extensionElements> | ||
</startEvent> | ||
<endEvent id="mainEndEvent"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[EndNoneEvent]]></design:stencilid> | ||
</extensionElements> | ||
</endEvent> | ||
<sequenceFlow id="bpmnSequenceFlow_10" sourceRef="mainTask" targetRef="mainEndEvent"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid> | ||
</extensionElements> | ||
</sequenceFlow> | ||
<sequenceFlow id="bpmnSequenceFlow_8" sourceRef="mainStartEvent" targetRef="mainTask"> | ||
<extensionElements> | ||
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid> | ||
</extensionElements> | ||
</sequenceFlow> | ||
</process> | ||
</definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters