jobManager.addJob(TOPIC + "/start", null);
assertTrue("No event received in the given time.", cb.block(5));
cb.reset();
// get the queue
final Queue q = jobManager.getQueue(QUEUE_NAME);
assertNotNull("Queue '" + QUEUE_NAME + "' should exist!", q);
// suspend it
q.suspend();
// we start "some" jobs:
// first jobs without id
for(int i = 0; i < NUM_JOBS; i++ ) {
final String subTopic = TOPIC + "/sub" + (i % 10);
jobManager.addJob(subTopic, null);
}
// second jobs with id
for(int i = 0; i < NUM_JOBS; i++ ) {
final String subTopic = TOPIC + "/sub" + (i % 10);
jobManager.addJob(subTopic, "id" + i, null);
}
// start the queue
q.resume();
while ( count.get() < 2 * NUM_JOBS + 1 ) {
assertEquals("Failed count", 0, q.getStatistics().getNumberOfFailedJobs());
assertEquals("Cancelled count", 0, q.getStatistics().getNumberOfCancelledJobs());
sleep(500);
}
// we started one event before the test, so add one
assertEquals("Finished count", 2 * NUM_JOBS + 1, count.get());
assertEquals("Finished count", 2 * NUM_JOBS + 1, jobManager.getStatistics().getNumberOfFinishedJobs());
assertEquals("Finished count", 2 * NUM_JOBS + 1, q.getStatistics().getNumberOfFinishedJobs());
assertEquals("Failed count", 0, q.getStatistics().getNumberOfFailedJobs());
assertEquals("Cancelled count", 0, q.getStatistics().getNumberOfCancelledJobs());
} finally {
jc1Reg.unregister();
jcReg.unregister();
ehReg.unregister();
}