How to unit test task Reassignment?

Solution Verified - Updated -

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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.