use of org.camunda.bpm.engine.history.HistoricIncident in project camunda-bpm-platform by camunda.
the class HistoricIncidentRestServiceImpl method getHistoricIncidents.
@Override
public List<HistoricIncidentDto> getHistoricIncidents(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
HistoricIncidentQueryDto queryDto = new HistoricIncidentQueryDto(objectMapper, uriInfo.getQueryParameters());
HistoricIncidentQuery query = queryDto.toQuery(processEngine);
List<HistoricIncident> queryResult;
if (firstResult != null || maxResults != null) {
queryResult = executePaginatedQuery(query, firstResult, maxResults);
} else {
queryResult = query.list();
}
List<HistoricIncidentDto> result = new ArrayList<HistoricIncidentDto>();
for (HistoricIncident historicIncident : queryResult) {
HistoricIncidentDto dto = HistoricIncidentDto.fromHistoricIncident(historicIncident);
result.add(dto);
}
return result;
}
use of org.camunda.bpm.engine.history.HistoricIncident in project camunda-bpm-platform by camunda.
the class MigrationIncidentTest method historicIncidentRemainsOpenAfterMigration.
@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/migration/calledProcess.bpmn", "org/camunda/bpm/engine/test/api/runtime/migration/calledProcess_v2.bpmn" })
public void historicIncidentRemainsOpenAfterMigration() {
// Given we create a new process instance
ProcessDefinition process1 = engineRule.getRepositoryService().createProcessDefinitionQuery().processDefinitionKey("calledProcess").singleResult();
ProcessInstance processInstance = engineRule.getRuntimeService().startProcessInstanceById(process1.getId());
LockedExternalTask task = engineRule.getExternalTaskService().fetchAndLock(1, "foo").topic("foo", 1000L).execute().get(0);
engineRule.getExternalTaskService().handleFailure(task.getId(), "foo", "error", 0, 1000L);
Incident incidentInProcess = engineRule.getRuntimeService().createIncidentQuery().processDefinitionId(process1.getId()).singleResult();
// when
ProcessDefinition process2 = engineRule.getRepositoryService().createProcessDefinitionQuery().processDefinitionKey("calledProcessV2").singleResult();
MigrationPlan migrationPlan = engineRule.getRuntimeService().createMigrationPlan(process1.getId(), process2.getId()).mapEqualActivities().mapActivities("ServiceTask_1p58ywb", "ServiceTask_V2").build();
engineRule.getRuntimeService().newMigration(migrationPlan).processInstanceIds(processInstance.getId()).execute();
// then
HistoricIncident historicIncidentAfterMigration = engineRule.getHistoryService().createHistoricIncidentQuery().singleResult();
assertNotNull(historicIncidentAfterMigration);
assertNull(historicIncidentAfterMigration.getEndTime());
assertTrue(historicIncidentAfterMigration.isOpen());
HistoricProcessInstance historicProcessInstanceAfterMigration = engineRule.getHistoryService().createHistoricProcessInstanceQuery().withIncidents().incidentStatus("open").singleResult();
assertNotNull(historicProcessInstanceAfterMigration);
Incident incidentAfterMigration = engineRule.getRuntimeService().createIncidentQuery().incidentId(incidentInProcess.getId()).singleResult();
assertEquals(process2.getId(), incidentAfterMigration.getProcessDefinitionId());
assertEquals("ServiceTask_V2", incidentAfterMigration.getActivityId());
}
use of org.camunda.bpm.engine.history.HistoricIncident in project camunda-bpm-platform by camunda.
the class UserOperationLogAuthorizationTest method clearDatabase.
protected void clearDatabase() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Object>() {
public Object execute(CommandContext commandContext) {
commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerSuspendProcessDefinitionHandler.TYPE);
List<HistoricIncident> incidents = Context.getProcessEngineConfiguration().getHistoryService().createHistoricIncidentQuery().list();
for (HistoricIncident incident : incidents) {
commandContext.getHistoricIncidentManager().delete((HistoricIncidentEntity) incident);
}
return null;
}
});
}
use of org.camunda.bpm.engine.history.HistoricIncident in project camunda-bpm-platform by camunda.
the class HistoricIncidentTest method testSetHistoricIncidentToResolved.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testSetHistoricIncidentToResolved() {
startProcessInstance(PROCESS_DEFINITION_KEY);
String jobId = managementService.createJobQuery().singleResult().getId();
managementService.setJobRetries(jobId, 1);
HistoricIncident historicIncident = historyService.createHistoricIncidentQuery().singleResult();
assertNotNull(historicIncident);
assertNotNull(historicIncident.getEndTime());
assertFalse(historicIncident.isOpen());
assertFalse(historicIncident.isDeleted());
assertTrue(historicIncident.isResolved());
}
use of org.camunda.bpm.engine.history.HistoricIncident in project camunda-bpm-platform by camunda.
the class HistoricIncidentTest method testSetHistoricIncidentToDeleted.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testSetHistoricIncidentToDeleted() {
startProcessInstance(PROCESS_DEFINITION_KEY);
String processInstanceId = runtimeService.createProcessInstanceQuery().singleResult().getId();
runtimeService.deleteProcessInstance(processInstanceId, null);
HistoricIncident historicIncident = historyService.createHistoricIncidentQuery().singleResult();
assertNotNull(historicIncident);
assertNotNull(historicIncident.getEndTime());
assertFalse(historicIncident.isOpen());
assertTrue(historicIncident.isDeleted());
assertFalse(historicIncident.isResolved());
}
Aggregations