use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentAuthorizationTest method testStartTimerJobIncidentQueryWithoutAuthorization.
// historic incident query (start timer job incident) //////////////////////////////
public void testStartTimerJobIncidentQueryWithoutAuthorization() {
// given
disableAuthorization();
String jobId = managementService.createJobQuery().singleResult().getId();
managementService.setJobRetries(jobId, 0);
enableAuthorization();
// when
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
// then
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentAuthorizationTest method testSimpleQueryWithoutAuthorization.
// historic incident query ///////////////////////////////////////////
public void testSimpleQueryWithoutAuthorization() {
// given
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
// when
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
// then
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentAuthorizationTest method testSimpleQueryWithReadHistoryPermissionOnProcessDefinition.
public void testSimpleQueryWithReadHistoryPermissionOnProcessDefinition() {
// given
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, ONE_INCIDENT_PROCESS_KEY, userId, READ_HISTORY);
// when
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
// then
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentAuthorizationTest method testQueryForStandaloneHistoricIncidents.
// historic incident query (standalone) //////////////////////////////
public void testQueryForStandaloneHistoricIncidents() {
// given
disableAuthorization();
repositoryService.suspendProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY, true, new Date());
String jobId = null;
List<Job> jobs = managementService.createJobQuery().list();
for (Job job : jobs) {
if (job.getProcessDefinitionKey() == null) {
jobId = job.getId();
break;
}
}
managementService.setJobRetries(jobId, 0);
enableAuthorization();
// when
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
// then
verifyQueryResults(query, 1);
disableAuthorization();
managementService.deleteJob(jobId);
enableAuthorization();
clearDatabase();
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentTest method testDoNotCreateNewIncident.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testDoNotCreateNewIncident() {
startProcessInstance(PROCESS_DEFINITION_KEY);
ProcessInstance pi = runtimeService.createProcessInstanceQuery().singleResult();
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().processInstanceId(pi.getId());
HistoricIncident 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
HistoricIncident tmp = query.singleResult();
assertEquals(incident.getId(), tmp.getId());
assertNull(tmp.getEndTime());
assertTrue(tmp.isOpen());
// 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());
assertNull(tmp.getEndTime());
assertTrue(tmp.isOpen());
}
Aggregations