use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class BatchModificationHistoryTest method testHistoricMonitorJobLog.
@Test
public void testHistoricMonitorJobLog() {
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
Batch batch = helper.startAfterAsync("process1", 1, "user1", processDefinition.getId());
// when the seed job is executed
helper.executeSeedJob(batch);
Job monitorJob = helper.getMonitorJob(batch);
List<HistoricJobLog> jobLogs = helper.getHistoricMonitorJobLog(batch, monitorJob);
assertEquals(1, jobLogs.size());
// then a creation historic job log exists for the monitor job without due date
HistoricJobLog jobLog = jobLogs.get(0);
assertCommonMonitorJobLogProperties(batch, jobLog);
assertTrue(jobLog.isCreationLog());
assertEquals(START_DATE, jobLog.getTimestamp());
assertNull(jobLog.getJobDueDate());
// when the monitor job is executed
Date executionDate = helper.addSecondsToClock(15);
Date monitorJobDueDate = helper.addSeconds(executionDate, 30);
helper.executeMonitorJob(batch);
jobLogs = helper.getHistoricMonitorJobLog(batch, monitorJob);
assertEquals(2, jobLogs.size());
// then a success job log was created for the last monitor job
jobLog = jobLogs.get(1);
assertCommonMonitorJobLogProperties(batch, jobLog);
assertTrue(jobLog.isSuccessLog());
assertEquals(executionDate, jobLog.getTimestamp());
assertNull(jobLog.getJobDueDate());
// and a creation job log for the new monitor job was created with due date
monitorJob = helper.getMonitorJob(batch);
jobLogs = helper.getHistoricMonitorJobLog(batch, monitorJob);
assertEquals(1, jobLogs.size());
jobLog = jobLogs.get(0);
assertCommonMonitorJobLogProperties(batch, jobLog);
assertTrue(jobLog.isCreationLog());
assertEquals(executionDate, jobLog.getTimestamp());
assertEquals(monitorJobDueDate, jobLog.getJobDueDate());
// when the modification and monitor jobs are executed
executionDate = helper.addSecondsToClock(15);
helper.executeJobs(batch);
helper.executeMonitorJob(batch);
jobLogs = helper.getHistoricMonitorJobLog(batch, monitorJob);
assertEquals(2, jobLogs.size());
// then a success job log was created for the last monitor job
jobLog = jobLogs.get(1);
assertCommonMonitorJobLogProperties(batch, jobLog);
assertTrue(jobLog.isSuccessLog());
assertEquals(executionDate, jobLog.getTimestamp());
assertEquals(monitorJobDueDate, jobLog.getJobDueDate());
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class BatchModificationHistoryTest method testHistoricBatchJobLogForBatchDeletion.
@Test
public void testHistoricBatchJobLogForBatchDeletion() {
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
Batch batch = helper.startBeforeAsync("process1", 1, "user2", processDefinition.getId());
helper.executeSeedJob(batch);
// when
Date deletionDate = helper.addSecondsToClock(12);
rule.getManagementService().deleteBatch(batch.getId(), false);
// then a deletion historic job log was added
HistoricJobLog jobLog = helper.getHistoricBatchJobLog(batch).get(1);
assertNotNull(jobLog);
assertTrue(jobLog.isDeletionLog());
assertEquals(deletionDate, jobLog.getTimestamp());
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class BatchMigrationHistoryTest method testHistoricMonitorJobLogForBatchDeletion.
@Test
public void testHistoricMonitorJobLogForBatchDeletion() {
Batch batch = helper.migrateProcessInstancesAsync(1);
helper.executeSeedJob(batch);
// when
Date deletionDate = helper.addSecondsToClock(12);
managementService.deleteBatch(batch.getId(), false);
// then a deletion historic job log was added
HistoricJobLog jobLog = helper.getHistoricMonitorJobLog(batch).get(1);
assertNotNull(jobLog);
assertTrue(jobLog.isDeletionLog());
assertEquals(deletionDate, jobLog.getTimestamp());
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class BatchMigrationHistoryTest method testHistoricSeedJobLog.
@Test
public void testHistoricSeedJobLog() {
// when
Batch batch = helper.migrateProcessInstancesAsync(1);
// then a historic job log exists for the seed job
HistoricJobLog jobLog = helper.getHistoricSeedJobLog(batch).get(0);
assertNotNull(jobLog);
assertTrue(jobLog.isCreationLog());
assertEquals(batch.getSeedJobDefinitionId(), jobLog.getJobDefinitionId());
assertEquals(BatchSeedJobHandler.TYPE, jobLog.getJobDefinitionType());
assertEquals(batch.getId(), jobLog.getJobDefinitionConfiguration());
assertEquals(START_DATE, jobLog.getTimestamp());
assertNull(jobLog.getDeploymentId());
assertNull(jobLog.getProcessDefinitionId());
assertNull(jobLog.getExecutionId());
assertNull(jobLog.getJobDueDate());
// when the seed job is executed
Date executionDate = helper.addSecondsToClock(12);
helper.executeSeedJob(batch);
// then a new historic job log exists for the seed job
jobLog = helper.getHistoricSeedJobLog(batch).get(1);
assertNotNull(jobLog);
assertTrue(jobLog.isSuccessLog());
assertEquals(batch.getSeedJobDefinitionId(), jobLog.getJobDefinitionId());
assertEquals(BatchSeedJobHandler.TYPE, jobLog.getJobDefinitionType());
assertEquals(batch.getId(), jobLog.getJobDefinitionConfiguration());
assertEquals(executionDate, jobLog.getTimestamp());
assertNull(jobLog.getDeploymentId());
assertNull(jobLog.getProcessDefinitionId());
assertNull(jobLog.getExecutionId());
assertNull(jobLog.getJobDueDate());
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class BatchMigrationHistoryTest method testHistoricBatchJobLog.
@Test
public void testHistoricBatchJobLog() {
Batch batch = helper.migrateProcessInstancesAsync(1);
helper.executeSeedJob(batch);
String sourceDeploymentId = helper.getSourceProcessDefinition().getDeploymentId();
// when
Date executionDate = helper.addSecondsToClock(12);
helper.executeJobs(batch);
// then a historic job log exists for the batch job
HistoricJobLog jobLog = helper.getHistoricBatchJobLog(batch).get(0);
assertNotNull(jobLog);
assertTrue(jobLog.isCreationLog());
assertEquals(batch.getBatchJobDefinitionId(), jobLog.getJobDefinitionId());
assertEquals(Batch.TYPE_PROCESS_INSTANCE_MIGRATION, jobLog.getJobDefinitionType());
assertEquals(batch.getId(), jobLog.getJobDefinitionConfiguration());
assertEquals(START_DATE, jobLog.getTimestamp());
assertEquals(sourceDeploymentId, jobLog.getDeploymentId());
assertNull(jobLog.getProcessDefinitionId());
assertNull(jobLog.getExecutionId());
assertNull(jobLog.getJobDueDate());
jobLog = helper.getHistoricBatchJobLog(batch).get(1);
assertNotNull(jobLog);
assertTrue(jobLog.isSuccessLog());
assertEquals(batch.getBatchJobDefinitionId(), jobLog.getJobDefinitionId());
assertEquals(Batch.TYPE_PROCESS_INSTANCE_MIGRATION, jobLog.getJobDefinitionType());
assertEquals(batch.getId(), jobLog.getJobDefinitionConfiguration());
assertEquals(executionDate, jobLog.getTimestamp());
assertEquals(sourceDeploymentId, jobLog.getDeploymentId());
assertNull(jobLog.getProcessDefinitionId());
assertNull(jobLog.getExecutionId());
assertNull(jobLog.getJobDueDate());
}
Aggregations