use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createMonitorJobByIdsAndQuery.
@Test
public void createMonitorJobByIdsAndQuery() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null);
// when
helper.executeSeedJob(batch);
// then the seed job definition still exists but the seed job is removed
JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
assertNotNull(seedJobDefinition);
Job seedJob = helper.getSeedJob(batch);
assertNull(seedJob);
// and a monitor job definition and job exists
JobDefinition monitorJobDefinition = helper.getMonitorJobDefinition(batch);
assertNotNull(monitorJobDefinition);
Job monitorJob = helper.getMonitorJob(batch);
assertNotNull(monitorJob);
}
use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createDeletionJobsByIdsAndQuery.
@Test
public void createDeletionJobsByIdsAndQuery() {
// given
rule.getProcessEngineConfiguration().setBatchJobsPerSeed(5);
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null);
JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
JobDefinition deletionJobDefinition = helper.getExecutionJobDefinition(batch);
;
// when
helper.executeSeedJob(batch);
// then
List<Job> deletionJobs = helper.getJobsForDefinition(deletionJobDefinition);
assertEquals(5, deletionJobs.size());
for (Job deletionJob : deletionJobs) {
assertEquals(deletionJobDefinition.getId(), deletionJob.getJobDefinitionId());
assertNull(deletionJob.getDuedate());
assertNull(deletionJob.getProcessDefinitionId());
assertNull(deletionJob.getProcessDefinitionKey());
assertNull(deletionJob.getProcessInstanceId());
assertNull(deletionJob.getExecutionId());
}
// and the seed job still exists
Job seedJob = helper.getJobForDefinition(seedJobDefinition);
assertNotNull(seedJob);
}
use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createDeletionJobsByQuery.
@Test
public void createDeletionJobsByQuery() {
// given
rule.getProcessEngineConfiguration().setBatchJobsPerSeed(5);
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null);
JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
JobDefinition deletionJobDefinition = helper.getExecutionJobDefinition(batch);
;
// when
helper.executeSeedJob(batch);
// then
List<Job> deletionJobs = helper.getJobsForDefinition(deletionJobDefinition);
assertEquals(5, deletionJobs.size());
for (Job deletionJob : deletionJobs) {
assertEquals(deletionJobDefinition.getId(), deletionJob.getJobDefinitionId());
assertNull(deletionJob.getDuedate());
assertNull(deletionJob.getProcessDefinitionId());
assertNull(deletionJob.getProcessDefinitionKey());
assertNull(deletionJob.getProcessInstanceId());
assertNull(deletionJob.getExecutionId());
}
// and the seed job still exists
Job seedJob = helper.getJobForDefinition(seedJobDefinition);
assertNotNull(seedJob);
}
use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class MigrationTestRule method assertJobRemoved.
public void assertJobRemoved(String activityId, String handlerType) {
JobDefinition jobDefinitionBefore = snapshotBeforeMigration.getJobDefinitionForActivityIdAndType(activityId, handlerType);
assertNotNull("Expected that a job definition for activity '" + activityId + "' exists before migration", jobDefinitionBefore);
Job jobBefore = snapshotBeforeMigration.getJobForDefinitionId(jobDefinitionBefore.getId());
assertNotNull("Expected that a job for activity '" + activityId + "' exists before migration", jobBefore);
assertTimerJob(jobBefore);
for (Job job : snapshotAfterMigration.getJobs()) {
if (jobBefore.getId().equals(job.getId())) {
fail("Expected job '" + jobBefore.getId() + "' to be removed after migration");
}
}
}
use of org.camunda.bpm.engine.management.JobDefinition in project camunda-bpm-platform by camunda.
the class MigrationTestRule method assertJobMigrated.
public void assertJobMigrated(Job jobBefore, String activityIdAfter, Date dueDateAfter) {
Job jobAfter = snapshotAfterMigration.getJobById(jobBefore.getId());
assertNotNull("Expected that a job with id '" + jobBefore.getId() + "' exists after migration", jobAfter);
JobDefinition jobDefinitionAfter = snapshotAfterMigration.getJobDefinitionForActivityIdAndType(activityIdAfter, ((JobEntity) jobBefore).getJobHandlerType());
assertNotNull("Expected that a job definition for activity '" + activityIdAfter + "' exists after migration", jobDefinitionAfter);
assertEquals(jobBefore.getId(), jobAfter.getId());
assertEquals("Expected that job is assigned to job definition '" + jobDefinitionAfter.getId() + "' after migration", jobDefinitionAfter.getId(), jobAfter.getJobDefinitionId());
assertEquals("Expected that job is assigned to deployment '" + snapshotAfterMigration.getDeploymentId() + "' after migration", snapshotAfterMigration.getDeploymentId(), jobAfter.getDeploymentId());
assertEquals(dueDateAfter, jobAfter.getDuedate());
assertEquals(((JobEntity) jobBefore).getType(), ((JobEntity) jobAfter).getType());
assertEquals(jobBefore.getPriority(), jobAfter.getPriority());
assertEquals(jobDefinitionAfter.getProcessDefinitionId(), jobAfter.getProcessDefinitionId());
assertEquals(jobDefinitionAfter.getProcessDefinitionKey(), jobAfter.getProcessDefinitionKey());
}
Aggregations