assertEquals(jobDefinition.getId(), activeJobDefinition.getId());
assertFalse(activeJobDefinition.isSuspended());
// the job is still active
JobQuery jobQuery = managementService.createJobQuery();
assertEquals(0, jobQuery.suspended().count());
assertEquals(2, jobQuery.active().count()); // there exists two jobs, a failing job and a timer job
// when
// execute job
managementService.executeJob(timerToSuspendProcessDefinition.getId());
// then
// the job definition should be suspended
assertEquals(0, jobDefinitionQuery.active().count());
assertEquals(1, jobDefinitionQuery.suspended().count());
JobDefinition suspendedJobDefinition = jobDefinitionQuery.suspended().singleResult();
assertEquals(jobDefinition.getId(), suspendedJobDefinition.getId());
assertTrue(suspendedJobDefinition.isSuspended());
// the job is still active
assertEquals(0, jobQuery.active().count());
assertEquals(1, jobQuery.suspended().count());
Job job = jobQuery.suspended().singleResult();
assertEquals(jobDefinition.getId(), job.getJobDefinitionId());
assertTrue(job.isSuspended());
// db cleanup