Using event files
The following example shows how to use &TIME (Clock) events to explicitly set the correlator clock. To do this, the correlator must have been started in external clocking mode (the &TIME events give errors otherwise). Times are in seconds since the midnight, Jan 1970 epoch.
#seed initial time (seconds since Jan 1970 epoch)
&TIME(1)
# Send in configuration of heartbeat interval to 5 SecondsSetHeartbeatInterval(5.0)
# Advance the clock (5.5 seconds)
&TIME(6.5)
# Correlator should have sent heartbeat with id 1 –
# acknowledge all is well
HeartbeatResponse(1,true)
Notice that the input event file has a lot of knowledge regarding the way in which the module will (should) respond. For example, the HeartbeatResponse event expects that the first HeartbeatRequest will have the ID of 1. There is necessarily a close coupling between the input scripts and the implementation of the module being tested. This is another reason why as much of this information should be extracted into the module’s message exchange protocol and made explicit, and perhaps enforced by one or more interface intermediaries.
A single correlator context is guaranteed to generate the same output in the same order, even when EPL timers (such as on all wait()) are employed. This is a benefit of correlator determinism, and makes regression testing, even of temporal logic, possible.
Note: The correlator's behavior can be nondeterministic when events are enqueued between multiple contexts, or when plug-ins are used.
Copyright © 2013
Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.