Search in sources :

Example 6 with ClassificationReport

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

the class ProvideClassificationReportAccTest method testEachItemOfClassificationReportWithDomainFilter.

@Test
public void testEachItemOfClassificationReportWithDomainFilter() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    List<String> domains = Collections.singletonList("DOMAIN_A");
    List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
    ClassificationReport report = taskMonitorService.getClassificationReport(null, null, null, domains, null, null, columnHeaders);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(5, report.rowSize());
    int[] row1 = report.getRow("L10000").getCells();
    assertArrayEquals(new int[] { 5, 2, 1, 0, 0 }, row1);
    int[] row2 = report.getRow("L20000").getCells();
    assertArrayEquals(new int[] { 3, 1, 1, 1, 0 }, row2);
    int[] row3 = report.getRow("L30000").getCells();
    assertArrayEquals(new int[] { 1, 0, 0, 1, 1 }, row3);
    int[] row4 = report.getRow("L40000").getCells();
    assertArrayEquals(new int[] { 2, 0, 0, 0, 3 }, row4);
    int[] row5 = report.getRow("L50000").getCells();
    assertArrayEquals(new int[] { 0, 1, 0, 3, 0 }, row5);
}
Also used : TaskMonitorService(pro.taskana.TaskMonitorService) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) ClassificationReport(pro.taskana.impl.report.impl.ClassificationReport) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 7 with ClassificationReport

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

the class TaskMonitorServiceImplTest method testGetClassificationReportWithReportLineItemDefinitions.

@Test
public void testGetClassificationReportWithReportLineItemDefinitions() 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("CLI:000000000000000000000000000000000001");
    monitorQueryItem.setAgeInDays(0);
    monitorQueryItem.setNumberOfTasks(1);
    expectedResult.add(monitorQueryItem);
    doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfClassifications(workbasketIds, states, categories, domains, customField, customFieldValues);
    ClassificationReport actualResult = cut.getClassificationReport(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)).getTaskCountOfClassifications(any(), any(), any(), any(), any(), any());
    verify(taskanaEngineImplMock, times(1)).returnConnection();
    verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
    assertNotNull(actualResult);
    assertEquals(actualResult.getRow("CLI:000000000000000000000000000000000001").getTotalValue(), 1);
    assertEquals(actualResult.getRow("CLI:000000000000000000000000000000000001").getCells()[0], 1);
    assertEquals(actualResult.getSumRow().getTotalValue(), 1);
}
Also used : 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) ClassificationReport(pro.taskana.impl.report.impl.ClassificationReport) DetailedClassificationReport(pro.taskana.impl.report.impl.DetailedClassificationReport) Test(org.junit.Test)

Example 8 with ClassificationReport

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

the class TaskMonitorServiceImplTest method testGetTotalNumbersOfClassificationReport.

@Test
public void testGetTotalNumbersOfClassificationReport() 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("CLI:000000000000000000000000000000000001");
    monitorQueryItem.setNumberOfTasks(1);
    expectedResult.add(monitorQueryItem);
    doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfClassifications(workbasketIds, states, categories, domains, customField, customFieldValues);
    ClassificationReport actualResult = cut.getClassificationReport(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)).getTaskCountOfClassifications(any(), any(), any(), any(), any(), any());
    verify(taskanaEngineImplMock, times(1)).returnConnection();
    verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
    assertNotNull(actualResult);
    assertEquals(actualResult.getRow("CLI:000000000000000000000000000000000001").getTotalValue(), 1);
    assertEquals(actualResult.getSumRow().getTotalValue(), 1);
}
Also used : 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) ClassificationReport(pro.taskana.impl.report.impl.ClassificationReport) DetailedClassificationReport(pro.taskana.impl.report.impl.DetailedClassificationReport) Test(org.junit.Test)

Example 9 with ClassificationReport

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

the class TaskMonitorServiceImpl method getClassificationReport.

@Override
public ClassificationReport getClassificationReport(List<String> workbasketIds, List<TaskState> states, List<String> categories, List<String> domains, CustomField customField, List<String> customFieldValues, List<TimeIntervalColumnHeader> columnHeaders, boolean inWorkingDays) throws InvalidArgumentException {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("entry to getClassificationReport(workbasketIds = {}, states = {}, categories = {}, " + "domains = {}, customField = {}, customFieldValues = {}, columnHeaders = {}, " + "inWorkingDays = {})", LoggerUtils.listToString(workbasketIds), LoggerUtils.listToString(states), LoggerUtils.listToString(categories), LoggerUtils.listToString(domains), customField, LoggerUtils.listToString(customFieldValues), LoggerUtils.listToString(columnHeaders), inWorkingDays);
    }
    try {
        taskanaEngineImpl.openConnection();
        configureDaysToWorkingDaysConverter();
        ClassificationReport report = new ClassificationReport(columnHeaders);
        List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfClassifications(workbasketIds, states, categories, domains, customField, customFieldValues);
        report.addItems(monitorQueryItems, new DaysToWorkingDaysPreProcessor<>(columnHeaders, inWorkingDays));
        return report;
    } finally {
        taskanaEngineImpl.returnConnection();
        LOGGER.debug("exit from getClassificationReport().");
    }
}
Also used : MonitorQueryItem(pro.taskana.impl.report.impl.MonitorQueryItem) DetailedMonitorQueryItem(pro.taskana.impl.report.impl.DetailedMonitorQueryItem) ClassificationReport(pro.taskana.impl.report.impl.ClassificationReport) DetailedClassificationReport(pro.taskana.impl.report.impl.DetailedClassificationReport)

Example 10 with ClassificationReport

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

the class ProvideClassificationReportAccTest method testEachItemOfClassificationReportWithCustomFieldValueFilter.

@Test
public void testEachItemOfClassificationReportWithCustomFieldValueFilter() throws InvalidArgumentException {
    TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
    CustomField customField = CustomField.CUSTOM_1;
    List<String> customFieldValues = Collections.singletonList("Geschaeftsstelle A");
    List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
    ClassificationReport report = taskMonitorService.getClassificationReport(null, null, null, null, customField, customFieldValues, columnHeaders);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(reportToString(report, columnHeaders));
    }
    assertNotNull(report);
    assertEquals(5, report.rowSize());
    int[] row1 = report.getRow("L10000").getCells();
    assertArrayEquals(new int[] { 4, 0, 0, 0, 0 }, row1);
    int[] row2 = report.getRow("L20000").getCells();
    assertArrayEquals(new int[] { 4, 1, 1, 1, 0 }, row2);
    int[] row3 = report.getRow("L30000").getCells();
    assertArrayEquals(new int[] { 1, 0, 0, 1, 1 }, row3);
    int[] row4 = report.getRow("L40000").getCells();
    assertArrayEquals(new int[] { 1, 1, 2, 0, 2 }, row4);
    int[] row5 = report.getRow("L50000").getCells();
    assertArrayEquals(new int[] { 1, 2, 0, 2, 0 }, row5);
}
Also used : TaskMonitorService(pro.taskana.TaskMonitorService) CustomField(pro.taskana.CustomField) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) ClassificationReport(pro.taskana.impl.report.impl.ClassificationReport) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Aggregations

ClassificationReport (pro.taskana.impl.report.impl.ClassificationReport)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 DetailedClassificationReport (pro.taskana.impl.report.impl.DetailedClassificationReport)3 DetailedMonitorQueryItem (pro.taskana.impl.report.impl.DetailedMonitorQueryItem)3 MonitorQueryItem (pro.taskana.impl.report.impl.MonitorQueryItem)3 ArrayList (java.util.ArrayList)2