Assert.assertTrue( "Job did not run.", TestAction3.counter > 3 );
}
@Test
public void editJobTest() throws SchedulerException {
SimpleJobTrigger repeater = new SimpleJobTrigger();
repeater.setStartTime( new Date() );
repeater.setRepeatInterval( 5 );
repeater.setRepeatCount( 20 );
Job job = scheduler.createJob( "testName", TestAction.class, new HashMap<String, Serializable>(), repeater );
sleep( 12 );
Assert.assertTrue( "Job did not run the correct number of times", TestAction.counter >= 2 );
repeater = new SimpleJobTrigger();
repeater.setStartTime( new Date() );
repeater.setRepeatInterval( 20 );
repeater.setRepeatCount( 3 );
int count = TestAction.counter;
System.out.println( "updating job! " + new Date() );
scheduler.updateJob( job.getJobId(), new HashMap<String, Serializable>(), repeater );
List<Job> jobs = scheduler.getJobs( null );
Assert.assertEquals( "Unexpected number of scheduled jobs", 1, jobs.size() );
SimpleJobTrigger simpleJobTrigger = (SimpleJobTrigger) jobs.get( 0 ).getJobTrigger();
Assert.assertEquals( 20, simpleJobTrigger.getRepeatInterval() );
Assert.assertEquals( 3, simpleJobTrigger.getRepeatCount() );
sleep( 5 );
Assert.assertEquals( "Job did not run the correct number of times", count + 1, TestAction.counter );
count = TestAction.counter;
sleep( 10 );
Assert.assertEquals( "Job ran unexpectedly", count, TestAction.counter );