Search in sources :

Example 1 with WorkbasketLevelReport

use of pro.taskana.impl.report.impl.WorkbasketLevelReport in project taskana by Taskana.

the class ProvideWorkbasketLevelReportAccTest method testEachItemOfWorkbasketLevelReportWithWorkbasketFilter.

@Test
public void testEachItemOfWorkbasketLevelReportWithWorkbasketFilter() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
    List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
    WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(workbasketIds, null, null, null, null, null, columnHeaders);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(1, report.rowSize());
    int[] row1 = report.getRow("USER_1_1").getCells();
    assertArrayEquals(new int[] { 13, 3, 1, 1, 2 }, row1);
}
Also used : WorkbasketLevelReport(pro.taskana.impl.report.impl.WorkbasketLevelReport) TaskMonitorService(pro.taskana.TaskMonitorService) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 2 with WorkbasketLevelReport

use of pro.taskana.impl.report.impl.WorkbasketLevelReport in project taskana by Taskana.

the class ProvideWorkbasketLevelReportAccTest method testEachItemOfWorkbasketLevelReport.

@Test
public void testEachItemOfWorkbasketLevelReport() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
    WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null, columnHeaders);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(3, report.rowSize());
    int[] row1 = report.getRow("USER_1_1").getCells();
    assertArrayEquals(new int[] { 13, 3, 1, 1, 2 }, row1);
    int[] row2 = report.getRow("USER_1_2").getCells();
    assertArrayEquals(new int[] { 4, 6, 3, 6, 1 }, row2);
    int[] row3 = report.getRow("USER_1_3").getCells();
    assertArrayEquals(new int[] { 2, 2, 0, 0, 6 }, row3);
}
Also used : WorkbasketLevelReport(pro.taskana.impl.report.impl.WorkbasketLevelReport) TaskMonitorService(pro.taskana.TaskMonitorService) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 3 with WorkbasketLevelReport

use of pro.taskana.impl.report.impl.WorkbasketLevelReport in project taskana by Taskana.

the class ProvideWorkbasketLevelReportAccTest method testGetTotalNumbersOfTasksOfWorkbasketLevelReport.

@Test
public void testGetTotalNumbersOfTasksOfWorkbasketLevelReport() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    WorkbasketLevelReport report = taskMonitorService.getWorkbasketLevelReport(null, null, null, null, null, null);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report));
    }
    assertNotNull(report);
    assertEquals(3, report.rowSize());
    assertEquals(20, report.getRow("USER_1_1").getTotalValue());
    assertEquals(20, report.getRow("USER_1_2").getTotalValue());
    assertEquals(10, report.getRow("USER_1_3").getTotalValue());
    assertEquals(50, report.getSumRow().getTotalValue());
}
Also used : WorkbasketLevelReport(pro.taskana.impl.report.impl.WorkbasketLevelReport) TaskMonitorService(pro.taskana.TaskMonitorService) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 4 with WorkbasketLevelReport

use of pro.taskana.impl.report.impl.WorkbasketLevelReport in project taskana by Taskana.

the class TaskMonitorServiceImplTest method testGetTotalNumbersOfWorkbasketLevelReport.

@Test
public void testGetTotalNumbersOfWorkbasketLevelReport() throws InvalidArgumentException {
    List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
    List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
    List<String> categories = Collections.singletonList("EXTERN");
    List<String> domains = Collections.singletonList("DOMAIN_A");
    CustomField customField = CustomField.CUSTOM_1;
    List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
    List<MonitorQueryItem> expectedResult = new ArrayList<>();
    MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
    monitorQueryItem.setKey("WBI:000000000000000000000000000000000001");
    monitorQueryItem.setNumberOfTasks(1);
    expectedResult.add(monitorQueryItem);
    doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfWorkbaskets(workbasketIds, states, categories, domains, customField, customFieldValues);
    WorkbasketLevelReport actualResult = cut.getWorkbasketLevelReport(workbasketIds, states, categories, domains, customField, customFieldValues);
    verify(taskanaEngineImplMock, times(1)).openConnection();
    verify(taskanaEngineImplMock, times(2)).getConfiguration();
    verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
    verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
    verify(taskMonitorMapperMock, times(1)).getTaskCountOfWorkbaskets(any(), any(), any(), any(), any(), any());
    verify(taskanaEngineImplMock, times(1)).returnConnection();
    verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
    assertNotNull(actualResult);
    assertEquals(actualResult.getRow("WBI:000000000000000000000000000000000001").getTotalValue(), 1);
    assertEquals(actualResult.getSumRow().getTotalValue(), 1);
}
Also used : WorkbasketLevelReport(pro.taskana.impl.report.impl.WorkbasketLevelReport) DetailedMonitorQueryItem(pro.taskana.impl.report.impl.DetailedMonitorQueryItem) MonitorQueryItem(pro.taskana.impl.report.impl.MonitorQueryItem) CustomField(pro.taskana.CustomField) ArrayList(java.util.ArrayList) TaskState(pro.taskana.TaskState) Test(org.junit.Test)

Example 5 with WorkbasketLevelReport

use of pro.taskana.impl.report.impl.WorkbasketLevelReport in project taskana by Taskana.

the class TaskMonitorServiceImplTest method testGetWorkbasketLevelReportWithReportLineItemDefinitions.

@Test
public void testGetWorkbasketLevelReportWithReportLineItemDefinitions() throws InvalidArgumentException {
    List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
    List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
    List<String> categories = Collections.singletonList("EXTERN");
    List<String> domains = Collections.singletonList("DOMAIN_A");
    CustomField customField = CustomField.CUSTOM_1;
    List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
    List<TimeIntervalColumnHeader> reportLineItemDefinitions = Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
    List<MonitorQueryItem> expectedResult = new ArrayList<>();
    MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
    monitorQueryItem.setKey("WBI:000000000000000000000000000000000001");
    monitorQueryItem.setAgeInDays(0);
    monitorQueryItem.setNumberOfTasks(1);
    expectedResult.add(monitorQueryItem);
    doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfWorkbaskets(workbasketIds, states, categories, domains, customField, customFieldValues);
    WorkbasketLevelReport actualResult = cut.getWorkbasketLevelReport(workbasketIds, states, categories, domains, customField, customFieldValues, reportLineItemDefinitions);
    verify(taskanaEngineImplMock, times(1)).openConnection();
    verify(taskanaEngineImplMock, times(2)).getConfiguration();
    verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
    verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
    verify(taskMonitorMapperMock, times(1)).getTaskCountOfWorkbaskets(any(), any(), any(), any(), any(), any());
    verify(taskanaEngineImplMock, times(1)).returnConnection();
    verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
    assertNotNull(actualResult);
    assertEquals(actualResult.getRow("WBI:000000000000000000000000000000000001").getTotalValue(), 1);
    assertEquals(actualResult.getRow("WBI:000000000000000000000000000000000001").getCells()[0], 1);
    assertEquals(actualResult.getSumRow().getTotalValue(), 1);
}
Also used : WorkbasketLevelReport(pro.taskana.impl.report.impl.WorkbasketLevelReport) DetailedMonitorQueryItem(pro.taskana.impl.report.impl.DetailedMonitorQueryItem) MonitorQueryItem(pro.taskana.impl.report.impl.MonitorQueryItem) CustomField(pro.taskana.CustomField) ArrayList(java.util.ArrayList) TaskState(pro.taskana.TaskState) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) Test(org.junit.Test)

Aggregations

WorkbasketLevelReport (pro.taskana.impl.report.impl.WorkbasketLevelReport)12 Test (org.junit.Test)11 TaskMonitorService (pro.taskana.TaskMonitorService)9 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)9 TimeIntervalColumnHeader (pro.taskana.impl.report.impl.TimeIntervalColumnHeader)9 CustomField (pro.taskana.CustomField)3 TaskState (pro.taskana.TaskState)3 DetailedMonitorQueryItem (pro.taskana.impl.report.impl.DetailedMonitorQueryItem)3 MonitorQueryItem (pro.taskana.impl.report.impl.MonitorQueryItem)3 ArrayList (java.util.ArrayList)2