1 package org.apache.turbine.modules.scheduledjob;
2
3
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 */
22
23
24 import org.apache.turbine.modules.ScheduledJob;
25 import org.apache.turbine.services.schedule.JobEntry;
26
27 /**
28 * Simple job for use with unit testing of the scheduler service. This
29 * job merely increments a static counter variable when it is run. You
30 * can check the counter to verify the job has run.
31 *
32 * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
33 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
34 * @version $Id: SimpleJob.java 615328 2008-01-25 20:25:05Z tv $
35 */
36 public class SimpleJob
37 extends ScheduledJob
38 {
39 /** The test counter */
40 private static int counter = 0;
41
42 /**
43 * Run the Jobentry from the scheduler queue.
44 *
45 * @param job The job to run.
46 * @throws java.lang.Exception generic exception
47 */
48 public void run(JobEntry job)
49 throws Exception
50 {
51 counter++;
52 System.out.println("\n\nI AM RUNNING!\n\n");
53
54 }
55 /**
56 * Returns the counter value.
57 *
58 * @return The counter value
59 */
60 public static int getCounter()
61 {
62 return counter;
63 }
64
65 /**
66 * Sets the counter.
67 *
68 * @param i The new counter value
69 */
70 public static void setCounter(int i)
71 {
72 counter = i;
73 }
74 }