use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.
the class IncidentAuthorizationTest method testQueryWithReadPermissionOnAnyProcessInstance.
public void testQueryWithReadPermissionOnAnyProcessInstance() {
// given
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, READ);
// when
IncidentQuery query = runtimeService.createIncidentQuery();
// then
verifyQueryResults(query, 7);
}
use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.
the class IncidentAuthorizationTest method testQueryForStandaloneIncidents.
public void testQueryForStandaloneIncidents() {
// 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
IncidentQuery query = runtimeService.createIncidentQuery();
// then
verifyQueryResults(query, 1);
disableAuthorization();
managementService.deleteJob(jobId);
enableAuthorization();
clearDatabase();
}
use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.
the class IncidentAuthorizationTest method testQueryWithReadInstancesPermissionOnOneTaskProcess.
public void testQueryWithReadInstancesPermissionOnOneTaskProcess() {
// given
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, ONE_INCIDENT_PROCESS_KEY, userId, READ_INSTANCE);
// when
IncidentQuery query = runtimeService.createIncidentQuery();
// then
verifyQueryResults(query, 3);
}
use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.
the class IncidentAuthorizationTest method testQueryWithoutAuthorization.
public void testQueryWithoutAuthorization() {
// given
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
// when
IncidentQuery query = runtimeService.createIncidentQuery();
// then
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByIncidentMessage.
@Test
public void testQueryByIncidentMessage() {
IncidentQuery query = runtimeService.createIncidentQuery().incidentMessage("Expected_exception.");
assertEquals(4, query.count());
List<Incident> incidents = query.list();
assertFalse(incidents.isEmpty());
assertEquals(4, incidents.size());
}
Aggregations