use of org.camunda.bpm.engine.history.HistoricTaskInstanceReportResult in project camunda-bpm-platform by camunda.
the class MockProvider method createMockHistoricTaskInstanceReportWithProcDef.
public static List<HistoricTaskInstanceReportResult> createMockHistoricTaskInstanceReportWithProcDef() {
HistoricTaskInstanceReportResult mock = mock(HistoricTaskInstanceReportResult.class);
when(mock.getCount()).thenReturn(EXAMPLE_HISTORIC_TASK_REPORT_COUNT);
when(mock.getProcessDefinitionId()).thenReturn(EXAMPLE_HISTORIC_TASK_REPORT_PROC_DEF_ID);
when(mock.getProcessDefinitionKey()).thenReturn(EXAMPLE_HISTORIC_TASK_REPORT_PROC_DEFINITION);
when(mock.getProcessDefinitionName()).thenReturn(EXAMPLE_HISTORIC_TASK_REPORT_PROC_DEF_NAME);
when(mock.getTenantId()).thenReturn(EXAMPLE_TENANT_ID);
when(mock.getTaskName()).thenReturn(null);
return Collections.singletonList(mock);
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceReportResult in project camunda-bpm-platform by camunda.
the class HistoricTaskReportRestServiceTest method setUpMockReportQuery.
private HistoricTaskInstanceReport setUpMockReportQuery() {
HistoricTaskInstanceReport mockedReportQuery = mock(HistoricTaskInstanceReport.class);
List<HistoricTaskInstanceReportResult> taskReportResults = createMockHistoricTaskInstanceReport();
List<HistoricTaskInstanceReportResult> taskReportResultsWithProcDef = createMockHistoricTaskInstanceReportWithProcDef();
when(mockedReportQuery.completedAfter(any(Date.class))).thenReturn(mockedReportQuery);
when(mockedReportQuery.completedBefore(any(Date.class))).thenReturn(mockedReportQuery);
when(mockedReportQuery.countByTaskName()).thenReturn(taskReportResults);
when(mockedReportQuery.countByProcessDefinitionKey()).thenReturn(taskReportResultsWithProcDef);
List<DurationReportResult> durationReportByMonth = createMockHistoricTaskInstanceDurationReport(MONTH);
when(mockedReportQuery.duration(MONTH)).thenReturn(durationReportByMonth);
List<DurationReportResult> durationReportByQuarter = createMockHistoricTaskInstanceDurationReport(QUARTER);
when(mockedReportQuery.duration(QUARTER)).thenReturn(durationReportByQuarter);
when(processEngine.getHistoryService().createHistoricTaskInstanceReport()).thenReturn(mockedReportQuery);
return mockedReportQuery;
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceReportResult in project camunda-bpm-platform by camunda.
the class HistoricTaskReportTest method testReportWithNullTaskName.
@Test
public void testReportWithNullTaskName() {
// given
startAndCompleteProcessInstance(PROCESS_DEFINITION_KEY, 2016, 7, 14, 12, 1);
// when
BpmnModelInstance instance = Bpmn.createExecutableProcess(ANOTHER_PROCESS_DEFINITION_KEY).name("name_" + ANOTHER_PROCESS_DEFINITION_KEY).startEvent().userTask("task1_" + ANOTHER_PROCESS_DEFINITION_KEY).name(null).endEvent().done();
processEngineTestRule.deploy(instance);
startAndCompleteProcessInstance(ANOTHER_PROCESS_DEFINITION_KEY, 2016, 7, 14, 12, 1);
Calendar calendar = Calendar.getInstance();
calendar.set(2016, 11, 14, 12, 5);
List<HistoricTaskInstanceReportResult> historicTaskInstanceReportResults = historyService.createHistoricTaskInstanceReport().completedBefore(calendar.getTime()).countByTaskName();
assertEquals(1, historicTaskInstanceReportResults.size());
assertEquals(1, historicTaskInstanceReportResults.get(0).getCount(), 0);
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceReportResult in project camunda-bpm-platform by camunda.
the class HistoricTaskReportTest method testHistoricTaskInstanceReportWithCompletedBeforeDate.
@Test
public void testHistoricTaskInstanceReportWithCompletedBeforeDate() {
// given
startAndCompleteProcessInstance(PROCESS_DEFINITION_KEY, 2016, 7, 14, 12, 1);
startAndCompleteProcessInstance(PROCESS_DEFINITION_KEY, 2016, 8, 14, 12, 1);
startAndCompleteProcessInstance(ANOTHER_PROCESS_DEFINITION_KEY, 2016, 7, 14, 12, 1);
// when
Calendar calendar = Calendar.getInstance();
calendar.set(2016, 11, 14, 12, 5);
List<HistoricTaskInstanceReportResult> historicTaskInstanceReportResults = historyService.createHistoricTaskInstanceReport().completedBefore(calendar.getTime()).countByProcessDefinitionKey();
// then
assertEquals(2, historicTaskInstanceReportResults.size());
assertEquals(1, historicTaskInstanceReportResults.get(0).getCount(), 0);
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceReportResult in project camunda-bpm-platform by camunda.
the class MockProvider method createMockHistoricTaskInstanceReport.
public static List<HistoricTaskInstanceReportResult> createMockHistoricTaskInstanceReport() {
HistoricTaskInstanceReportResult mock = mock(HistoricTaskInstanceReportResult.class);
when(mock.getCount()).thenReturn(EXAMPLE_HISTORIC_TASK_REPORT_COUNT);
when(mock.getProcessDefinitionId()).thenReturn(EXAMPLE_HISTORIC_TASK_REPORT_PROC_DEF_ID);
when(mock.getProcessDefinitionKey()).thenReturn(EXAMPLE_HISTORIC_TASK_REPORT_PROC_DEFINITION);
when(mock.getProcessDefinitionName()).thenReturn(EXAMPLE_HISTORIC_TASK_REPORT_PROC_DEF_NAME);
when(mock.getTenantId()).thenReturn(EXAMPLE_TENANT_ID);
when(mock.getTaskName()).thenReturn(EXAMPLE_HISTORIC_TASK_REPORT_TASK_NAME);
return Collections.singletonList(mock);
}
Aggregations