private BpmnModelInstance prepareFailingScriptTask() { BpmnModelInstance bpmnModelInstance = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .scriptTask() .scriptFormat("groovy") .scriptText("x = 5 / 0") .camundaAsyncBefore() .userTask() .endEvent() .done(); return bpmnModelInstance; }
.startEvent() .scriptTask() .camundaAsyncBefore() .scriptFormat("groovy") .scriptText("if(execution.getIncidents().size() == 0) throw new RuntimeException()")
/** * See https://app.camunda.com/jira/browse/CAM-9505 */ @Test public void shouldResolveIncidentWithPreservedCreateTime() { // given testRule.deploy(CALLING_PROCESS); testRule.deploy(Bpmn.createExecutableProcess(CALLED_PROCESS_KEY) .startEvent() .scriptTask() .camundaAsyncBefore() .scriptFormat("groovy") .scriptText("if(execution.getIncidents().size() == 0) throw new RuntimeException()") .userTask() .endEvent().done()); ClockUtil.setCurrentTime(START_DATE); runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY); String jobId = managementService.createJobQuery().singleResult().getId(); managementService.setJobRetries(jobId, 0); try { managementService.executeJob(jobId); } catch (Exception ignored) { } String taskId = historyService.createHistoricTaskInstanceQuery().singleResult().getId(); // when taskService.complete(taskId); List<HistoricIncident> historicIncidents = historyService.createHistoricIncidentQuery().list(); // then assertThat(historicIncidents.get(0).getCreateTime(), is(START_DATE)); assertThat(historicIncidents.get(1).getCreateTime(), is(START_DATE)); }
.startEvent() .scriptTask() .camundaAsyncBefore() .scriptFormat("groovy") .scriptText("if(execution.getIncidents().size() == 0) throw new RuntimeException(\"I'm supposed to fail!\")")
private BpmnModelInstance prepareFailingScriptTask() { BpmnModelInstance bpmnModelInstance = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .scriptTask() .scriptFormat("groovy") .scriptText("x = 5 / 0") .camundaAsyncBefore() .userTask() .endEvent() .done(); return bpmnModelInstance; }
.startEvent() .scriptTask() .camundaAsyncBefore() .scriptFormat("groovy") .scriptText("if(execution.getIncidents().size() == 0) throw new RuntimeException()")
/** * See https://app.camunda.com/jira/browse/CAM-9505 */ @Test public void shouldResolveIncidentWithPreservedCreateTime() { // given testRule.deploy(CALLING_PROCESS); testRule.deploy(Bpmn.createExecutableProcess(CALLED_PROCESS_KEY) .startEvent() .scriptTask() .camundaAsyncBefore() .scriptFormat("groovy") .scriptText("if(execution.getIncidents().size() == 0) throw new RuntimeException()") .userTask() .endEvent().done()); ClockUtil.setCurrentTime(START_DATE); runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY); String jobId = managementService.createJobQuery().singleResult().getId(); managementService.setJobRetries(jobId, 0); try { managementService.executeJob(jobId); } catch (Exception ignored) { } String taskId = historyService.createHistoricTaskInstanceQuery().singleResult().getId(); // when taskService.complete(taskId); List<HistoricIncident> historicIncidents = historyService.createHistoricIncidentQuery().list(); // then assertThat(historicIncidents.get(0).getCreateTime(), is(START_DATE)); assertThat(historicIncidents.get(1).getCreateTime(), is(START_DATE)); }
.startEvent() .scriptTask() .camundaAsyncBefore() .scriptFormat("groovy") .scriptText("if(execution.getIncidents().size() == 0) throw new RuntimeException(\"I'm supposed to fail!\")")