commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Evan Reynolds (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SCXML-189) Event Replay Scheduler
Date Mon, 20 Jan 2014 20:09:19 GMT
Evan Reynolds created SCXML-189:
-----------------------------------

             Summary: Event Replay Scheduler
                 Key: SCXML-189
                 URL: https://issues.apache.org/jira/browse/SCXML-189
             Project: Commons SCXML
          Issue Type: New Feature
            Reporter: Evan Reynolds
            Priority: Minor


It can be very hard to unit test state machines that have timers. It can also be hard to replay
events in a timely fashion - you hit the timer, and unless you're willing to wait, you can't
test.

This is a timer class that I used that acts as a normal event dispatcher. But instead of firing
events on a normal schedule, it makes a call available to register the current time. If you
call that with new time values, it will fire off any events that have been started that need
to be fired off.

So to use this to replay events, simply register the time the event happened, then fire the
event. All timers will then take care of themselves. To use it to unit test events, you can
go into a state with a timer, call the register time method to move the clock up until the
timer should fire, and watch to see what happens.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message