Skip to content

Commit

Permalink
[kie-issues-386] PIM removes dynamic task description of Human Tasks (#…
Browse files Browse the repository at this point in the history
…2301) (#2311)

* [kie-issues-386] Test case to verify dynamic task description during process migration

* [kie-issues-386] Test case to verify dynamic task description during process migration / fix

---------

Co-authored-by: Enrique <egonzale@redhat.com>
Co-authored-by: Martin Weiler <mweiler@redhat.com>
  • Loading branch information
3 people committed Aug 2, 2023
1 parent ff84d1a commit 54fc8ca
Show file tree
Hide file tree
Showing 4 changed files with 273 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public Map<String, String> getInMappings() {
}

public void addInAssociation(DataAssociation dataAssociation) {
if (dataAssociation.getTarget().equals("Description")) {
getWork().setParameter(dataAssociation.getTarget(), dataAssociation.getAssignments().get(0).getFrom());
}
inMapping.add(dataAssociation);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ public void testAddTaskAfterActiveTaskNameExpression() {
assertEquals(ADDTASKAFTERACTIVE_EXPR_ID_V1, task.getProcessId());
assertEquals(DEPLOYMENT_ID_V1, task.getDeploymentId());
assertEquals("Active Task test", task.getName());
assertEquals("test", task.getDescription());
managerV1.disposeRuntimeEngine(runtime);

MigrationSpec migrationSpec = new MigrationSpec(DEPLOYMENT_ID_V1, pi1.getId(), DEPLOYMENT_ID_V2, ADDTASKAFTERACTIVE_EXPR_ID_V2);
Expand All @@ -694,7 +695,7 @@ public void testAddTaskAfterActiveTaskNameExpression() {

runtime = managerV2.getRuntimeEngine(EmptyContext.get());
taskService = runtime.getTaskService();
assertMigratedTaskAndComplete(taskService, ADDTASKAFTERACTIVE_EXPR_ID_V2, pi1.getId(), "Active Task test");
assertMigratedTaskAndComplete(taskService, ADDTASKAFTERACTIVE_EXPR_ID_V2, pi1.getId(), "Active Task test", "test");

managerV2.disposeRuntimeEngine(runtime);
}
Expand Down Expand Up @@ -730,6 +731,10 @@ protected void assertTaskAndComplete(TaskService taskService, String processId,
}

protected void assertMigratedTaskAndComplete(TaskService taskService, String processId, Long processInstanceId, String taskName) {
assertMigratedTaskAndComplete(taskService, processId, processInstanceId, taskName, null);
}

protected void assertMigratedTaskAndComplete(TaskService taskService, String processId, Long processInstanceId, String taskName, String taskDescription) {
List<TaskSummary> tasks = taskService.getTasksByStatusByProcessInstanceId(processInstanceId, Arrays.asList(Status.Reserved), "en-UK");
assertNotNull(tasks);
assertEquals(1, tasks.size());
Expand All @@ -739,6 +744,10 @@ protected void assertMigratedTaskAndComplete(TaskService taskService, String pro
assertEquals(processId, task.getProcessId());
assertEquals(DEPLOYMENT_ID_V2, task.getDeploymentId());
assertEquals(taskName, task.getName());
if(taskDescription!=null) {
assertEquals(taskDescription, task.getDescription());
}


taskService.start(task.getId(), USER_JOHN);
taskService.complete(task.getId(), USER_JOHN, null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,83 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.omg.org/bpmn20" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_JJin8Ax1EeaC8Nc37AL--g" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd" exporter="jBPM Designer" exporterVersion="6.2.0" expressionLanguage="http://www.mvel.org/2.0" targetNamespace="http://www.omg.org/bpmn20" typeLanguage="http://www.java.com/javaTypes">
<bpmn2:itemDefinition id="_sItem" structureRef="String" />
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_TaskNameInputXItem" structureRef="String"/>
<bpmn2:process id="process-migration-testv1.AddTaskAfterActiveExpr" drools:packageName="org.jbpm" drools:version="1.0" name="AddTaskAfterActive" isExecutable="true">
<bpmn2:property id="s" itemSubjectRef="_sItem"/>
<bpmn2:startEvent id="processStartEvent" drools:selectable="true" color:background-color="#9acd32" color:border-color="#000000" color:color="#000000" name="">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_6XjiMQJCEDyHMpZ8EbMnMg" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd http://www.omg.org/spec/DD/20100524/DC DC.xsd http://www.omg.org/spec/DD/20100524/DI DI.xsd " exporter="jBPM Process Modeler" exporterVersion="2.0" targetNamespace="http://www.omg.org/bpmn20">
<bpmn2:itemDefinition id="_sItem" structureRef="String"/>
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_SkippableInputXItem" structureRef="Object"/>
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_PriorityInputXItem" structureRef="Object"/>
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_CommentInputXItem" structureRef="Object"/>
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_DescriptionInputXItem" structureRef="Object"/>
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_CreatedByInputXItem" structureRef="Object"/>
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_TaskNameInputXItem" structureRef="Object"/>
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_GroupIdInputXItem" structureRef="Object"/>
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_ContentInputXItem" structureRef="Object"/>
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_NotStartedReassignInputXItem" structureRef="Object"/>
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_NotCompletedReassignInputXItem" structureRef="Object"/>
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_NotStartedNotifyInputXItem" structureRef="Object"/>
<bpmn2:itemDefinition id="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_NotCompletedNotifyInputXItem" structureRef="Object"/>
<bpmn2:collaboration id="_9E56CA04-F5F1-47B9-A829-9B746034F3E7" name="Default Collaboration">
<bpmn2:participant id="_AC3DAD38-B656-4839-AEA2-DA6BF3474BE9" name="Pool Participant" processRef="process_migration_testv1.AddTaskAfterActiveExpr"/>
</bpmn2:collaboration>
<bpmn2:process id="process-migration-testv1.AddTaskAfterActiveExpr" drools:packageName="org.jbpm" drools:version="1.0" drools:adHoc="false" name="AddTaskAfterActive" isExecutable="true" processType="Public">
<bpmn2:property id="s" itemSubjectRef="_sItem" name="s"/>
<bpmn2:sequenceFlow id="_67207A2D-FD96-4D88-929D-EEA51199551C" sourceRef="processStartEvent" targetRef="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D"/>
<bpmn2:sequenceFlow id="_54BFE3E3-18F6-45F5-9BEB-A8E0DC699CF0" sourceRef="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D" targetRef="_5000ADC9-575E-4E87-9DE6-4517B0439B05"/>
<bpmn2:startEvent id="processStartEvent">
<bpmn2:outgoing>_67207A2D-FD96-4D88-929D-EEA51199551C</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:userTask id="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D" drools:selectable="true" drools:scriptFormat="http://www.java.com/java" color:background-color="#fafad2" color:border-color="#000000" color:color="#000000" name="Active Task #{s}">
<bpmn2:userTask id="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D" name="Active Task #{s}">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[Active Task #{s}]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>_67207A2D-FD96-4D88-929D-EEA51199551C</bpmn2:incoming>
<bpmn2:outgoing>_54BFE3E3-18F6-45F5-9BEB-A8E0DC699CF0</bpmn2:outgoing>
<bpmn2:ioSpecification id="_JJin8Qx1EeaC8Nc37AL--g">
<bpmn2:dataInput id="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_TaskNameInputX" drools:dtype="String" itemSubjectRef="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_TaskNameInputXItem" name="TaskName"/>
<bpmn2:dataInput id="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_SkippableInputX" name="Skippable"/>
<bpmn2:inputSet id="_JJin8gx1EeaC8Nc37AL--g">
<bpmn2:ioSpecification>
<bpmn2:dataInput id="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_TaskNameInputX" drools:dtype="Object" itemSubjectRef="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_TaskNameInputXItem" name="TaskName"/>
<bpmn2:dataInput id="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_SkippableInputX" drools:dtype="Object" itemSubjectRef="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_SkippableInputXItem" name="Skippable"/>
<bpmn2:dataInput id="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_DescriptionInputX" drools:dtype="Object" itemSubjectRef="__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_DescriptionInputXItem" name="Description"/>
<bpmn2:inputSet>
<bpmn2:dataInputRefs>_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_TaskNameInputX</bpmn2:dataInputRefs>
<bpmn2:dataInputRefs>_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_SkippableInputX</bpmn2:dataInputRefs>
<bpmn2:dataInputRefs>_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_DescriptionInputX</bpmn2:dataInputRefs>
</bpmn2:inputSet>
<bpmn2:outputSet id="_JJin8wx1EeaC8Nc37AL--g"/>
</bpmn2:ioSpecification>
<bpmn2:dataInputAssociation id="_JJin9Ax1EeaC8Nc37AL--g">
<bpmn2:dataInputAssociation>
<bpmn2:targetRef>_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_TaskNameInputX</bpmn2:targetRef>
<bpmn2:assignment id="_JJin9Qx1EeaC8Nc37AL--g">
<bpmn2:from xsi:type="bpmn2:tFormalExpression" id="_JJin9gx1EeaC8Nc37AL--g">ActiveTask</bpmn2:from>
<bpmn2:to xsi:type="bpmn2:tFormalExpression" id="_JJin9wx1EeaC8Nc37AL--g">_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_TaskNameInputX</bpmn2:to>
<bpmn2:assignment>
<bpmn2:from xsi:type="bpmn2:tFormalExpression"><![CDATA[ActiveTask]]></bpmn2:from>
<bpmn2:to xsi:type="bpmn2:tFormalExpression"><![CDATA[_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_TaskNameInputX]]></bpmn2:to>
</bpmn2:assignment>
</bpmn2:dataInputAssociation>
<bpmn2:dataInputAssociation id="_JJin-Ax1EeaC8Nc37AL--g">
<bpmn2:dataInputAssociation>
<bpmn2:targetRef>_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_SkippableInputX</bpmn2:targetRef>
<bpmn2:assignment id="_JJin-Qx1EeaC8Nc37AL--g">
<bpmn2:from xsi:type="bpmn2:tFormalExpression" id="_JJin-gx1EeaC8Nc37AL--g">true</bpmn2:from>
<bpmn2:to xsi:type="bpmn2:tFormalExpression" id="_JJin-wx1EeaC8Nc37AL--g">_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_SkippableInputX</bpmn2:to>
<bpmn2:assignment>
<bpmn2:from xsi:type="bpmn2:tFormalExpression"><![CDATA[true]]></bpmn2:from>
<bpmn2:to xsi:type="bpmn2:tFormalExpression"><![CDATA[_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_SkippableInputX]]></bpmn2:to>
</bpmn2:assignment>
</bpmn2:dataInputAssociation>
<bpmn2:dataInputAssociation>
<bpmn2:targetRef>_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_DescriptionInputX</bpmn2:targetRef>
<bpmn2:assignment>
<bpmn2:from xsi:type="bpmn2:tFormalExpression"><![CDATA[#{s}]]></bpmn2:from>
<bpmn2:to xsi:type="bpmn2:tFormalExpression"><![CDATA[_54C7BD3A-0BE4-4C87-9689-C492B8469D2D_DescriptionInputX]]></bpmn2:to>
</bpmn2:assignment>
</bpmn2:dataInputAssociation>
<bpmn2:potentialOwner id="_JJin_Ax1EeaC8Nc37AL--g">
<bpmn2:resourceAssignmentExpression id="_JJin_Qx1EeaC8Nc37AL--g">
<bpmn2:formalExpression id="_JJin_gx1EeaC8Nc37AL--g">john</bpmn2:formalExpression>
<bpmn2:potentialOwner id="_6XpBwAJCEDyHMpZ8EbMnMg">
<bpmn2:resourceAssignmentExpression id="_6XpBwQJCEDyHMpZ8EbMnMg">
<bpmn2:formalExpression>john</bpmn2:formalExpression>
</bpmn2:resourceAssignmentExpression>
</bpmn2:potentialOwner>
</bpmn2:userTask>
<bpmn2:sequenceFlow id="_67207A2D-FD96-4D88-929D-EEA51199551C" drools:selectable="true" color:background-color="#000000" color:border-color="#000000" color:color="#000000" sourceRef="processStartEvent" targetRef="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D"/>
<bpmn2:endEvent id="_5000ADC9-575E-4E87-9DE6-4517B0439B05" drools:selectable="true" color:background-color="#ff6347" color:border-color="#000000" color:color="#000000" name="">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:endEvent id="_5000ADC9-575E-4E87-9DE6-4517B0439B05">
<bpmn2:incoming>_54BFE3E3-18F6-45F5-9BEB-A8E0DC699CF0</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="_54BFE3E3-18F6-45F5-9BEB-A8E0DC699CF0" drools:selectable="true" color:background-color="#000000" color:border-color="#000000" color:color="#000000" sourceRef="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D" targetRef="_5000ADC9-575E-4E87-9DE6-4517B0439B05"/>
</bpmn2:process>
<bpmndi:BPMNDiagram id="_JJin_wx1EeaC8Nc37AL--g">
<bpmndi:BPMNPlane id="_JJioAAx1EeaC8Nc37AL--g" bpmnElement="process-migration-testv1.AddTaskAfterActiveExpr">
<bpmndi:BPMNShape id="_JJioAQx1EeaC8Nc37AL--g" bpmnElement="processStartEvent">
<dc:Bounds height="30.0" width="30.0" x="120.0" y="165.0"/>
<bpmndi:BPMNDiagram>
<bpmndi:BPMNPlane bpmnElement="process_migration_testv1.AddTaskAfterActiveExpr">
<bpmndi:BPMNShape id="shape__5000ADC9-575E-4E87-9DE6-4517B0439B05" bpmnElement="_5000ADC9-575E-4E87-9DE6-4517B0439B05">
<dc:Bounds height="56" width="56" x="340" y="166"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_JJioAgx1EeaC8Nc37AL--g" bpmnElement="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D">
<dc:Bounds height="80.0" width="100.0" x="195.0" y="140.0"/>
<bpmndi:BPMNShape id="shape__54C7BD3A-0BE4-4C87-9689-C492B8469D2D" bpmnElement="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D">
<dc:Bounds height="80" width="100" x="195" y="140"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="_JJioAwx1EeaC8Nc37AL--g" bpmnElement="_67207A2D-FD96-4D88-929D-EEA51199551C">
<di:waypoint xsi:type="dc:Point" x="135.0" y="180.0"/>
<di:waypoint xsi:type="dc:Point" x="245.0" y="180.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_JJioBAx1EeaC8Nc37AL--g" bpmnElement="_5000ADC9-575E-4E87-9DE6-4517B0439B05">
<dc:Bounds height="28.0" width="28.0" x="340.0" y="166.0"/>
<bpmndi:BPMNShape id="shape_processStartEvent" bpmnElement="processStartEvent">
<dc:Bounds height="56" width="56" x="120" y="165"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="_JJioBQx1EeaC8Nc37AL--g" bpmnElement="_54BFE3E3-18F6-45F5-9BEB-A8E0DC699CF0">
<di:waypoint xsi:type="dc:Point" x="245.0" y="180.0"/>
<di:waypoint xsi:type="dc:Point" x="354.0" y="180.0"/>
<bpmndi:BPMNEdge id="edge_shape__54C7BD3A-0BE4-4C87-9689-C492B8469D2D_to_shape__5000ADC9-575E-4E87-9DE6-4517B0439B05" bpmnElement="_54BFE3E3-18F6-45F5-9BEB-A8E0DC699CF0">
<di:waypoint x="245" y="180"/>
<di:waypoint x="354" y="180"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge_shape_processStartEvent_to_shape__54C7BD3A-0BE4-4C87-9689-C492B8469D2D" bpmnElement="_67207A2D-FD96-4D88-929D-EEA51199551C">
<di:waypoint x="135" y="180"/>
<di:waypoint x="245" y="180"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
<bpmn2:relationship type="BPSimData">
<bpmn2:extensionElements>
<bpsim:BPSimData>
<bpsim:Scenario id="default" name="Simulationscenario">
<bpsim:ScenarioParameters/>
<bpsim:ElementParameters elementRef="_54C7BD3A-0BE4-4C87-9689-C492B8469D2D">
<bpsim:TimeParameters>
<bpsim:ProcessingTime>
<bpsim:NormalDistribution mean="0" standardDeviation="0"/>
</bpsim:ProcessingTime>
</bpsim:TimeParameters>
<bpsim:ResourceParameters>
<bpsim:Availability>
<bpsim:FloatingParameter value="0"/>
</bpsim:Availability>
<bpsim:Quantity>
<bpsim:FloatingParameter value="0"/>
</bpsim:Quantity>
</bpsim:ResourceParameters>
<bpsim:CostParameters>
<bpsim:UnitCost>
<bpsim:FloatingParameter value="0"/>
</bpsim:UnitCost>
</bpsim:CostParameters>
</bpsim:ElementParameters>
<bpsim:ElementParameters elementRef="processStartEvent">
<bpsim:TimeParameters>
<bpsim:ProcessingTime>
<bpsim:NormalDistribution mean="0" standardDeviation="0"/>
</bpsim:ProcessingTime>
</bpsim:TimeParameters>
</bpsim:ElementParameters>
</bpsim:Scenario>
</bpsim:BPSimData>
</bpmn2:extensionElements>
<bpmn2:source>_6XjiMQJCEDyHMpZ8EbMnMg</bpmn2:source>
<bpmn2:target>_6XjiMQJCEDyHMpZ8EbMnMg</bpmn2:target>
</bpmn2:relationship>
</bpmn2:definitions>

0 comments on commit 54fc8ca

Please sign in to comment.