assertTrue(this.stat.getLastActivatedJobTime() >= now);
assertTrue(this.stat.getLastFinishedJobTime() <= now);
}
@org.junit.Test public void testMisc() {
final StatisticsImpl stat2 = new StatisticsImpl(200);
assertEquals(200, stat2.getStartTime());
// update stat
this.testFailAndCancel();
long now = System.currentTimeMillis();
final StatisticsImpl copy = new StatisticsImpl();
copy.copyFrom(this.stat);
assertTrue(copy.getStartTime() >= now);
assertEquals(400, copy.getAverageProcessingTime());
assertEquals(200, copy.getAverageWaitingTime());
assertEquals(0, copy.getNumberOfActiveJobs());
assertEquals(1, copy.getNumberOfCancelledJobs());
assertEquals(1, copy.getNumberOfFailedJobs());
assertEquals(3, copy.getNumberOfFinishedJobs());
assertEquals(0, copy.getNumberOfJobs());
assertEquals(5, copy.getNumberOfProcessedJobs());
assertEquals(0, copy.getNumberOfQueuedJobs());
assertTrue(copy.getLastActivatedJobTime() <= now);
assertTrue(copy.getLastFinishedJobTime() <= now);
now = System.currentTimeMillis();
this.stat.incQueued();
this.stat.addActive(200);
this.stat.finishedJob(400);
assertEquals(400, this.stat.getAverageProcessingTime());
assertEquals(200, this.stat.getAverageWaitingTime());
assertEquals(0, this.stat.getNumberOfActiveJobs());
assertEquals(1, this.stat.getNumberOfCancelledJobs());
assertEquals(1, this.stat.getNumberOfFailedJobs());
assertEquals(4, this.stat.getNumberOfFinishedJobs());
assertEquals(0, this.stat.getNumberOfJobs());
assertEquals(6, this.stat.getNumberOfProcessedJobs());
assertEquals(0, this.stat.getNumberOfQueuedJobs());
assertTrue(this.stat.getLastActivatedJobTime() >= now);
assertTrue(this.stat.getLastFinishedJobTime() >= now);
copy.add(this.stat);
assertTrue(copy.getStartTime() <= now);
assertEquals(400, copy.getAverageProcessingTime());
assertEquals(200, copy.getAverageWaitingTime());
assertEquals(0, copy.getNumberOfActiveJobs());
assertEquals(2, copy.getNumberOfCancelledJobs());
assertEquals(2, copy.getNumberOfFailedJobs());
assertEquals(7, copy.getNumberOfFinishedJobs());
assertEquals(0, copy.getNumberOfJobs());
assertEquals(11, copy.getNumberOfProcessedJobs());
assertEquals(0, copy.getNumberOfQueuedJobs());
assertTrue(copy.getLastActivatedJobTime() >= now);
assertTrue(copy.getLastFinishedJobTime() >= now);
this.stat.incQueued();
this.stat.incQueued();
assertEquals(400, this.stat.getAverageProcessingTime());
assertEquals(200, this.stat.getAverageWaitingTime());