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.TestCase;
24  import junit.framework.TestSuite;
25  
26  //import org.apache.turbine.test.BaseTestCase;
27  
28  /**
29   * Unit testing for Job Entries.  Ensure that removing NumberKey from TurbineNonPersistentScheduler
30   * still works.
31   *
32   * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
33   * @version $Id: JobEntryTest.java 615328 2008-01-25 20:25:05Z tv $
34   */
35  public class JobEntryTest extends TestCase
36  {
37  
38      private JobEntry je1;
39      private JobEntry je2;
40  
41      public JobEntryTest(String name)
42              throws Exception
43      {
44          super(name);
45  
46          // Add a new job entry
47          je1 = new JobEntry();
48          je1.setJobId(1);
49          je1.setSecond(0);
50          je1.setMinute(1);
51          je1.setHour(-1);
52          je1.setDayOfMonth(-1);
53          je1.setWeekDay(-1);
54          je1.setTask("SimpleJob");
55  
56          je2 = new JobEntry();
57          je2.setJobId(2);
58          je2.setSecond(0);
59          je2.setMinute(1);
60          je2.setHour(-1);
61          je2.setDayOfMonth(-1);
62          je2.setWeekDay(-1);
63          je2.setTask("SimpleJob");
64      }
65  
66      public static Test suite()
67      {
68          return new TestSuite(JobEntryTest.class);
69      }
70  
71      /**
72       * Tests the ability to enable and disable the service.
73       */
74      public void testCompareTo()
75      {
76          assertFalse(je1.equals(je2));
77          je2.setJobId(je1.getJobId());
78          assertTrue(je1.equals(je2));
79  
80      }
81  
82  }