use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class BatchSuspensionTest method shouldSuspendExecutionJobsAndDefinition.
@Test
public void shouldSuspendExecutionJobsAndDefinition() {
// given
Batch batch = helper.migrateProcessInstancesAsync(1);
helper.executeSeedJob(batch);
// when
managementService.suspendBatchById(batch.getId());
// then
JobDefinition migrationJobDefinition = helper.getExecutionJobDefinition(batch);
assertTrue(migrationJobDefinition.isSuspended());
Job migrationJob = helper.getExecutionJobs(batch).get(0);
assertTrue(migrationJob.isSuspended());
}
use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class BatchSuspensionTest method shouldActivateExecutionJobsAndDefinition.
@Test
public void shouldActivateExecutionJobsAndDefinition() {
// given
Batch batch = helper.migrateProcessInstancesAsync(1);
managementService.suspendBatchById(batch.getId());
helper.executeSeedJob(batch);
// when
managementService.activateBatchById(batch.getId());
// then
JobDefinition migrationJobDefinition = helper.getExecutionJobDefinition(batch);
assertFalse(migrationJobDefinition.isSuspended());
Job migrationJob = helper.getExecutionJobs(batch).get(0);
assertFalse(migrationJob.isSuspended());
}
use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class BatchSuspensionTest method shouldActivateMonitorJobAndDefinition.
@Test
public void shouldActivateMonitorJobAndDefinition() {
// given
Batch batch = helper.migrateProcessInstancesAsync(1);
managementService.suspendBatchById(batch.getId());
helper.executeSeedJob(batch);
// when
managementService.activateBatchById(batch.getId());
// then
JobDefinition monitorJobDefinition = helper.getMonitorJobDefinition(batch);
assertFalse(monitorJobDefinition.isSuspended());
Job monitorJob = helper.getMonitorJob(batch);
assertFalse(monitorJob.isSuspended());
}
use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class IncidentTest method testDoNotCreateNewIncident.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/mgmt/IncidentTest.testShouldCreateOneIncident.bpmn" })
public void testDoNotCreateNewIncident() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess");
executeAvailableJobs();
IncidentQuery query = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId());
Incident incident = query.singleResult();
assertNotNull(incident);
JobDefinition jobDefinition = managementService.createJobDefinitionQuery().singleResult();
// set retries to 1 by job definition id
managementService.setJobRetriesByJobDefinitionId(jobDefinition.getId(), 1);
// the incident still exists
Incident tmp = query.singleResult();
assertEquals(incident.getId(), tmp.getId());
// execute the available job (should fail again)
executeAvailableJobs();
// the incident still exists and there
// should be not a new incident
assertEquals(1, query.count());
tmp = query.singleResult();
assertEquals(incident.getId(), tmp.getId());
}
use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class JobDefinitionQueryTest method testQueryWithOverridingJobPriority.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/mgmt/JobDefinitionQueryTest.testBase.bpmn" })
public void testQueryWithOverridingJobPriority() {
// given
JobDefinition jobDefinition = managementService.createJobDefinitionQuery().listPage(0, 1).get(0);
managementService.setOverridingJobPriorityForJobDefinition(jobDefinition.getId(), 42);
// when
JobDefinition queriedDefinition = managementService.createJobDefinitionQuery().withOverridingJobPriority().singleResult();
// then
assertNotNull(queriedDefinition);
assertEquals(jobDefinition.getId(), queriedDefinition.getId());
assertEquals(42L, (long) queriedDefinition.getOverridingJobPriority());
// and
assertEquals(1, managementService.createJobDefinitionQuery().withOverridingJobPriority().count());
}
Aggregations