use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class BatchMigrationHistoryTest method testHistoricBatchJobLogForBatchDeletion.
@Test
public void testHistoricBatchJobLogForBatchDeletion() {
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.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 testHistoricMonitorJobLog.
@Test
public void testHistoricMonitorJobLog() {
Batch batch = helper.migrateProcessInstancesAsync(1);
// 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 migration 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 HistoricJobLogAuthorizationTest method testQueryAfterStandaloneJob.
// historic job log query (standalone job) ///////////////////////
public void testQueryAfterStandaloneJob() {
// given
disableAuthorization();
repositoryService.suspendProcessDefinitionByKey(TIMER_BOUNDARY_PROCESS_KEY, true, new Date());
enableAuthorization();
// when
HistoricJobLogQuery query = historyService.createHistoricJobLogQuery();
// then
verifyQueryResults(query, 1);
HistoricJobLog jobLog = query.singleResult();
assertNull(jobLog.getProcessDefinitionKey());
deleteDeployment(deploymentId);
disableAuthorization();
String jobId = managementService.createJobQuery().singleResult().getId();
managementService.deleteJob(jobId);
enableAuthorization();
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class BulkHistoryDeleteTest method findExceptionByteArrayIds.
private List<String> findExceptionByteArrayIds() {
List<String> exceptionByteArrayIds = new ArrayList<String>();
List<HistoricJobLog> historicJobLogs = historyService.createHistoricJobLogQuery().list();
for (HistoricJobLog historicJobLog : historicJobLogs) {
HistoricJobLogEventEntity historicJobLogEventEntity = (HistoricJobLogEventEntity) historicJobLog;
if (historicJobLogEventEntity.getExceptionByteArrayId() != null) {
exceptionByteArrayIds.add(historicJobLogEventEntity.getExceptionByteArrayId());
}
}
return exceptionByteArrayIds;
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class JobExecutorTest method testBasicJobExecutorOperation.
public void testBasicJobExecutorOperation() throws Exception {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
JobManager jobManager = commandContext.getJobManager();
jobManager.send(createTweetMessage("message-one"));
jobManager.send(createTweetMessage("message-two"));
jobManager.send(createTweetMessage("message-three"));
jobManager.send(createTweetMessage("message-four"));
jobManager.schedule(createTweetTimer("timer-one", new Date()));
jobManager.schedule(createTweetTimer("timer-two", new Date()));
return null;
}
});
executeAvailableJobs();
Set<String> messages = new HashSet<String>(tweetHandler.getMessages());
Set<String> expectedMessages = new HashSet<String>();
expectedMessages.add("message-one");
expectedMessages.add("message-two");
expectedMessages.add("message-three");
expectedMessages.add("message-four");
expectedMessages.add("timer-one");
expectedMessages.add("timer-two");
assertEquals(new TreeSet<String>(expectedMessages), new TreeSet<String>(messages));
commandExecutor.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
List<HistoricJobLog> historicJobLogs = processEngineConfiguration.getHistoryService().createHistoricJobLogQuery().list();
for (HistoricJobLog historicJobLog : historicJobLogs) {
commandContext.getHistoricJobLogManager().deleteHistoricJobLogById(historicJobLog.getId());
}
return null;
}
});
}
Aggregations