int startEndCounter = TestAction.counter;
int startCounter = TestAction2.counter;
int endCounter = TestAction3.counter;
Job job = scheduler.createJob("startEndJob", TestAction.class, jobParams, startEndJobTrigger);
Job job2 = scheduler.createJob( "startJob", TestAction2.class, jobParams, startJobTrigger );
Job job3 = scheduler.createJob( "endJob", TestAction3.class, jobParams, endJobTrigger );
try{
sleep( 10 );
Assert.assertEquals( startEndCounter, TestAction.counter );
Assert.assertEquals( startCounter, TestAction2.counter );
Assert.assertTrue( endCounter != TestAction3.counter );
endCounter = TestAction3.counter;
sleep( 20 );
Assert.assertTrue( startEndCounter != TestAction.counter );
Assert.assertTrue( startCounter != TestAction2.counter );
Assert.assertTrue( endCounter != TestAction3.counter );
sleep( 60 );
startEndCounter = TestAction.counter;
startCounter = TestAction2.counter;
endCounter = TestAction3.counter;
sleep( 30 );
Assert.assertEquals( startEndCounter, TestAction.counter );
Assert.assertTrue( startCounter != TestAction2.counter );
Assert.assertEquals( endCounter, TestAction3.counter );
}
catch( Throwable ex ){
TestCase.fail();
}
finally{
scheduler.removeJob( job.getJobId() );
scheduler.removeJob( job2.getJobId() );
scheduler.removeJob( job3.getJobId() );
}
Assert.assertEquals( 0, scheduler.getJobs( null ).size() );
}