use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricIncidentQueryTest method testQueryWithoutTenantId.
public void testQueryWithoutTenantId() {
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 MultiTenancyHistoricIncidentQueryTest method testQueryByTenantId.
public void testQueryByTenantId() {
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().tenantIdIn(TENANT_ONE);
assertThat(query.count(), is(1L));
query = historyService.createHistoricIncidentQuery().tenantIdIn(TENANT_TWO);
assertThat(query.count(), is(1L));
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricIncidentQueryTest method testQueryAuthenticatedTenant.
public void testQueryAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count(), is(1L));
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentTest method testSetRetriesByJobDefinitionIdResolveIncident.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testSetRetriesByJobDefinitionIdResolveIncident() {
startProcessInstance(PROCESS_DEFINITION_KEY);
ProcessInstance pi = runtimeService.createProcessInstanceQuery().singleResult();
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().processInstanceId(pi.getId());
HistoricIncident incident = query.singleResult();
assertNotNull(incident);
runtimeService.setVariable(pi.getId(), "fail", false);
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());
assertNotNull(tmp.getEndTime());
assertTrue(tmp.isResolved());
assertProcessEnded(pi.getId());
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentTest method testCreateSecondHistoricIncident.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testCreateSecondHistoricIncident() {
startProcessInstance(PROCESS_DEFINITION_KEY);
String jobId = managementService.createJobQuery().singleResult().getId();
managementService.setJobRetries(jobId, 1);
executeAvailableJobs();
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
assertEquals(2, query.count());
// the first historic incident has been resolved
assertEquals(1, query.resolved().count());
query = historyService.createHistoricIncidentQuery();
// a new historic incident exists which is open
assertEquals(1, query.open().count());
}
Aggregations