Bug 818251 - JPA knowledge session does not set process instance as completed after user task completion
Summary: JPA knowledge session does not set process instance as completed after user t...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: jBPM 5
Version: BRMS 5.3.0.GA
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Kris Verlaenen
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-05-02 15:09 UTC by Radovan Synek
Modified: 2025-02-10 03:19 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-02-10 03:19:46 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Radovan Synek 2012-05-02 15:09:31 UTC
Process instance stays in "active" state after user task has been completed (simple process start -> user task -> end). This happens only with JPA knowledge session; with common stateful knowledge session without persistence process instance is marked as "completed".

On the other hand ProcessCompletedEvent is fired in both cases.

The reproducer will be added soon.

Comment 1 Radovan Synek 2012-05-02 15:22:14 UTC
here is the promised reproducer:

https://github.com/droolsjbpm/jbpm/pull/99

Comment 2 Maciej Swiderski 2012-05-03 09:42:06 UTC
Tests fails due to inspecting disconnected snapshot of the process instance since it uses persistence after completion the process instance does not reflect the latest status. Instead of verifying of the disconnected status you should use helper assertion methods that come with JbpmBpmn2TestCase, for instance to check if instance is completed:
assertProcessInstanceCompleted(pi.getId(), ksession);

instead of 
assertEquals(ProcessInstance.STATE_COMPLETED, pi.getState());

more details about test support can be found in documentation: https://hudson.qa.jboss.com/hudson/view/Drools%20jBPM/job/jbpm-5.2.x/lastSuccessfulBuild/artifact/jbpm-distribution/target/jbpm-5.2.1-SNAPSHOT-docs-build/jbpm-docs/html_single/index.html#d0e7010

Comment 3 Radovan Synek 2012-05-04 08:01:27 UTC
Hi Maciej,

actually I don't use these assertions, because ProcessInstance class has defined 5 different states and there are only 3 assert methods: completed, aborted, active. Moreover, assertProcessInstanceCompleted and assertProcessInstanceAborted both check if process instance is null => you can't distinguish between completed and aborted process instance. AssertProcessInstanceActive checks if the process instance is not null. Again, no state checking.

If you take a look on JBPM unit tests - especially BPMN2 module, you can see there are used both ways - assertProcessInstanceCompleted and checking ProcessInstance.STATE_COMPLETED.

But as far as I understand it, none of them can be used safely.

Regards,

Radek

Comment 4 Maciej Swiderski 2012-05-04 09:38:34 UTC
Radek, I got your point and in fact I agree with it that we could think about improved version of tests assertion to not make user confused with the results and I believe that was the intention of having this helper methods to shield users from checking it differently if it uses persistence or not. Session will have only processes that are active and thus you get null for completed processes. Additionally you could verify completed nodes with another helper method to secure they were visited as expected (assertNodeTriggered).

I believe the issue reported by this bz could be considered as work as design since the process is completed as expected. Whyt?

Comment 5 Kris Verlaenen 2012-05-09 16:28:33 UTC
The reported issue is not a bug, as everything is working as expected.  I agree that we can improve the assertions, and depending on what features you have enabled (persistence, audit log, etc.) we can then make the assertions more intelligent.

We will take these recommendations into account.  Adding dev_ack- for now, as there's no time to do these improvements for this release unfortunately.

Comment 6 Maciej Swiderski 2013-08-20 14:30:04 UTC
assertions has been improved as can be seen here: https://github.com/droolsjbpm/jbpm/blob/master/jbpm-bpmn2/src/test/java/org/jbpm/bpmn2/JbpmBpmn2TestCase.java#L633

Shall this bz be moved to version 6 somehow? If so I would mark it as verified.

Comment 10 Red Hat Bugzilla 2025-02-10 03:19:46 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.


Note You need to log in before you can comment on or make changes to this bug.