use of org.camunda.bpm.engine.history.HistoricJobLogQuery in project camunda-bpm-platform by camunda.
the class HistoricJobLogQueryTest method testQueryByJobExceptionMessage.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml" })
public void testQueryByJobExceptionMessage() {
runtimeService.startProcessInstanceByKey("process");
String jobId = managementService.createJobQuery().singleResult().getId();
try {
managementService.executeJob(jobId);
fail();
} catch (Exception e) {
// expected
}
HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().jobExceptionMessage(FailingDelegate.EXCEPTION_MESSAGE);
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.history.HistoricJobLogQuery in project camunda-bpm-platform by camunda.
the class HistoricJobLogQueryTest method testQueryByInvalidActivityId.
public void testQueryByInvalidActivityId() {
HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().activityIdIn("invalid");
verifyQueryResults(query, 0);
String[] nullValue = null;
try {
query.activityIdIn(nullValue);
fail();
} catch (Exception e) {
}
String[] activityIdsContainsNull = { "a", null, "b" };
try {
query.activityIdIn(activityIdsContainsNull);
fail();
} catch (Exception e) {
}
String[] activityIdsContainsEmptyString = { "a", "", "b" };
try {
query.activityIdIn(activityIdsContainsEmptyString);
fail();
} catch (Exception e) {
}
}
use of org.camunda.bpm.engine.history.HistoricJobLogQuery in project camunda-bpm-platform by camunda.
the class HistoricJobLogRestServiceImpl method queryHistoricJobLogs.
public List<HistoricJobLogDto> queryHistoricJobLogs(HistoricJobLogQueryDto queryDto, Integer firstResult, Integer maxResults) {
queryDto.setObjectMapper(objectMapper);
HistoricJobLogQuery query = queryDto.toQuery(processEngine);
List<HistoricJobLog> matchingHistoricJobLogs;
if (firstResult != null || maxResults != null) {
matchingHistoricJobLogs = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingHistoricJobLogs = query.list();
}
List<HistoricJobLogDto> results = new ArrayList<HistoricJobLogDto>();
for (HistoricJobLog historicJobLog : matchingHistoricJobLogs) {
HistoricJobLogDto result = HistoricJobLogDto.fromHistoricJobLog(historicJobLog);
results.add(result);
}
return results;
}
use of org.camunda.bpm.engine.history.HistoricJobLogQuery 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.HistoricJobLogQuery in project camunda-bpm-platform by camunda.
the class HistoricJobLogAuthorizationTest method testStartTimerJobLogQueryWithReadHistoryPermissionOnProcessDefinition.
public void testStartTimerJobLogQueryWithReadHistoryPermissionOnProcessDefinition() {
// given
createGrantAuthorization(PROCESS_DEFINITION, TIMER_START_PROCESS_KEY, userId, READ_HISTORY);
// when
HistoricJobLogQuery query = historyService.createHistoricJobLogQuery();
// then
verifyQueryResults(query, 1);
}
Aggregations