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