jobManager.addJob(TOPIC, Collections.singletonMap("id", (Object)"myid2"));
cb.block();
assertEquals(1, jobManager.findJobs(JobManager.QueryType.ALL, TOPIC, -1, (Map<String, Object>[])null).size());
// job is currently waiting, therefore cancel fails
final Job e1 = jobManager.getJob(TOPIC, Collections.singletonMap("id", (Object)"myid2"));
assertNotNull(e1);
cb2.block(); // and continue job
sleep(200);
// the job is now in the queue again
final Job e2 = jobManager.getJob(TOPIC, Collections.singletonMap("id", (Object)"myid2"));
assertNotNull(e2);
assertTrue(jobManager.removeJobById(e2.getId()));
assertEquals(0, jobManager.findJobs(JobManager.QueryType.ALL, TOPIC, -1, (Map<String, Object>[])null).size());
final Collection<Job> col = jobManager.findJobs(JobManager.QueryType.HISTORY, TOPIC, -1, (Map<String, Object>[])null);
try {
assertEquals(1, col.size());
} finally {