01: package test;
02:
03: import dalma.endpoints.timer.TimerEndPoint;
04: import dalma.test.Launcher;
05: import dalma.test.Launcher;
06:
07: import java.io.Serializable;
08:
09: import static dalma.TimeUnit.SECONDS;
10:
11: /**
12: * Tests timer endPoint.
13: *
14: * @author Kohsuke Kawaguchi
15: */
16: public class TimerTest extends Launcher {
17: public TimerTest(String[] args) throws Exception {
18: super (args);
19: }
20:
21: public static void main(String[] args) throws Exception {
22: new TimerTest(args);
23: }
24:
25: protected void init() throws Exception {
26: createConversation(TimerConversation.class);
27: }
28:
29: public static final class TimerConversation implements Runnable,
30: Serializable {
31: public void run() {
32: for (int i = 0; i < 100; i++) {
33: System.out.println("waiting " + i);
34: TimerEndPoint.waitFor(5, SECONDS); // 5 sec
35: }
36: }
37:
38: private static final long serialVersionUID = 1L;
39: }
40: }
|