1 package org.apache.turbine.modules.scheduledjob;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.turbine.modules.ScheduledJob;
23 import org.apache.turbine.services.schedule.JobEntry;
24
25 /***
26 * Simple job for use with unit testing of the scheduler service. This
27 * job merely increments a static counter variable when it is run. You
28 * can check the counter to verify the job has run.
29 *
30 * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
31 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
32 * @version $Id: SimpleJob.java 534527 2007-05-02 16:10:59Z tv $
33 */
34 public class SimpleJob
35 extends ScheduledJob
36 {
37 /*** The test counter */
38 private static int counter = 0;
39
40 /***
41 * Run the Jobentry from the scheduler queue.
42 *
43 * @param job The job to run.
44 * @throws java.lang.Exception generic exception
45 */
46 public void run(JobEntry job)
47 throws Exception
48 {
49 counter++;
50 System.out.println("\n\nI AM RUNNING!\n\n");
51
52 }
53 /***
54 * Returns the counter value.
55 *
56 * @return The counter value
57 */
58 public static int getCounter()
59 {
60 return counter;
61 }
62
63 /***
64 * Sets the counter.
65 *
66 * @param i The new counter value
67 */
68 public static void setCounter(int i)
69 {
70 counter = i;
71 }
72 }