1   package org.apache.turbine.services.schedule;
2   
3   /*
4    * Copyright 2001-2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import junit.framework.Test;
20  import junit.framework.TestSuite;
21  
22  import org.apache.turbine.test.BaseTestCase;
23  
24  /***
25   * Unit testing for Job Entries.  Ensure that removing NumberKey from TurbineNonPersistentScheduler
26   * still works.
27   *
28   * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
29   * @version $Id: JobEntryTest.java 264148 2005-08-29 14:21:04Z henning $
30   */
31  public class JobEntryTest extends BaseTestCase
32  {
33      private JobEntry je1;
34      private JobEntry je2;
35  
36      public JobEntryTest(String name)
37              throws Exception
38      {
39          super(name);
40  
41          // Add a new job entry
42          je1 = new JobEntry();
43          je1.setJobId(1);
44          je1.setSecond(0);
45          je1.setMinute(1);
46          je1.setHour(-1);
47          je1.setDayOfMonth(-1);
48          je1.setWeekDay(-1);
49          je1.setTask("SimpleJob");
50  
51          je2 = new JobEntry();
52          je2.setJobId(2);
53          je2.setSecond(0);
54          je2.setMinute(1);
55          je2.setHour(-1);
56          je2.setDayOfMonth(-1);
57          je2.setWeekDay(-1);
58          je2.setTask("SimpleJob");
59      }
60  
61      public static Test suite()
62      {
63          return new TestSuite(JobEntryTest.class);
64      }
65  
66      /***
67       * Tests the ability to enable and disable the service.
68       */
69      public void testCompareTo()
70      {
71          assertFalse(je1.equals(je2));
72          je2.setJobId(je1.getJobId());
73          assertTrue(je1.equals(je2));
74  
75      }
76  
77  }