use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricIncidentQueryTest method testQueryDisabledTenantCheck.
public void testQueryDisabledTenantCheck() {
processEngineConfiguration.setTenantCheckEnabled(false);
identityService.setAuthentication("user", null, null);
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
assertThat(query.count(), is(2L));
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentAuthorizationTest method testMixedQueryWithReadHistoryPermissionOnAnyProcessDefinition.
public void testMixedQueryWithReadHistoryPermissionOnAnyProcessDefinition() {
// given
disableAuthorization();
repositoryService.suspendProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY, true, new Date());
String firstJobId = null;
List<Job> jobs = managementService.createJobQuery().withRetriesLeft().list();
for (Job job : jobs) {
if (job.getProcessDefinitionKey() == null) {
firstJobId = job.getId();
break;
}
}
managementService.setJobRetries(firstJobId, 0);
repositoryService.suspendProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY, true, new Date());
String secondJobId = null;
jobs = managementService.createJobQuery().withRetriesLeft().list();
for (Job job : jobs) {
if (job.getProcessDefinitionKey() == null) {
secondJobId = job.getId();
break;
}
}
managementService.setJobRetries(secondJobId, 0);
enableAuthorization();
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);
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
// when
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
// then
verifyQueryResults(query, 7);
disableAuthorization();
managementService.deleteJob(firstJobId);
managementService.deleteJob(secondJobId);
enableAuthorization();
clearDatabase();
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentAuthorizationTest method testMixedQueryWithoutAuthorization.
// historic job log (mixed) //////////////////////////////////////////
public void testMixedQueryWithoutAuthorization() {
// given
disableAuthorization();
repositoryService.suspendProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY, true, new Date());
String firstJobId = null;
List<Job> jobs = managementService.createJobQuery().withRetriesLeft().list();
for (Job job : jobs) {
if (job.getProcessDefinitionKey() == null) {
firstJobId = job.getId();
break;
}
}
managementService.setJobRetries(firstJobId, 0);
repositoryService.suspendProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY, true, new Date());
String secondJobId = null;
jobs = managementService.createJobQuery().withRetriesLeft().list();
for (Job job : jobs) {
if (job.getProcessDefinitionKey() == null) {
secondJobId = job.getId();
break;
}
}
managementService.setJobRetries(secondJobId, 0);
enableAuthorization();
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);
// when
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
// then
verifyQueryResults(query, 2);
disableAuthorization();
managementService.deleteJob(firstJobId);
managementService.deleteJob(secondJobId);
enableAuthorization();
clearDatabase();
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentAuthorizationTest method testMixedQueryWithReadHistoryPermissionOnProcessDefinition.
public void testMixedQueryWithReadHistoryPermissionOnProcessDefinition() {
// given
disableAuthorization();
repositoryService.suspendProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY, true, new Date());
String firstJobId = null;
List<Job> jobs = managementService.createJobQuery().withRetriesLeft().list();
for (Job job : jobs) {
if (job.getProcessDefinitionKey() == null) {
firstJobId = job.getId();
break;
}
}
managementService.setJobRetries(firstJobId, 0);
repositoryService.suspendProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY, true, new Date());
String secondJobId = null;
jobs = managementService.createJobQuery().withRetriesLeft().list();
for (Job job : jobs) {
if (job.getProcessDefinitionKey() == null) {
secondJobId = job.getId();
break;
}
}
managementService.setJobRetries(secondJobId, 0);
enableAuthorization();
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);
createGrantAuthorization(PROCESS_DEFINITION, ONE_INCIDENT_PROCESS_KEY, userId, READ_HISTORY);
// when
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
// then
verifyQueryResults(query, 4);
disableAuthorization();
managementService.deleteJob(firstJobId);
managementService.deleteJob(secondJobId);
enableAuthorization();
clearDatabase();
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentAuthorizationTest method testQueryWithoutAuthorization.
// historic incident query (multiple incidents ) ///////////////////////////////////////////
public void testQueryWithoutAuthorization() {
// given
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);
// when
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
// then
verifyQueryResults(query, 0);
}
Aggregations