private void verifyExecutedJobParameterQueryInvocations() { Map<String, Date> startDateParameters = getCompleteExecutedJobDateQueryParameters(); verify(mockedQuery).executedJobBefore(startDateParameters.get(QUERY_PARAM_EXECUTED_JOB_BEFORE)); verify(mockedQuery).executedJobAfter(startDateParameters.get(QUERY_PARAM_EXECUTED_JOB_AFTER)); verify(mockedQuery).list(); }
private void verifyStringExecutedJobParameterQueryInvocations() { Map<String, String> startDateParameters = getCompleteExecutedJobDateAsStringQueryParameters(); verify(mockedQuery).executedJobBefore(DateTimeUtil.parseDate(startDateParameters.get(QUERY_PARAM_EXECUTED_JOB_BEFORE))); verify(mockedQuery).executedJobAfter(DateTimeUtil.parseDate(startDateParameters.get(QUERY_PARAM_EXECUTED_JOB_AFTER))); verify(mockedQuery).list(); }
query.executedJobAfter(executedJobAfter);
query.executedJobAfter(executedJobAfter);
.executedJobAfter(hourBeforeNow.getTime()) .executedJobBefore(now.getTime()).list(); halfHour.add(Calendar.MINUTE, -30); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .executedJobAfter(halfHour.getTime()).singleResult();
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testHistoricProcInstExecutedJobAfter() { // given BpmnModelInstance asyncModel = Bpmn.createExecutableProcess("async").startEvent().camundaAsyncBefore().endEvent().done(); deployment(asyncModel); BpmnModelInstance model = Bpmn.createExecutableProcess("proc").startEvent().endEvent().done(); deployment(model); Calendar now = Calendar.getInstance(); ClockUtil.setCurrentTime(now.getTime()); Calendar hourFromNow = (Calendar) now.clone(); hourFromNow.add(Calendar.HOUR_OF_DAY, 1); runtimeService.startProcessInstanceByKey("async"); Job job = managementService.createJobQuery().singleResult(); managementService.executeJob(job.getId()); runtimeService.startProcessInstanceByKey("proc"); //when query historic process instance which has executed an job after the start time HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .executedJobAfter(now.getTime()).singleResult(); //then query returns only a single process instance assertNotNull(historicProcessInstance); //when query historic proc inst with execute job after a hour of the starting time historicProcessInstance = historyService.createHistoricProcessInstanceQuery().executedJobAfter(hourFromNow.getTime()).singleResult(); //then query returns no result assertNull(historicProcessInstance); }
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testHistoricProcInstExecutedJobWithEmptyInterval() { // given BpmnModelInstance asyncModel = Bpmn.createExecutableProcess("async").startEvent().camundaAsyncBefore().endEvent().done(); deployment(asyncModel); BpmnModelInstance model = Bpmn.createExecutableProcess("proc").startEvent().endEvent().done(); deployment(model); Calendar now = Calendar.getInstance(); ClockUtil.setCurrentTime(now.getTime()); Calendar hourBeforeNow = (Calendar) now.clone(); hourBeforeNow.add(Calendar.HOUR_OF_DAY, -1); runtimeService.startProcessInstanceByKey("async"); Job job = managementService.createJobQuery().singleResult(); managementService.executeJob(job.getId()); runtimeService.startProcessInstanceByKey("proc"); //when query historic proc inst with executed job before and after an hour before the starting time HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .executedJobBefore(hourBeforeNow.getTime()) .executedJobAfter(hourBeforeNow.getTime()).singleResult(); //then query returns no result assertNull(historicProcessInstance); }
assertEquals(1, historyService.createHistoricProcessInstanceQuery().executedJobAfter(hourAgo.getTime()).count()); assertEquals(0, historyService.createHistoricProcessInstanceQuery().executedActivityBefore(hourAgo.getTime()).count()); assertEquals(1, historyService.createHistoricProcessInstanceQuery().executedActivityBefore(hourFromNow.getTime()).count());
query.executedJobAfter(executedJobAfter);
.executedJobAfter(hourBeforeNow.getTime()) .executedJobBefore(now.getTime()).list(); halfHour.add(Calendar.MINUTE, -30); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .executedJobAfter(halfHour.getTime()).singleResult();
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testHistoricProcInstExecutedJobAfter() { // given BpmnModelInstance asyncModel = Bpmn.createExecutableProcess("async").startEvent().camundaAsyncBefore().endEvent().done(); deployment(asyncModel); BpmnModelInstance model = Bpmn.createExecutableProcess("proc").startEvent().endEvent().done(); deployment(model); Calendar now = Calendar.getInstance(); ClockUtil.setCurrentTime(now.getTime()); Calendar hourFromNow = (Calendar) now.clone(); hourFromNow.add(Calendar.HOUR_OF_DAY, 1); runtimeService.startProcessInstanceByKey("async"); Job job = managementService.createJobQuery().singleResult(); managementService.executeJob(job.getId()); runtimeService.startProcessInstanceByKey("proc"); //when query historic process instance which has executed an job after the start time HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .executedJobAfter(now.getTime()).singleResult(); //then query returns only a single process instance assertNotNull(historicProcessInstance); //when query historic proc inst with execute job after a hour of the starting time historicProcessInstance = historyService.createHistoricProcessInstanceQuery().executedJobAfter(hourFromNow.getTime()).singleResult(); //then query returns no result assertNull(historicProcessInstance); }
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testHistoricProcInstExecutedJobWithEmptyInterval() { // given BpmnModelInstance asyncModel = Bpmn.createExecutableProcess("async").startEvent().camundaAsyncBefore().endEvent().done(); deployment(asyncModel); BpmnModelInstance model = Bpmn.createExecutableProcess("proc").startEvent().endEvent().done(); deployment(model); Calendar now = Calendar.getInstance(); ClockUtil.setCurrentTime(now.getTime()); Calendar hourBeforeNow = (Calendar) now.clone(); hourBeforeNow.add(Calendar.HOUR_OF_DAY, -1); runtimeService.startProcessInstanceByKey("async"); Job job = managementService.createJobQuery().singleResult(); managementService.executeJob(job.getId()); runtimeService.startProcessInstanceByKey("proc"); //when query historic proc inst with executed job before and after an hour before the starting time HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .executedJobBefore(hourBeforeNow.getTime()) .executedJobAfter(hourBeforeNow.getTime()).singleResult(); //then query returns no result assertNull(historicProcessInstance); }
assertEquals(1, historyService.createHistoricProcessInstanceQuery().executedJobAfter(hourAgo.getTime()).count()); assertEquals(0, historyService.createHistoricProcessInstanceQuery().executedActivityBefore(hourAgo.getTime()).count()); assertEquals(1, historyService.createHistoricProcessInstanceQuery().executedActivityBefore(hourFromNow.getTime()).count());