Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6BF41102C5 for ; Mon, 20 Jan 2014 21:49:26 +0000 (UTC) Received: (qmail 15577 invoked by uid 500); 20 Jan 2014 21:49:21 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 15397 invoked by uid 500); 20 Jan 2014 21:49:20 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 15373 invoked by uid 99); 20 Jan 2014 21:49:20 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jan 2014 21:49:20 +0000 Date: Mon, 20 Jan 2014 21:49:20 +0000 (UTC) From: "Evan Reynolds (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (SCXML-189) Event Replay Scheduler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SCXML-189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Evan Reynolds updated SCXML-189: -------------------------------- Attachment: (was: ReplayScheduler.java) > 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)