From adf0af06ab1e05710a70feba34cd1adec3fbc7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pere=20Fern=C3=A1ndez?= Date: Wed, 17 Jul 2024 12:27:15 +0200 Subject: [PATCH 1/4] incubator-kie-issues#1388: `UserTasks` without Actors/Groups assignments can transition to any phase without checking any security policy --- .../impl/humantask/HumanTaskWorkItemImpl.java | 4 - .../BPMN2-UserTaskAssignmentActor.bpmn | 123 ++++++ .../BPMN2-UserTaskAssignmentActorGroup.bpmn | 132 +++++++ .../BPMN2-UserTaskAssignmentGroup.bpmn | 127 ++++++ .../BPMN2-UserTaskAssignmentNone.bpmn | 118 ++++++ .../BPMN2-AdHocSubProcessAutoComplete.bpmn2 | 5 + ...dHocSubProcessAutoCompleteExpression.bpmn2 | 5 + .../adhoc/BPMN2-AdHocTerminateEndEvent.bpmn2 | 292 ++++++++------ .../BPMN2-EscalationBoundaryEvent.bpmn2 | 2 +- ...PMN2-EscalationBoundaryEventWithTask.bpmn2 | 8 +- .../BPMN2-EventSubprocessEscalation.bpmn2 | 219 ++++++++--- .../flow/BPMN2-BooleanStructureRef.bpmn2 | 262 ++++++++----- .../bpmn2/flow/BPMN2-BrokenStructureRef.bpmn2 | 262 ++++++++----- .../BPMN2-DefaultObjectStructureRef.bpmn2 | 262 ++++++++----- .../bpmn2/flow/BPMN2-FloatStructureRef.bpmn2 | 262 ++++++++----- .../flow/BPMN2-IntegerStructureRef.bpmn2 | 262 ++++++++----- .../bpmn2/flow/BPMN2-ObjectStructureRef.bpmn2 | 262 ++++++++----- ...BPMN2-SubProcessWithEntryExitScripts.bpmn2 | 368 +++++++++++------- .../java/org/jbpm/bpmn2/ActivityTest.java | 242 ++++++++++-- .../java/org/jbpm/bpmn2/ErrorEventTest.java | 6 +- .../org/jbpm/bpmn2/EscalationEventTest.java | 4 +- .../org/jbpm/bpmn2/IntermediateEventTest.java | 4 +- .../jbpm/bpmn2/StandaloneBPMNProcessTest.java | 6 +- .../bpmn2/structureref/StructureRefTest.java | 19 +- .../jbpm/test/utils/ProcessTestHelper.java | 18 +- .../resources/BPMN2-StringStructureRef.bpmn2 | 262 ++++++++----- 26 files changed, 2536 insertions(+), 1000 deletions(-) create mode 100644 jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActor.bpmn create mode 100644 jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActorGroup.bpmn create mode 100644 jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentGroup.bpmn create mode 100644 jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentNone.bpmn diff --git a/jbpm/jbpm-flow/src/main/java/org/jbpm/process/instance/impl/humantask/HumanTaskWorkItemImpl.java b/jbpm/jbpm-flow/src/main/java/org/jbpm/process/instance/impl/humantask/HumanTaskWorkItemImpl.java index a1c1a77c39b..0679e9ba66e 100644 --- a/jbpm/jbpm-flow/src/main/java/org/jbpm/process/instance/impl/humantask/HumanTaskWorkItemImpl.java +++ b/jbpm/jbpm-flow/src/main/java/org/jbpm/process/instance/impl/humantask/HumanTaskWorkItemImpl.java @@ -191,10 +191,6 @@ protected void checkAssignedOwners(String user, Collection roles) { throw new NotAuthorizedException("User " + user + " is not authorized to access task instance with id " + getStringId()); } - // if there are no assignments means open to everyone - if (getPotentialUsers().isEmpty() && getPotentialGroups().isEmpty()) { - return; - } // check if user is in potential users or groups if (!getPotentialUsers().contains(user) && getPotentialGroups().stream().noneMatch(roles::contains)) { diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActor.bpmn b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActor.bpmn new file mode 100644 index 00000000000..6b34d02f0a1 --- /dev/null +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActor.bpmn @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + _37E3A306-1ECB-4937-A5DD-CEA62F29A4D5 + + + + + + + + _0D2B7D7C-D753-4CCF-94D6-C4BFD669A192 + _37E3A306-1ECB-4937-A5DD-CEA62F29A4D5 + + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_TaskNameInputX + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_SkippableInputX + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_TaskNameInputX + + + + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_SkippableInputX + + + + + + + + john + + + + + _0D2B7D7C-D753-4CCF-94D6-C4BFD669A192 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _TfEFMCWmED20cJveoGveWg + _TfEFMCWmED20cJveoGveWg + + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActorGroup.bpmn b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActorGroup.bpmn new file mode 100644 index 00000000000..1b11d2f4e48 --- /dev/null +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentActorGroup.bpmn @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + _37E3A306-1ECB-4937-A5DD-CEA62F29A4D5 + + + + + + + + _0D2B7D7C-D753-4CCF-94D6-C4BFD669A192 + _37E3A306-1ECB-4937-A5DD-CEA62F29A4D5 + + + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_TaskNameInputX + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_SkippableInputX + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_GroupIdInputX + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_TaskNameInputX + + + + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_SkippableInputX + + + + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_GroupIdInputX + + + + + + + + john + + + + + _0D2B7D7C-D753-4CCF-94D6-C4BFD669A192 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _pWcEECZJED2HF6GPCl7V2w + _pWcEECZJED2HF6GPCl7V2w + + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentGroup.bpmn b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentGroup.bpmn new file mode 100644 index 00000000000..3f8dd4c29d9 --- /dev/null +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentGroup.bpmn @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + _37E3A306-1ECB-4937-A5DD-CEA62F29A4D5 + + + + + + + + _0D2B7D7C-D753-4CCF-94D6-C4BFD669A192 + _37E3A306-1ECB-4937-A5DD-CEA62F29A4D5 + + + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_TaskNameInputX + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_SkippableInputX + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_GroupIdInputX + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_TaskNameInputX + + + + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_SkippableInputX + + + + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_GroupIdInputX + + + + + + + + _0D2B7D7C-D753-4CCF-94D6-C4BFD669A192 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _d4DSQCWmED2ahP2mOJbdtw + _d4DSQCWmED2ahP2mOJbdtw + + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentNone.bpmn b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentNone.bpmn new file mode 100644 index 00000000000..f73402a78db --- /dev/null +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/activity/BPMN2-UserTaskAssignmentNone.bpmn @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + _37E3A306-1ECB-4937-A5DD-CEA62F29A4D5 + + + + + + + + _0D2B7D7C-D753-4CCF-94D6-C4BFD669A192 + _37E3A306-1ECB-4937-A5DD-CEA62F29A4D5 + + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_TaskNameInputX + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_SkippableInputX + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_TaskNameInputX + + + + + + + _7349D0A9-C99C-44C1-A0FA-11E21DC45046_SkippableInputX + + + + + + + + _0D2B7D7C-D753-4CCF-94D6-C4BFD669A192 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _o5pXcCWmED2be5qkMK_U7g + _o5pXcCWmED2be5qkMK_U7g + + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocSubProcessAutoComplete.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocSubProcessAutoComplete.bpmn2 index b2dd1c612b6..e53735546d9 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocSubProcessAutoComplete.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocSubProcessAutoComplete.bpmn2 @@ -48,6 +48,11 @@ + + + john + + getActivityInstanceAttribute("numberOfActiveInstances") == 0 diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocSubProcessAutoCompleteExpression.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocSubProcessAutoCompleteExpression.bpmn2 index 06ebccda424..3e4656adc5b 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocSubProcessAutoCompleteExpression.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocSubProcessAutoCompleteExpression.bpmn2 @@ -51,6 +51,11 @@ _2_testHTOutput counter + + + john + + counter == 0 diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocTerminateEndEvent.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocTerminateEndEvent.bpmn2 index 319d62e9052..9fa6ea3c097 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocTerminateEndEvent.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/adhoc/BPMN2-AdHocTerminateEndEvent.bpmn2 @@ -1,175 +1,223 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _29F48C6F-FEEE-4C1E-BFFC-1C9665E57CA7 - - autocomplete + - + + _93941A9D-70A3-44F4-A0DE-86F4A99E7BF3 + _60142D30-8511-49B6-8B80-AC2A3FD4CD55 + System.out.println("Ad hoc subprocess completed"); + + + _60142D30-8511-49B6-8B80-AC2A3FD4CD55 + + _29F48C6F-FEEE-4C1E-BFFC-1C9665E57CA7 _93941A9D-70A3-44F4-A0DE-86F4A99E7BF3 - + + + _08AC695D-4603-406E-B973-E99512E1E4F0 - - - + + + + + _AA02F0B1-3BCF-4723-8C33-A8F32375CB0F_TaskNameInputX _AA02F0B1-3BCF-4723-8C33-A8F32375CB0F_SkippableInputX - + + _AA02F0B1-3BCF-4723-8C33-A8F32375CB0F_TaskNameInputX + + + + + + _AA02F0B1-3BCF-4723-8C33-A8F32375CB0F_SkippableInputX - - true - _AA02F0B1-3BCF-4723-8C33-A8F32375CB0F_SkippableInputX + + + + + + john + + - - - - - - + _08AC695D-4603-406E-B973-E99512E1E4F0 - + _EDD0F033-077C-4D6C-ADC8-17A785A74D85 - - - + + + + + _560E157E-3173-4CFD-9CC6-26676D8B0A02_TaskNameInputX _560E157E-3173-4CFD-9CC6-26676D8B0A02_SkippableInputX - + + _560E157E-3173-4CFD-9CC6-26676D8B0A02_TaskNameInputX + + + + + + _560E157E-3173-4CFD-9CC6-26676D8B0A02_SkippableInputX - - true - _560E157E-3173-4CFD-9CC6-26676D8B0A02_SkippableInputX + + + + + + john + + - - - - - - + _EDD0F033-077C-4D6C-ADC8-17A785A74D85 - + - - - + - - - - - - - - _93941A9D-70A3-44F4-A0DE-86F4A99E7BF3 - _60142D30-8511-49B6-8B80-AC2A3FD4CD55 - - - - - - - - - - _60142D30-8511-49B6-8B80-AC2A3FD4CD55 - - - - - - - - - + + + + - - + + - - + + - - + + - - + + - - - + + + - - - + + + - - - - - - + + - - - - - - + + + + + - - - + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _dQ3_sCW1ED24y9N0a84cQQ + _dQ3_sCW1ED24y9N0a84cQQ + + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-EscalationBoundaryEvent.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-EscalationBoundaryEvent.bpmn2 index 92490e0dc40..391ca22f199 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-EscalationBoundaryEvent.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/escalation/BPMN2-EscalationBoundaryEvent.bpmn2 @@ -1,4 +1,4 @@ - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_2 - + + + + + SequenceFlow_1 - + + + + + + SequenceFlow_2 SequenceFlow_1 + + + + + UserTask_1_TaskNameInputX + UserTask_1_SkippableInputX + + + + UserTask_1_TaskNameInputX + + + + + + + UserTask_1_SkippableInputX + + + + + + + + john + + - - + + + + + + + + + + + + + SequenceFlow_3 - + - + + + + + + SequenceFlow_3 SequenceFlow_4 - System.out.println("Event sub process triggered"); + System.out.println("Event sub process triggered"); - + + + + + SequenceFlow_4 - - - - - + + + + - - + + - - - - - - + + + + + - - - + + + - - + + + + + + - - + + - - + + - - - + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _sB2hsCWqED2iQNEOxA1sPg + _sB2hsCWqED2iQNEOxA1sPg + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BooleanStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BooleanStructureRef.bpmn2 index f0c429f79dd..4f1a5f4cf1c 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BooleanStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BooleanStructureRef.bpmn2 @@ -1,99 +1,183 @@ - - - - - - - - - - - - - - - - - - - - - _2_testHTOutput - - - - _2_testHTOutput - test - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_2 + + + + + + + + _1-_2 + _2-_3 + + + + + + _2_TaskNameInputX + _2_SkippableInputX + + + _2_testHTOutputX + + + + _2_TaskNameInputX + + + + + + + _2_SkippableInputX + + + + + + + _2_testHTOutputX + test + + + + john + + + + + + + + + + _2-_3 + _3-_4 + System.out.println("Result "+test); + + + + + + + + _3-_4 + + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _8Q9sQCW4ED2JqL4kdJLjeg + _8Q9sQCW4ED2JqL4kdJLjeg + + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BrokenStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BrokenStructureRef.bpmn2 index b96b93bb7ab..d3e534a9a0a 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BrokenStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-BrokenStructureRef.bpmn2 @@ -1,99 +1,183 @@ - - - - - - - - - - - - - - - - - - - - - _2_testHTOutput - - - - _2_testHTOutput - test - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_2 + + + + + + + + _1-_2 + _2-_3 + + + + + + _2_TaskNameInputX + _2_SkippableInputX + + + _2_testHTOutputX + + + + _2_TaskNameInputX + + + + + + + _2_SkippableInputX + + + + + + + _2_testHTOutputX + test + + + + john + + + + + + + + + + _2-_3 + _3-_4 + System.out.println("Result "+test); + + + + + + + + _3-_4 + + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _AuwtQCW5ED2B-7aqGG3h5Q + _AuwtQCW5ED2B-7aqGG3h5Q + + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-DefaultObjectStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-DefaultObjectStructureRef.bpmn2 index f2229bf8d42..fa9f4215e59 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-DefaultObjectStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-DefaultObjectStructureRef.bpmn2 @@ -1,99 +1,183 @@ - - - - - - - - - - - - - - - - - - - - - _2_testHTOutput - - - - _2_testHTOutput - test - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_2 + + + + + + + + _1-_2 + _2-_3 + + + + + + _2_TaskNameInputX + _2_SkippableInputX + + + _2_testHTOutputX + + + + _2_TaskNameInputX + + + + + + + _2_SkippableInputX + + + + + + + _2_testHTOutputX + test + + + + john + + + + + + + + + + _2-_3 + _3-_4 + System.out.println("Result "+test); + + + + + + + + _3-_4 + + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _1YWZMCW5ED2GXMgJRorQqw + _1YWZMCW5ED2GXMgJRorQqw + + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-FloatStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-FloatStructureRef.bpmn2 index 9bafb0d064a..6adad3b6485 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-FloatStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-FloatStructureRef.bpmn2 @@ -1,99 +1,183 @@ - - - - - - - - - - - - - - - - - - - - - _2_testHTOutput - - - - _2_testHTOutput - test - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_2 + + + + + + + + _1-_2 + _2-_3 + + + + + + _2_TaskNameInputX + _2_SkippableInputX + + + _2_testHTOutputX + + + + _2_TaskNameInputX + + + + + + + _2_SkippableInputX + + + + + + + _2_testHTOutputX + test + + + + john + + + + + + + + + + _2-_3 + _3-_4 + System.out.println("Result "+test); + + + + + + + + _3-_4 + + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _Ef6qsCW5ED2kqaHSwjBfKg + _Ef6qsCW5ED2kqaHSwjBfKg + + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-IntegerStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-IntegerStructureRef.bpmn2 index 3395dbb2d39..b3897ef2253 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-IntegerStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-IntegerStructureRef.bpmn2 @@ -1,99 +1,183 @@ - - - - - - - - - - - - - - - - - - - - - _2_testHTOutput - - - - _2_testHTOutput - test - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_2 + + + + + + + + _1-_2 + _2-_3 + + + + + + _2_TaskNameInputX + _2_SkippableInputX + + + _2_testHTOutputX + + + + _2_TaskNameInputX + + + + + + + _2_SkippableInputX + + + + + + + _2_testHTOutputX + test + + + + john + + + + + + + + + + _2-_3 + _3-_4 + System.out.println("Result "+test); + + + + + + + + _3-_4 + + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _ISbTACW5ED2lG5gYh56IOg + _ISbTACW5ED2lG5gYh56IOg + + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-ObjectStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-ObjectStructureRef.bpmn2 index f8cd0a03e42..103d1d5156b 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-ObjectStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/flow/BPMN2-ObjectStructureRef.bpmn2 @@ -1,99 +1,183 @@ - - - - - - - - - - - - - - - - - - - - - _2_testHTOutput - - - - _2_testHTOutput - test - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_2 + + + + + + + + _1-_2 + _2-_3 + + + + + + _2_TaskNameInputX + _2_SkippableInputX + + + _2_testHTOutputX + + + + _2_TaskNameInputX + + + + + + + _2_SkippableInputX + + + + + + + _2_testHTOutputX + test + + + + john + + + + + + + + + + _2-_3 + _3-_4 + System.out.println("Result "+test); + + + + + + + + _3-_4 + + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _MTswECW5ED2lY6_ultl44A + _MTswECW5ED2lY6_ultl44A + + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/subprocess/BPMN2-SubProcessWithEntryExitScripts.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/subprocess/BPMN2-SubProcessWithEntryExitScripts.bpmn2 index 82c335553bc..0f9b4dc9e88 100755 --- a/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/subprocess/BPMN2-SubProcessWithEntryExitScripts.bpmn2 +++ b/jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/subprocess/BPMN2-SubProcessWithEntryExitScripts.bpmn2 @@ -1,196 +1,282 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_2 SequenceFlow_11 - System.err.println("Task 1, var1 = 10"); -kcontext.setVariable("var1", new Integer(10)); + System.err.println("Task 1, var1 = 10"); +kcontext.setVariable("var1", new Integer(10)); - + _1-_2 - - + + + + + + SequenceFlow_12 SequenceFlow_7 - System.err.println("Task 3, var3 = 30"); -kcontext.setVariable("var3",30); + System.err.println("Task 3, var3 = 30"); +kcontext.setVariable("var3",30); - - + SequenceFlow_8 - + + + + + + SequenceFlow_7 SequenceFlow_8 - - - - - - - - - - _DataInput_150 - _DataInput_151 - _DataInput_152 - _DataInput_153 - _DataInput_154 - _DataInput_155 - _DataInput_156 + + + + + UserTask_2_TaskNameInputX + UserTask_2_SkippableInputX - - - _DataInput_150 - - - _DataInput_151 - - - _DataInput_152 + + UserTask_2_TaskNameInputX + + + + - - _DataInput_153 - - - _DataInput_154 - - - _DataInput_155 - - - _DataInput_156 + + UserTask_2_SkippableInputX + + + + + + + john + + - - - System.err.println("SubProcess, var4 = 40"); -kcontext.setVariable("var4",40); - - - - System.err.println("SubProcess, var5 = 50"); -kcontext.setVariable("var5",50); - - + + + + + + + + + SequenceFlow_11 SequenceFlow_12 - + + + SequenceFlow_10 - + + + + + SequenceFlow_10 SequenceFlow_9 - System.err.println("Task 2, var2 = 20"); -kcontext.setVariable("var2",20); + System.err.println("Task 2, var2 = 20"); +kcontext.setVariable("var2",20); - - + SequenceFlow_9 - - - - - - + + + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + + - - - - - + + + - - - - - + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _nPz2YCWnED24qrDb9miHmg + _nPz2YCWnED24qrDb9miHmg + \ No newline at end of file diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java index c6a71ea45bf..27adb2945f7 100755 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java @@ -41,26 +41,7 @@ import org.jbpm.bpmn2.activity.UserTaskWithSimulationMetaDataProcess; import org.jbpm.bpmn2.adhoc.SubProcessInAdHocProcessModel; import org.jbpm.bpmn2.adhoc.SubProcessInAdHocProcessProcess; -import org.jbpm.bpmn2.flow.CompositeWithDIGraphicalModel; -import org.jbpm.bpmn2.flow.CompositeWithDIGraphicalProcess; -import org.jbpm.bpmn2.flow.MinimalImplicitModel; -import org.jbpm.bpmn2.flow.MinimalImplicitProcess; -import org.jbpm.bpmn2.flow.MinimalModel; -import org.jbpm.bpmn2.flow.MinimalProcess; -import org.jbpm.bpmn2.flow.MinimalWithDIGraphicalModel; -import org.jbpm.bpmn2.flow.MinimalWithDIGraphicalProcess; -import org.jbpm.bpmn2.flow.MinimalWithGraphicalModel; -import org.jbpm.bpmn2.flow.MinimalWithGraphicalProcess; -import org.jbpm.bpmn2.flow.ProcessCustomDescriptionMetaDataModel; -import org.jbpm.bpmn2.flow.ProcessCustomDescriptionMetaDataProcess; -import org.jbpm.bpmn2.flow.ProcessVariableCustomDescriptionMetaDataModel; -import org.jbpm.bpmn2.flow.ProcessVariableCustomDescriptionMetaDataProcess; -import org.jbpm.bpmn2.flow.ProcessWithVariableNameModel; -import org.jbpm.bpmn2.flow.ProcessWithVariableNameProcess; -import org.jbpm.bpmn2.flow.UserTaskModel; -import org.jbpm.bpmn2.flow.UserTaskProcess; -import org.jbpm.bpmn2.flow.XORSameTargetModel; -import org.jbpm.bpmn2.flow.XORSameTargetProcess; +import org.jbpm.bpmn2.flow.*; import org.jbpm.bpmn2.handler.ReceiveTaskHandler; import org.jbpm.bpmn2.handler.SendTaskHandler; import org.jbpm.bpmn2.objects.Account; @@ -481,6 +462,223 @@ public void testUserTask() { assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_COMPLETED); } + @Test + public void testUserTaskActorAssignment() { + Application app = ProcessTestHelper.newApplication(); + TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); + ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler); + org.kie.kogito.process.Process processDefinition = UserTaskActorProcess.newProcess(app); + UserTaskActorModel model = processDefinition.createModel(); + org.kie.kogito.process.ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + KogitoWorkItem workItem = workItemHandler.getWorkItem(); + assertThat(workItem).isNotNull(); + assertThat(workItem.getParameter("ActorId")).isEqualTo("john"); + + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john"); + + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_COMPLETED); + } + + @Test + public void testUserTaskActorAssignmentActorFailure() { + Application app = ProcessTestHelper.newApplication(); + TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); + ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler); + org.kie.kogito.process.Process processDefinition = UserTaskActorProcess.newProcess(app); + UserTaskActorModel model = processDefinition.createModel(); + org.kie.kogito.process.ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + KogitoWorkItem workItem = workItemHandler.getWorkItem(); + assertThat(workItem).isNotNull(); + + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "mary"); + + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + } + + @Test + public void testUserTaskActorAssignmentNoPolicyFailure() { + Application app = ProcessTestHelper.newApplication(); + TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); + ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler); + org.kie.kogito.process.Process processDefinition = UserTaskActorProcess.newProcess(app); + UserTaskActorModel model = processDefinition.createModel(); + org.kie.kogito.process.ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + KogitoWorkItem workItem = workItemHandler.getWorkItem(); + assertThat(workItem).isNotNull(); + + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap()); + + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + } + + @Test + public void testUserTaskGroupAssignment() { + Application app = ProcessTestHelper.newApplication(); + TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); + ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler); + org.kie.kogito.process.Process processDefinition = UserTaskGroupProcess.newProcess(app); + UserTaskGroupModel model = processDefinition.createModel(); + org.kie.kogito.process.ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + KogitoWorkItem workItem = workItemHandler.getWorkItem(); + assertThat(workItem).isNotNull(); + + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john", "IT"); + + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_COMPLETED); + } + + @Test + public void testUserTaskGroupAssignmentFailure() { + Application app = ProcessTestHelper.newApplication(); + TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); + ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler); + org.kie.kogito.process.Process processDefinition = UserTaskGroupProcess.newProcess(app); + UserTaskGroupModel model = processDefinition.createModel(); + org.kie.kogito.process.ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + KogitoWorkItem workItem = workItemHandler.getWorkItem(); + assertThat(workItem).isNotNull(); + + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john", "HR"); + + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + } + + @Test + public void testUserTaskGroupAssignmentNoPolicyFailure() { + Application app = ProcessTestHelper.newApplication(); + TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); + ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler); + org.kie.kogito.process.Process processDefinition = UserTaskGroupProcess.newProcess(app); + UserTaskGroupModel model = processDefinition.createModel(); + org.kie.kogito.process.ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + KogitoWorkItem workItem = workItemHandler.getWorkItem(); + assertThat(workItem).isNotNull(); + + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap()); + + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + } + + @Test + public void testUserTaskNoneAssignmentFailure() { + Application app = ProcessTestHelper.newApplication(); + TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); + ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler); + org.kie.kogito.process.Process processDefinition = UserTaskNoneProcess.newProcess(app); + UserTaskNoneModel model = processDefinition.createModel(); + ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + KogitoWorkItem workItem = workItemHandler.getWorkItem(); + assertThat(workItem).isNotNull(); + + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john", "HR"); + + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + } + + @Test + public void testUserTaskNoneAssignmentNoPolicyFailure() { + Application app = ProcessTestHelper.newApplication(); + TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); + ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler); + org.kie.kogito.process.Process processDefinition = UserTaskNoneProcess.newProcess(app); + UserTaskNoneModel model = processDefinition.createModel(); + ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + KogitoWorkItem workItem = workItemHandler.getWorkItem(); + assertThat(workItem).isNotNull(); + + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap()); + + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + } + + @Test + public void testUserTaskActorAndGroupAssignmentWithActor() { + Application app = ProcessTestHelper.newApplication(); + TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); + ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler); + org.kie.kogito.process.Process processDefinition = UserTaskActorGroupProcess.newProcess(app); + UserTaskActorGroupModel model = processDefinition.createModel(); + ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + KogitoWorkItem workItem = workItemHandler.getWorkItem(); + assertThat(workItem).isNotNull(); + + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john"); + + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_COMPLETED); + } + + @Test + public void testUserTaskActorAndGroupAssignmentWithGroup() { + Application app = ProcessTestHelper.newApplication(); + TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); + ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler); + org.kie.kogito.process.Process processDefinition = UserTaskActorGroupProcess.newProcess(app); + UserTaskActorGroupModel model = processDefinition.createModel(); + ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + KogitoWorkItem workItem = workItemHandler.getWorkItem(); + assertThat(workItem).isNotNull(); + + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "mary", "IT"); + + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_COMPLETED); + } + + @Test + public void testUserTaskActorAndGroupAssignmentFailure() { + Application app = ProcessTestHelper.newApplication(); + TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); + ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler); + org.kie.kogito.process.Process processDefinition = UserTaskActorGroupProcess.newProcess(app); + UserTaskActorGroupModel model = processDefinition.createModel(); + ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + KogitoWorkItem workItem = workItemHandler.getWorkItem(); + assertThat(workItem).isNotNull(); + + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "mary", "HR"); + + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + } + + @Test + public void testUserTaskActorAndGroupAssignmentNoPolicyFailure() { + Application app = ProcessTestHelper.newApplication(); + TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); + ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler); + org.kie.kogito.process.Process processDefinition = UserTaskActorGroupProcess.newProcess(app); + UserTaskActorGroupModel model = processDefinition.createModel(); + ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + KogitoWorkItem workItem = workItemHandler.getWorkItem(); + assertThat(workItem).isNotNull(); + + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap()); + + assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); + } + @Test public void testUserTaskVerifyParameters() { Application app = ProcessTestHelper.newApplication(); @@ -559,7 +757,7 @@ public void testSubProcessWithEntryExitScripts() throws Exception { assertThat(processInstance.variables().getVar4()).isNotNull().hasToString("40"); assertThat(processInstance.variables().getVar5()).isNotNull().hasToString("50"); - ProcessTestHelper.completeWorkItem(processInstance, "john", Collections.emptyMap()); + ProcessTestHelper.completeWorkItem(processInstance, Collections.emptyMap(), "john"); assertThat(processInstance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_COMPLETED); } @@ -882,7 +1080,7 @@ public void testReceiveTask() throws Exception { assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE); receiveTaskHandler.setKnowledgeRuntime(kruntime); receiveTaskHandler.messageReceived("HelloMessage", "Hello john!"); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.emptyMap()); + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john"); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED); } diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ErrorEventTest.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ErrorEventTest.java index 98611a1f179..d73e2b92bd3 100755 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ErrorEventTest.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ErrorEventTest.java @@ -253,7 +253,7 @@ public void testErrorBoundaryEventOnServiceTask() throws Exception { List workItems = handler.getWorkItems(); assertThat(workItems).hasSize(1); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.emptyMap()); + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john"); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED); @@ -357,7 +357,7 @@ public void testErrorSignallingExceptionServiceTask() throws Exception { org.kie.kogito.process.ProcessInstance instance = definition.createInstance(model); instance.start(); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.emptyMap()); + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john"); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_ABORTED); assertThat(caughtEventObjectHolder[0] != null && caughtEventObjectHolder[0] instanceof KogitoWorkItem).withFailMessage("Event was not passed to Event Subprocess.").isTrue(); } @@ -382,7 +382,7 @@ public void testSignallingExceptionServiceTask() throws Exception { org.kie.kogito.process.ProcessInstance instance = definition.createInstance(model); instance.start(); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.emptyMap()); + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john"); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED); assertThat(caughtEventObjectHolder[0] != null && caughtEventObjectHolder[0] instanceof KogitoWorkItem).withFailMessage("Event was not passed to Event Subprocess.").isTrue(); diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/EscalationEventTest.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/EscalationEventTest.java index f2f8c232be3..5193317975b 100755 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/EscalationEventTest.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/EscalationEventTest.java @@ -145,7 +145,7 @@ public void afterNodeLeft(ProcessNodeLeftEvent event) { KogitoWorkItem workItem = workItemHandler.getWorkItem(); assertThat(workItem).isNotNull(); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.emptyMap()); + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john"); assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED); assertThat(executednodes).hasSize(1); @@ -210,7 +210,7 @@ public void testGeneralEscalationBoundaryEventWithTask() throws Exception { model.setX("0"); org.kie.kogito.process.ProcessInstance instance = processDefinition.createInstance(model); instance.start(); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.emptyMap()); + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john"); assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED); assertThat(instance.variables().getX()).isEqualTo("1"); diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/IntermediateEventTest.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/IntermediateEventTest.java index 6cf41494546..18414b5ce22 100755 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/IntermediateEventTest.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/IntermediateEventTest.java @@ -144,7 +144,7 @@ public void testBoundaryTimerCycleISO() { org.kie.kogito.process.ProcessInstance instance = definition.createInstance(definition.createModel()); instance.start(); listener.waitTillCompleted(); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.emptyMap()); + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john"); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED); } @@ -159,7 +159,7 @@ public void testBoundaryTimerCycleISOVariable() { org.kie.kogito.process.ProcessInstance instance = definition.createInstance(model); instance.start(); listener.waitTillCompleted(); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.emptyMap()); + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john"); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED); } diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/StandaloneBPMNProcessTest.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/StandaloneBPMNProcessTest.java index 640515b1e1d..c121852e5d7 100755 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/StandaloneBPMNProcessTest.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/StandaloneBPMNProcessTest.java @@ -528,7 +528,7 @@ public void testAdHocSubProcessAutoComplete() throws Exception { // adhoc we need to trigger the human task instance.triggerNode("_2-1"); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.emptyMap()); + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john"); assertThat(instance.status()).isEqualTo(KogitoProcessInstance.STATE_COMPLETED); } @@ -547,7 +547,7 @@ public void testAdHocSubProcessAutoCompleteExpression() throws Exception { // adhoc we need to trigger the human task instance.triggerNode("_2-1"); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.singletonMap("testHT", 0)); + ProcessTestHelper.completeWorkItem(instance, Collections.singletonMap("testHT", 0), "john"); assertThat(instance.status()).isEqualTo(KogitoProcessInstance.STATE_COMPLETED); } @@ -566,7 +566,7 @@ public void testAdHocTerminateEndEvent() throws Exception { // adhoc we need to trigger the human task instance.triggerNode("_560E157E-3173-4CFD-9CC6-26676D8B0A02"); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.emptyMap()); + ProcessTestHelper.completeWorkItem(instance, Collections.emptyMap(), "john"); assertThat(instance.status()).isEqualTo(KogitoProcessInstance.STATE_COMPLETED); } diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/structureref/StructureRefTest.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/structureref/StructureRefTest.java index 8042b5f97a3..479720a0cbe 100755 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/structureref/StructureRefTest.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/structureref/StructureRefTest.java @@ -42,6 +42,7 @@ import org.kie.kogito.Application; import org.kie.kogito.internal.process.runtime.KogitoProcessInstance; import org.kie.kogito.process.bpmn2.BpmnVariables; +import org.kie.kogito.process.workitem.Policies; import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBException; @@ -64,8 +65,10 @@ public void testStringStructureRef() throws Exception { Map res = new HashMap<>(); res.put("testHT", "test value"); + kruntime.getKogitoWorkItemManager().completeWorkItem( - workItemHandler.getWorkItem().getStringId(), res); + workItemHandler.getWorkItem().getStringId(), res, + Policies.of("john")); assertProcessInstanceCompleted(processInstance.getStringId(), kruntime); } @@ -82,7 +85,7 @@ public void testBooleanStructureRef() throws Exception { instance.start(); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_ACTIVE); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.singletonMap("testHT", "true")); + ProcessTestHelper.completeWorkItem(instance, Collections.singletonMap("testHT", "true"), "john"); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED); } @@ -101,7 +104,7 @@ public void testIntegerStructureRef() throws Exception { instance.start(); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_ACTIVE); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.singletonMap("testHT", value)); + ProcessTestHelper.completeWorkItem(instance, Collections.singletonMap("testHT", value), "john"); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED); assertThat(instance.variables().getTest()).isEqualTo(Integer.valueOf(value)); @@ -122,7 +125,7 @@ public void testFloatStructureRef() throws Exception { instance.start(); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_ACTIVE); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.singletonMap("testHT", value)); + ProcessTestHelper.completeWorkItem(instance, Collections.singletonMap("testHT", value), "john"); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED); assertThat(instance.variables().getTest()).isEqualTo(Float.valueOf(value)); @@ -153,7 +156,7 @@ public void testObjectStructureRef() throws Exception { instance.start(); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_ACTIVE); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.singletonMap("testHT", value)); + ProcessTestHelper.completeWorkItem(instance, Collections.singletonMap("testHT", value), "john"); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED); assertThat(instance.variables().getTest()).isEqualTo(new Person(1, "john")); @@ -174,7 +177,7 @@ public void testDefaultObjectStructureRef() throws Exception { instance.start(); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_ACTIVE); - ProcessTestHelper.completeWorkItem(instance, "john", Collections.singletonMap("testHT", value)); + ProcessTestHelper.completeWorkItem(instance, Collections.singletonMap("testHT", value), "john"); assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED); assertThat(instance.variables().getTest()).isEqualTo(value); @@ -222,7 +225,7 @@ public void testInvalidBooleanStructureRefOnWIComplete() throws Exception { assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_ACTIVE); try { - ProcessTestHelper.completeWorkItem(instance, "john", Collections.singletonMap("testHT", true)); + ProcessTestHelper.completeWorkItem(instance, Collections.singletonMap("testHT", true), "john"); fail(""); } catch (IllegalArgumentException iae) { logger.info("Expected IllegalArgumentException caught: " + iae); @@ -265,7 +268,7 @@ public void testNotExistingBooleanStructureRefOnWIComplete() throws Exception { assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_ACTIVE); try { - ProcessTestHelper.completeWorkItem(instance, "john", Collections.singletonMap(wrongDataOutput, true)); + ProcessTestHelper.completeWorkItem(instance, Collections.singletonMap(wrongDataOutput, true), "john"); fail("it should not work!"); } catch (IllegalArgumentException e) { assertThat(e.getMessage()).isEqualTo("Data output '" + wrongDataOutput + "' is not defined in process 'IntegerStructureRef' for task 'User Task'"); diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/test/utils/ProcessTestHelper.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/test/utils/ProcessTestHelper.java index 3db866f82bd..4303a9445aa 100644 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/test/utils/ProcessTestHelper.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/test/utils/ProcessTestHelper.java @@ -18,8 +18,7 @@ */ package org.jbpm.test.utils; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.CountDownLatch; import java.util.function.Consumer; import java.util.function.Predicate; @@ -69,13 +68,18 @@ public static void registerHandler(Application app, String handlerName, KogitoWo ((DefaultWorkItemHandlerConfig) app.config().get(ProcessConfig.class).workItemHandlers()).register(handlerName, handler); } - public static void completeWorkItem(ProcessInstance processInstance, String userName, Map outputVars) { - completeWorkItem(processInstance, userName, outputVars, item -> { - }); + public static void completeWorkItem(ProcessInstance processInstance, Map outputVars) { + completeWorkItem(processInstance, outputVars, item -> { + }, null, Collections.emptyList()); } - public static void completeWorkItem(ProcessInstance processInstance, String userName, Map outputVars, Consumer workItem) { - List workItems = processInstance.workItems(SecurityPolicy.of(userName, emptyList())); + public static void completeWorkItem(ProcessInstance processInstance, Map outputVars, String userName, String... groups) { + completeWorkItem(processInstance, outputVars, item -> { + }, userName, Arrays.asList(groups)); + } + + public static void completeWorkItem(ProcessInstance processInstance, Map outputVars, Consumer workItem, String userName, Collection groups) { + List workItems = processInstance.workItems(SecurityPolicy.of(userName, groups)); workItems.stream().findFirst().ifPresent(e -> { workItem.accept(e); processInstance.completeWorkItem(e.getId(), outputVars, SecurityPolicy.of(userName, emptyList())); diff --git a/jbpm/jbpm-tests/src/test/resources/BPMN2-StringStructureRef.bpmn2 b/jbpm/jbpm-tests/src/test/resources/BPMN2-StringStructureRef.bpmn2 index 184ccc9f0f6..60b94bb8129 100755 --- a/jbpm/jbpm-tests/src/test/resources/BPMN2-StringStructureRef.bpmn2 +++ b/jbpm/jbpm-tests/src/test/resources/BPMN2-StringStructureRef.bpmn2 @@ -1,99 +1,183 @@ - - - - - - - - - - - - - - - - - - - - - _2_testHTOutput - - - - _2_testHTOutput - test - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_2 + + + + + + + + _1-_2 + _2-_3 + + + + + + _2_TaskNameInputX + _2_SkippableInputX + + + _2_testHTOutputX + + + + _2_TaskNameInputX + + + + + + + _2_SkippableInputX + + + + + + + _2_testHTOutputX + test + + + + john + + + + + + + + + + _2-_3 + _3-_4 + System.out.println("Result "+test); + + + + + + + + _3-_4 + + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _YAgnYCW3ED28RYvCqRMntQ + _YAgnYCW3ED28RYvCqRMntQ + + \ No newline at end of file From ee47ff3401b3f15ccea1e0aafcc96d23f8af98f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pere=20Fern=C3=A1ndez?= Date: Thu, 18 Jul 2024 15:47:42 +0200 Subject: [PATCH 2/4] - fix incubator apis to include SecurityPolicy in HT signals --- .../services/humantask/HumanTaskService.java | 2 +- .../kie/kogito/process/ProcessService.java | 2 +- .../process/impl/ProcessServiceImpl.java | 8 ++--- .../jbpm/test/utils/ProcessTestHelper.java | 31 +++++++++++++---- .../RestResourceUserTaskQuarkusTemplate.java | 7 ++-- .../RestResourceUserTaskSpringTemplate.java | 6 ++-- .../main/resources/com/example/flexible.bpmn | 34 +++++++------------ .../org/acme/StatefulProcessResourceTest.java | 7 ++-- .../quarkus/support/HumanTaskServiceImpl.java | 11 +++--- .../support/QuarkusHumanTaskService.java | 4 +-- 10 files changed, 66 insertions(+), 46 deletions(-) diff --git a/api/kogito-api-incubation-processes-services/src/main/java/org/kie/kogito/incubation/processes/services/humantask/HumanTaskService.java b/api/kogito-api-incubation-processes-services/src/main/java/org/kie/kogito/incubation/processes/services/humantask/HumanTaskService.java index 82ce67afb8b..cc8a7b33c25 100644 --- a/api/kogito-api-incubation-processes-services/src/main/java/org/kie/kogito/incubation/processes/services/humantask/HumanTaskService.java +++ b/api/kogito-api-incubation-processes-services/src/main/java/org/kie/kogito/incubation/processes/services/humantask/HumanTaskService.java @@ -26,7 +26,7 @@ public interface HumanTaskService { ExtendedDataContext get(LocalId id, MetaDataContext meta); - ExtendedDataContext create(LocalId taskId); + ExtendedDataContext create(LocalId taskId, DataContext dataContext); ExtendedDataContext abort(LocalId taskId, MetaDataContext meta); diff --git a/api/kogito-api/src/main/java/org/kie/kogito/process/ProcessService.java b/api/kogito-api/src/main/java/org/kie/kogito/process/ProcessService.java index 5708c0c1879..35ece13d195 100644 --- a/api/kogito-api/src/main/java/org/kie/kogito/process/ProcessService.java +++ b/api/kogito-api/src/main/java/org/kie/kogito/process/ProcessService.java @@ -77,7 +77,7 @@ ProcessInstance createProcessInstance(Process process, S Optional> getTasks(Process process, String id, SecurityPolicy policy); - Optional signalTask(Process process, String id, String taskNodeName); + Optional signalTask(Process process, String id, String taskNodeName, SecurityPolicy policy); Optional saveTask(Process process, String id, diff --git a/jbpm/jbpm-flow/src/main/java/org/kie/kogito/process/impl/ProcessServiceImpl.java b/jbpm/jbpm-flow/src/main/java/org/kie/kogito/process/impl/ProcessServiceImpl.java index 3a59ab4569b..12620be4b29 100644 --- a/jbpm/jbpm-flow/src/main/java/org/kie/kogito/process/impl/ProcessServiceImpl.java +++ b/jbpm/jbpm-flow/src/main/java/org/kie/kogito/process/impl/ProcessServiceImpl.java @@ -170,7 +170,7 @@ public Optional> getTasks(Process process, S } @Override - public Optional signalTask(Process process, String id, String taskName) { + public Optional signalTask(Process process, String id, String taskName, SecurityPolicy policy) { return UnitOfWorkExecutor.executeInUnitOfWork(application.unitOfWorkManager(), () -> process .instances() .findById(id) @@ -183,13 +183,13 @@ public Optional signalTask(Process process, Strin String taskNodeName = node.getName(); pi.send(Sig.of(taskNodeName, Collections.emptyMap())); - return getTaskByName(pi, taskName).orElse(null); + return getTaskByName(pi, taskName, policy).orElse(null); })); } - public Optional getTaskByName(ProcessInstance pi, String taskName) { + private Optional getTaskByName(ProcessInstance pi, String taskName, SecurityPolicy... policies) { return pi - .workItems() + .workItems(policies) .stream() .filter(wi -> wi.getName().equals(taskName)) .findFirst(); diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/test/utils/ProcessTestHelper.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/test/utils/ProcessTestHelper.java index 4303a9445aa..1b6cfbdeca1 100644 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/test/utils/ProcessTestHelper.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/test/utils/ProcessTestHelper.java @@ -18,7 +18,9 @@ */ package org.jbpm.test.utils; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.function.Consumer; import java.util.function.Predicate; @@ -68,21 +70,38 @@ public static void registerHandler(Application app, String handlerName, KogitoWo ((DefaultWorkItemHandlerConfig) app.config().get(ProcessConfig.class).workItemHandlers()).register(handlerName, handler); } + /** + * Will be removed in favor of the {@link #completeWorkItem(ProcessInstance, Map, String, String...)} + */ + @Deprecated + public static void completeWorkItem(ProcessInstance processInstance, String userName, Map outputVars) { + completeWorkItem(processInstance, outputVars, item -> { + }, userName); + } + + /** + * Will be removed in favor of the {@link #completeWorkItem(ProcessInstance, Map, Consumer, String, String...)} + */ + @Deprecated + public static void completeWorkItem(ProcessInstance processInstance, String userName, Map outputVars, Consumer workItem) { + completeWorkItem(processInstance, outputVars, workItem, userName); + } + public static void completeWorkItem(ProcessInstance processInstance, Map outputVars) { completeWorkItem(processInstance, outputVars, item -> { - }, null, Collections.emptyList()); + }, null); } public static void completeWorkItem(ProcessInstance processInstance, Map outputVars, String userName, String... groups) { completeWorkItem(processInstance, outputVars, item -> { - }, userName, Arrays.asList(groups)); + }, userName, groups); } - public static void completeWorkItem(ProcessInstance processInstance, Map outputVars, Consumer workItem, String userName, Collection groups) { - List workItems = processInstance.workItems(SecurityPolicy.of(userName, groups)); + public static void completeWorkItem(ProcessInstance processInstance, Map outputVars, Consumer workItem, String userName, String... groups) { + List workItems = processInstance.workItems(SecurityPolicy.of(userName, Arrays.asList(groups))); workItems.stream().findFirst().ifPresent(e -> { workItem.accept(e); - processInstance.completeWorkItem(e.getId(), outputVars, SecurityPolicy.of(userName, emptyList())); + processInstance.completeWorkItem(e.getId(), outputVars, SecurityPolicy.of(userName, Arrays.asList(groups))); }); } diff --git a/kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/RestResourceUserTaskQuarkusTemplate.java b/kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/RestResourceUserTaskQuarkusTemplate.java index 34c0d6a96dd..fa858163fe7 100644 --- a/kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/RestResourceUserTaskQuarkusTemplate.java +++ b/kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/RestResourceUserTaskQuarkusTemplate.java @@ -40,8 +40,11 @@ public class $Type$Resource { @Path("/{id}/$taskName$") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - public Response signal(@PathParam("id") final String id, @Context UriInfo uriInfo) { - return processService.signalTask(process, id, "$taskName$") + public Response signal(@PathParam("id") final String id, + @QueryParam("user") final String user, + @QueryParam("group") final List groups, + @Context UriInfo uriInfo) { + return processService.signalTask(process, id, "$taskName$", SecurityPolicy.of(user, groups)) .map(task -> Response .created(uriInfo.getAbsolutePathBuilder().path(task.getId()).build()) .entity(task.getResults()) diff --git a/kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/RestResourceUserTaskSpringTemplate.java b/kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/RestResourceUserTaskSpringTemplate.java index 0ae5bebd054..9779d13e7f6 100644 --- a/kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/RestResourceUserTaskSpringTemplate.java +++ b/kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/RestResourceUserTaskSpringTemplate.java @@ -48,9 +48,11 @@ public class $Type$Resource { @PostMapping(value = "/{id}/$taskName$", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity signal(@PathVariable("id") final String id, - final UriComponentsBuilder uriComponentsBuilder) { + @RequestParam("user") final String user, + @RequestParam("group") final List groups, + final UriComponentsBuilder uriComponentsBuilder) { - return processService.signalTask(process, id, "$taskName$") + return processService.signalTask(process, id, "$taskName$", SecurityPolicy.of(user, groups)) .map(task -> ResponseEntity .created(uriComponentsBuilder .path("/$name$/{id}/$taskName$/{taskId}") diff --git a/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-integration-test/src/main/resources/com/example/flexible.bpmn b/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-integration-test/src/main/resources/com/example/flexible.bpmn index 529cde4ec97..a0d6fa7e761 100644 --- a/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-integration-test/src/main/resources/com/example/flexible.bpmn +++ b/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-integration-test/src/main/resources/com/example/flexible.bpmn @@ -1,23 +1,5 @@ - - - + + @@ -31,6 +13,9 @@ + + + @@ -77,6 +62,11 @@ + + + manager + + @@ -148,7 +138,7 @@ - _KmYCMDvREDqHa4Mxr_tnBQ - _KmYCMDvREDqHa4Mxr_tnBQ + _wmQzoCcAED2Zf_0CU-GloA + _wmQzoCcAED2Zf_0CU-GloA \ No newline at end of file diff --git a/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-integration-test/src/test/java/org/acme/StatefulProcessResourceTest.java b/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-integration-test/src/test/java/org/acme/StatefulProcessResourceTest.java index 87625b9c092..0ec92c1cca7 100644 --- a/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-integration-test/src/test/java/org/acme/StatefulProcessResourceTest.java +++ b/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-integration-test/src/test/java/org/acme/StatefulProcessResourceTest.java @@ -18,6 +18,7 @@ */ package org.acme; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -263,13 +264,15 @@ public void signalTaskProcess() { created.data().as(MapDataContext.class) .get("test", Payload.class).getValue()); + TaskMetaDataContext tmdc = TaskMetaDataContext.of(Policy.of("manager", Collections.emptyList())); + // send signal to complete (empty data context for this signal) - ExtendedDataContext taskCreated = taskSvc.create(pid.tasks().get("InitialTask")); + ExtendedDataContext taskCreated = taskSvc.create(pid.tasks().get("InitialTask"), ExtendedDataContext.of(tmdc, EmptyDataContext.Instance)); String tid = taskCreated.data().as(MapDataContext.class).get("id", String.class); TaskInstanceId taskInstanceId = pid.tasks().get("InitialTask").instances().get(tid); - ExtendedDataContext result = taskSvc.complete(taskInstanceId, EmptyDataContext.Instance); + ExtendedDataContext result = taskSvc.complete(taskInstanceId, ExtendedDataContext.of(tmdc, EmptyDataContext.Instance)); assertEquals("ad-hoc", result.data().as(MapDataContext.class).get("test", Payload.class).getValue()); diff --git a/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes/src/main/java/org/kie/kogito/core/process/incubation/quarkus/support/HumanTaskServiceImpl.java b/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes/src/main/java/org/kie/kogito/core/process/incubation/quarkus/support/HumanTaskServiceImpl.java index d9ddd44889b..d1f89d6d86d 100644 --- a/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes/src/main/java/org/kie/kogito/core/process/incubation/quarkus/support/HumanTaskServiceImpl.java +++ b/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes/src/main/java/org/kie/kogito/core/process/incubation/quarkus/support/HumanTaskServiceImpl.java @@ -98,16 +98,19 @@ public ExtendedDataContext get(LocalId id, MetaDataContext meta) { } @Override - public ExtendedDataContext create(LocalId id) { + public ExtendedDataContext create(LocalId id, DataContext dataContext) { TaskId taskId = ProcessIdParser.select(id, TaskId.class); ProcessInstanceId instanceId = taskId.processInstanceId(); Process> process = parseProcess(instanceId.processId()); - WorkItem workItem = svc.signalTask(process, instanceId.processInstanceId(), taskId.taskId()) + ExtendedDataContext edc = dataContext.as(ExtendedDataContext.class); + TaskMetaDataContext mdc = edc.meta().as(TaskMetaDataContext.class); + SecurityPolicy securityPolicy = convertPolicyObject(mdc.policy()); + + WorkItem workItem = svc.signalTask(process, instanceId.processInstanceId(), taskId.taskId(), securityPolicy) .orElseThrow(); - MapDataContext dataContext = MapDataContext.from(workItem); - return ExtendedDataContext.of(ProcessMetaDataContext.of(taskId), dataContext); + return ExtendedDataContext.of(ProcessMetaDataContext.of(taskId), MapDataContext.from(workItem)); } @Override diff --git a/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes/src/main/java/org/kie/kogito/core/process/incubation/quarkus/support/QuarkusHumanTaskService.java b/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes/src/main/java/org/kie/kogito/core/process/incubation/quarkus/support/QuarkusHumanTaskService.java index d1e07cbe397..dbefc3d8f9a 100644 --- a/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes/src/main/java/org/kie/kogito/core/process/incubation/quarkus/support/QuarkusHumanTaskService.java +++ b/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes/src/main/java/org/kie/kogito/core/process/incubation/quarkus/support/QuarkusHumanTaskService.java @@ -51,8 +51,8 @@ public ExtendedDataContext get(LocalId id, MetaDataContext meta) { } @Override - public ExtendedDataContext create(LocalId taskId) { - return delegate.create(taskId); + public ExtendedDataContext create(LocalId taskId, DataContext dataContext) { + return delegate.create(taskId, dataContext); } @Override From 6bebcb62cdd270e39fa965c8ad850392070510ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pere=20Fern=C3=A1ndez?= Date: Fri, 19 Jul 2024 10:42:18 +0200 Subject: [PATCH 3/4] - fix springboot it tests --- .../src/main/resources/AdHocFragments.bpmn | 62 ++++++++++--------- .../src/main/resources/cinema.bpmn | 38 +++++------- .../src/main/resources/monitoring.bpmn | 34 ++++------ .../main/resources/multi-instance-task.bpmn | 33 ++++------ .../springboot/AdHocFragmentsTest.java | 6 +- .../springboot/BasicRestTest.java | 6 +- .../springboot/EnumsTest.java | 6 +- .../springboot/MultiInstanceTaskTest.java | 4 ++ 8 files changed, 88 insertions(+), 101 deletions(-) diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/AdHocFragments.bpmn b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/AdHocFragments.bpmn index 9204dbddc86..5910d68133c 100644 --- a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/AdHocFragments.bpmn +++ b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/AdHocFragments.bpmn @@ -1,24 +1,7 @@ - - - + + + @@ -45,12 +28,22 @@ + + + + - + + _FACFF454-18FA-420D-A9AB-F4323E38499C_InMessage + _FACFF454-18FA-420D-A9AB-F4323E38499C_OutMessage + + + + @@ -162,6 +155,11 @@ _1853795C-BF23-478D-BD43-7DAE695479DF_newVar1OutputX var1 + + + john + + _830D53F8-A344-45AE-A1A1-2173DD983A43 @@ -205,6 +203,11 @@ _17762652-67B8-46FF-ADFE-D7AF3EA2ADAB_newVar1OutputX var1 + + + john + + @@ -226,20 +229,19 @@ _A6C76B12-32F2-4B07-AD3B-F502D8C3B745 - + - + _731518E6-88A2-4CCC-A2C0-97C45189A7F3_ConditionInputX _731518E6-88A2-4CCC-A2C0-97C45189A7F3_TaskNameInputX - - + _731518E6-88A2-4CCC-A2C0-97C45189A7F3_TaskNameInputX - - - _731518E6-88A2-4CCC-A2C0-97C45189A7F3_TaskNameInputX + + + @@ -419,7 +421,7 @@ - _oPtyIJ7WEDidGqXCSGV4Ig - _oPtyIJ7WEDidGqXCSGV4Ig + _WL3jkCdwED2KYMa5towL6A + _WL3jkCdwED2KYMa5towL6A \ No newline at end of file diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/cinema.bpmn b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/cinema.bpmn index 948744b0332..07fad205630 100644 --- a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/cinema.bpmn +++ b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/cinema.bpmn @@ -1,23 +1,5 @@ - - - + + @@ -33,6 +15,9 @@ + + + @@ -70,11 +55,13 @@ + _D61BED76-3864-4739-8C22-63FF18984247_TaskNameInputX _D61BED76-3864-4739-8C22-63FF18984247_movieInputX _D61BED76-3864-4739-8C22-63FF18984247_SkippableInputX + _D61BED76-3864-4739-8C22-63FF18984247_GroupIdInputX _D61BED76-3864-4739-8C22-63FF18984247_reviewedRatingOutputX @@ -98,6 +85,13 @@ + + _D61BED76-3864-4739-8C22-63FF18984247_GroupIdInputX + + + + + _D61BED76-3864-4739-8C22-63FF18984247_reviewedRatingOutputX @@ -166,7 +160,7 @@ - _Fn2AALIuEDixAIoM09vFmg - _Fn2AALIuEDixAIoM09vFmg + _qASusCfQED2czsDli3US7g + _qASusCfQED2czsDli3US7g \ No newline at end of file diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/monitoring.bpmn b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/monitoring.bpmn index a5569e74bc2..29c2c5ca76b 100644 --- a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/monitoring.bpmn +++ b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/monitoring.bpmn @@ -1,23 +1,5 @@ - - - + + @@ -30,6 +12,9 @@ + + + @@ -81,6 +66,11 @@ + + + admin + + _3627EB59-E9EB-4E98-B00B-F6371CB95F6F @@ -142,7 +132,7 @@ - _VeFwoNfOEDmUhMFz-g9hJw - _VeFwoNfOEDmUhMFz-g9hJw + _HotWUCfXED2W2uK4sFZlyg + _HotWUCfXED2W2uK4sFZlyg \ No newline at end of file diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/multi-instance-task.bpmn b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/multi-instance-task.bpmn index e1c6b95f86a..1d6cd33cf0a 100644 --- a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/multi-instance-task.bpmn +++ b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/main/resources/multi-instance-task.bpmn @@ -1,24 +1,5 @@ - - - + @@ -35,6 +16,9 @@ + + + @@ -99,6 +83,11 @@ _91B1A61F-5218-4DC8-861D-4C3D2B6C7B49_outputOutputX output + + + admin + + _91B1A61F-5218-4DC8-861D-4C3D2B6C7B49_IN_COLLECTIONInputX _91B1A61F-5218-4DC8-861D-4C3D2B6C7B49_OUT_COLLECTIONOutputX @@ -166,7 +155,7 @@ - _COuUAGniEDqn6_hfs-lZcw - _COuUAGniEDqn6_hfs-lZcw + _xNj0YCfVED2fyK_p0KZlvQ + _xNj0YCfVED2fyK_p0KZlvQ \ No newline at end of file diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/AdHocFragmentsTest.java b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/AdHocFragmentsTest.java index da3217be541..85ec3edcf7d 100644 --- a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/AdHocFragmentsTest.java +++ b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/AdHocFragmentsTest.java @@ -56,7 +56,9 @@ void testUserTaskProcess() { String taskId = extractID(given() .contentType(ContentType.JSON) - .when() + .queryParam("user", "john") + .queryParam("group", "manager") + .when() .post("/AdHocFragments/{pid}/AdHocTask1", id) .then() .statusCode(201) @@ -70,6 +72,7 @@ void testUserTaskProcess() { .contentType(ContentType.JSON) .when() .body(params) + .queryParam("user", "john") .post("/AdHocFragments/{id}/AdHocTask1/{taskId}", id, taskId) .then() .statusCode(200) @@ -117,6 +120,7 @@ void testNonAdHocUserTaskProcess() { given() .contentType(ContentType.JSON) + .queryParam("user", "john") .when() .post("/AdHocFragments/{pid}/Task", pid) .then() diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/BasicRestTest.java b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/BasicRestTest.java index cd1350d8090..945a4b321df 100644 --- a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/BasicRestTest.java +++ b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/BasicRestTest.java @@ -259,9 +259,11 @@ void testGetTasks() { .path("id"); given() - .when() + .queryParam("user", "john") + .queryParam("group", "manager") + .when() .get("/AdHocFragments/{id}/tasks", id) - .then() + .then() .statusCode(200) .body("$.size()", is(1)) .body("[0].name", is("Task")); diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/EnumsTest.java b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/EnumsTest.java index fd30482fcb7..dea61421451 100644 --- a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/EnumsTest.java +++ b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/EnumsTest.java @@ -19,11 +19,9 @@ package org.kie.kogito.integrationtests.springboot; import java.util.Collections; - import java.util.HashMap; import java.util.Map; -import io.restassured.http.ContentType; import org.acme.examples.model.Movie; import org.acme.examples.model.MovieGenre; import org.acme.examples.model.Rating; @@ -33,6 +31,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; +import io.restassured.http.ContentType; + import static io.restassured.RestAssured.given; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; @@ -67,6 +67,7 @@ void testSubmitMovie() { .path("id"); TaskModel task = given() + .queryParam("group", "customer") .when() .get("/cinema/{pid}/tasks", pid) .then() @@ -79,6 +80,7 @@ void testSubmitMovie() { given() .contentType(ContentType.JSON) + .queryParam("group", "customer") .when() .body(Collections.singletonMap("reviewedRating", Rating.PG_13)) .post("/cinema/{pid}/ReviewRatingTask/{taskId}", pid, task.getId()) diff --git a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/MultiInstanceTaskTest.java b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/MultiInstanceTaskTest.java index 6c3981b3499..a9657758fc4 100644 --- a/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/MultiInstanceTaskTest.java +++ b/springboot/integration-tests/src/it/integration-tests-springboot-processes-it/src/test/java/org/kie/kogito/integrationtests/springboot/MultiInstanceTaskTest.java @@ -69,6 +69,8 @@ void testStartProcess() { given() .contentType(ContentType.JSON) + .queryParam("user", "admin") + .queryParam("group", "managers") .when() .body(Collections.singletonMap("output", "user3")) .post("/multiinstancetaskprocess/{id}/MultiInstanceTask/{tId}", processId, tasks.get(0)) @@ -77,6 +79,8 @@ void testStartProcess() { given() .contentType(ContentType.JSON) + .queryParam("user", "admin") + .queryParam("group", "managers") .when() .body(Collections.singletonMap("output", "user4")) .post("/multiinstancetaskprocess/{id}/MultiInstanceTask/{tId}", processId, tasks.get(1)) From 5c8c2cd0f7aecbc984c84b115e1d7507b640c8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pere=20Fern=C3=A1ndez?= Date: Fri, 19 Jul 2024 14:29:08 +0200 Subject: [PATCH 4/4] - fix quarkus it tests --- .../src/main/resources/EmbeddedProcess.bpmn | 34 ++++------ .../org/kie/kogito/it/PersistenceTest.java | 6 +- .../src/main/resources/AdHocFragments.bpmn | 64 ++++++++++--------- .../src/main/resources/cinema.bpmn | 38 +++++------ .../src/main/resources/monitoring.bpmn | 34 ++++------ .../main/resources/multi-instance-task.bpmn | 33 ++++------ .../quarkus/AdHocFragmentsIT.java | 4 ++ .../integrationtests/quarkus/BasicRestIT.java | 2 + .../integrationtests/quarkus/EnumsIT.java | 2 + .../quarkus/MultiInstanceTaskIT.java | 4 ++ 10 files changed, 100 insertions(+), 121 deletions(-) diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/main/resources/EmbeddedProcess.bpmn b/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/main/resources/EmbeddedProcess.bpmn index cecc79f8d2f..9dfe55cf448 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/main/resources/EmbeddedProcess.bpmn +++ b/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/main/resources/EmbeddedProcess.bpmn @@ -1,23 +1,5 @@ - - - + + @@ -30,6 +12,9 @@ + + + @@ -107,6 +92,11 @@ + + + admin + + _F42E47AE-D4F9-4D37-8EB2-AC801442B1D3 @@ -169,7 +159,7 @@ - _pN8NAFD8EDqUgOO8muwFaA - _pN8NAFD8EDqUgOO8muwFaA + _rAo8ICf2ED21aIqHWO2T7A + _rAo8ICf2ED21aIqHWO2T7A \ No newline at end of file diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/test/java/org/kie/kogito/it/PersistenceTest.java b/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/test/java/org/kie/kogito/it/PersistenceTest.java index 287a3bf5604..72a8a4a6fc5 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/test/java/org/kie/kogito/it/PersistenceTest.java +++ b/quarkus/integration-tests/integration-tests-quarkus-processes-persistence/integration-tests-processes-persistence-common/src/test/java/org/kie/kogito/it/PersistenceTest.java @@ -187,8 +187,8 @@ void testEmbeddedProcess() { .pathParam("pId", pId) .pathParam("taskId", taskId) .pathParam("processId", PROCESS_EMBEDDED_ID) - .queryParam("user", "test") - .queryParam("group", "test") + .queryParam("user", "admin") + .queryParam("group", "managers") .body("{}") .when() .post("/{processId}/{pId}/Task/{taskId}/phases/complete") @@ -300,6 +300,8 @@ void testAdHocProcess() { String location = given().contentType(ContentType.JSON) .pathParam("pId", pId) + .queryParam("user", "user") + .queryParam("group", "agroup") .when() .post("/AdHocProcess/{pId}/CloseTask") .then() diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/AdHocFragments.bpmn b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/AdHocFragments.bpmn index 207ad199ce1..b1f2dcd8979 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/AdHocFragments.bpmn +++ b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/AdHocFragments.bpmn @@ -1,25 +1,8 @@ - - - + + + @@ -46,12 +29,22 @@ + + + + - + + _FACFF454-18FA-420D-A9AB-F4323E38499C_InMessage + _FACFF454-18FA-420D-A9AB-F4323E38499C_OutMessage + + + + @@ -164,6 +157,11 @@ _1853795C-BF23-478D-BD43-7DAE695479DF_newVar1OutputX var1 + + + john + + _830D53F8-A344-45AE-A1A1-2173DD983A43 @@ -207,6 +205,11 @@ _17762652-67B8-46FF-ADFE-D7AF3EA2ADAB_newVar1OutputX var1 + + + john + + @@ -228,26 +231,25 @@ _A6C76B12-32F2-4B07-AD3B-F502D8C3B745 - + - + _731518E6-88A2-4CCC-A2C0-97C45189A7F3_ConditionInputX _731518E6-88A2-4CCC-A2C0-97C45189A7F3_TaskNameInputX - - + _731518E6-88A2-4CCC-A2C0-97C45189A7F3_TaskNameInputX - - - _731518E6-88A2-4CCC-A2C0-97C45189A7F3_TaskNameInputX + + + - + @@ -421,7 +423,7 @@ - _oPtyIJ7WEDidGqXCSGV4Ig - _oPtyIJ7WEDidGqXCSGV4Ig + _N6FuoCf0ED2UEYYcqSwxzw + _N6FuoCf0ED2UEYYcqSwxzw \ No newline at end of file diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/cinema.bpmn b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/cinema.bpmn index aa42fb1a664..31001420145 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/cinema.bpmn +++ b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/cinema.bpmn @@ -1,23 +1,5 @@ - - - + + @@ -34,6 +16,9 @@ + + + @@ -72,11 +57,13 @@ + _D61BED76-3864-4739-8C22-63FF18984247_TaskNameInputX _D61BED76-3864-4739-8C22-63FF18984247_movieInputX _D61BED76-3864-4739-8C22-63FF18984247_SkippableInputX + _D61BED76-3864-4739-8C22-63FF18984247_GroupIdInputX _D61BED76-3864-4739-8C22-63FF18984247_reviewedRatingOutputX @@ -100,6 +87,13 @@ + + _D61BED76-3864-4739-8C22-63FF18984247_GroupIdInputX + + + + + _D61BED76-3864-4739-8C22-63FF18984247_reviewedRatingOutputX rating @@ -165,7 +159,7 @@ - _dH388O39EDmWWfa6AU2qgA - _dH388O39EDmWWfa6AU2qgA + _lku_ACf0ED2_05Uj0LuheQ + _lku_ACf0ED2_05Uj0LuheQ \ No newline at end of file diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/monitoring.bpmn b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/monitoring.bpmn index 0ef685eede4..417df6efeb6 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/monitoring.bpmn +++ b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/monitoring.bpmn @@ -1,23 +1,5 @@ - - - + + @@ -30,6 +12,9 @@ + + + @@ -81,6 +66,11 @@ + + + admin + + _3627EB59-E9EB-4E98-B00B-F6371CB95F6F @@ -142,7 +132,7 @@ - _MpAUYNfQEDm0G9lwHSzyAw - _MpAUYNfQEDm0G9lwHSzyAw + _a7f6ACf1ED2B6pw-5oYiMQ + _a7f6ACf1ED2B6pw-5oYiMQ \ No newline at end of file diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/multi-instance-task.bpmn b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/multi-instance-task.bpmn index e1c6b95f86a..61bfd8853fa 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/multi-instance-task.bpmn +++ b/quarkus/integration-tests/integration-tests-quarkus-processes/src/main/resources/multi-instance-task.bpmn @@ -1,24 +1,5 @@ - - - + @@ -35,6 +16,9 @@ + + + @@ -99,6 +83,11 @@ _91B1A61F-5218-4DC8-861D-4C3D2B6C7B49_outputOutputX output + + + admin + + _91B1A61F-5218-4DC8-861D-4C3D2B6C7B49_IN_COLLECTIONInputX _91B1A61F-5218-4DC8-861D-4C3D2B6C7B49_OUT_COLLECTIONOutputX @@ -166,7 +155,7 @@ - _COuUAGniEDqn6_hfs-lZcw - _COuUAGniEDqn6_hfs-lZcw + _3wtAMCf0ED2oFcXdqRefeA + _3wtAMCf0ED2oFcXdqRefeA \ No newline at end of file diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/AdHocFragmentsIT.java b/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/AdHocFragmentsIT.java index ad9f44d1280..083b39bec01 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/AdHocFragmentsIT.java +++ b/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/AdHocFragmentsIT.java @@ -61,6 +61,8 @@ void testUserTaskProcess() { String taskId = extractID(given() .contentType(ContentType.JSON) + .queryParam("user", "john") + .queryParam("group", "manager") .when() .post("/AdHocFragments/{pid}/AdHocTask1", id) .then() @@ -73,6 +75,7 @@ void testUserTaskProcess() { params.put("newVar1", "Gonzo"); given() .contentType(ContentType.JSON) + .queryParam("user", "john") .when() .body(params) .post("/AdHocFragments/{id}/AdHocTask1/{taskId}", id, taskId) @@ -122,6 +125,7 @@ void testNonAdHocUserTaskProcess() { given() .contentType(ContentType.JSON) + .queryParam("user", "john") .when() .post("/AdHocFragments/{pid}/Task", pid) .then() diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/BasicRestIT.java b/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/BasicRestIT.java index 60d4467930b..60377d50b2d 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/BasicRestIT.java +++ b/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/BasicRestIT.java @@ -302,6 +302,8 @@ void testGetTasks() { .path("id"); given() + .queryParam("user", "john") + .queryParam("group", "manager") .when() .get("/AdHocFragments/{id}/tasks", id) .then() diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/EnumsIT.java b/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/EnumsIT.java index da8b93efee1..eb3c5bee60b 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/EnumsIT.java +++ b/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/EnumsIT.java @@ -67,6 +67,7 @@ void testSubmitMovie() { .path("id"); String taskId = given() + .queryParam("group", "customer") .when() .get("/cinema/{pid}/tasks", pid) .then() @@ -80,6 +81,7 @@ void testSubmitMovie() { reviewedRating.put("reviewedRating", Rating.PG_13); given() .contentType(ContentType.JSON) + .queryParam("group", "customer") .when() .body(reviewedRating) .post("/cinema/{pid}/ReviewRatingTask/{taskId}", pid, taskId) diff --git a/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/MultiInstanceTaskIT.java b/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/MultiInstanceTaskIT.java index 3c090b4c598..071cf2dcc29 100644 --- a/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/MultiInstanceTaskIT.java +++ b/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/MultiInstanceTaskIT.java @@ -69,6 +69,8 @@ void testStartProcess() { given() .contentType(ContentType.JSON) + .queryParam("user", "admin") + .queryParam("group", "managers") .when() .body(Collections.singletonMap("output", "user3")) .post("/multiinstancetaskprocess/{id}/MultiInstanceTask/{tId}", processId, tasks.get(0)) @@ -77,6 +79,8 @@ void testStartProcess() { given() .contentType(ContentType.JSON) + .queryParam("user", "admin") + .queryParam("group", "managers") .when() .body(Collections.singletonMap("output", "user4")) .post("/multiinstancetaskprocess/{id}/MultiInstanceTask/{tId}", processId, tasks.get(1))