How to unit test task Reassignment?
Issue
- Unit testing task reassignments using pseudo clock doesn't work.
Following property has been added:
System.setProperty("drools.clockType", "pseudo");
in the @Before
and replaced
Thread.sleep( 5000 );
with
PseudoClockScheduler sessionClock = ksession.getSessionClock();
sessionClock.advanceTime(5, TimeUnit.SECONDS);
Session time does seem to be advancing (tested by printing the session time before and after the advance statement) but when you run the test you will notice that the task is still assigned to john. Our reassignment durations are in the order of hours and so it's not feasible to unit test with the real clock.
Environment
- Red Hat JBoss BPM Suite
- 6
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.