Search in sources :

Example 1 with MonitorQueryItem

use of pro.taskana.impl.report.impl.MonitorQueryItem 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 2 with MonitorQueryItem

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

the class TaskMonitorServiceImplTest method testGetTotalNumbersOfCatgoryReport.

@Test
public void testGetTotalNumbersOfCatgoryReport() 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("EXTERN");
    monitorQueryItem.setNumberOfTasks(1);
    expectedResult.add(monitorQueryItem);
    doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfCategories(workbasketIds, states, categories, domains, customField, customFieldValues);
    CategoryReport actualResult = cut.getCategoryReport(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)).getTaskCountOfCategories(any(), any(), any(), any(), any(), any());
    verify(taskanaEngineImplMock, times(1)).returnConnection();
    verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
    assertNotNull(actualResult);
    assertEquals(actualResult.getRow("EXTERN").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) CategoryReport(pro.taskana.impl.report.impl.CategoryReport) Test(org.junit.Test)

Example 3 with MonitorQueryItem

use of pro.taskana.impl.report.impl.MonitorQueryItem 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)

Example 4 with MonitorQueryItem

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

the class TaskMonitorServiceImplTest method testGetCustomFieldValueReportWithReportLineItemDefinitions.

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

Example 5 with MonitorQueryItem

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

the class TaskMonitorServiceImpl method getWorkbasketLevelReport.

@Override
public WorkbasketLevelReport getWorkbasketLevelReport(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 getWorkbasketLevelReport(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();
        WorkbasketLevelReport report = new WorkbasketLevelReport(columnHeaders);
        List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfWorkbaskets(workbasketIds, states, categories, domains, customField, customFieldValues);
        report.addItems(monitorQueryItems, new DaysToWorkingDaysPreProcessor<>(columnHeaders, inWorkingDays));
        return report;
    } finally {
        taskanaEngineImpl.returnConnection();
        LOGGER.debug("exit from getWorkbasketLevelReport().");
    }
}
Also used : WorkbasketLevelReport(pro.taskana.impl.report.impl.WorkbasketLevelReport) MonitorQueryItem(pro.taskana.impl.report.impl.MonitorQueryItem) DetailedMonitorQueryItem(pro.taskana.impl.report.impl.DetailedMonitorQueryItem)

Aggregations

DetailedMonitorQueryItem (pro.taskana.impl.report.impl.DetailedMonitorQueryItem)12 MonitorQueryItem (pro.taskana.impl.report.impl.MonitorQueryItem)12 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)8 CustomField (pro.taskana.CustomField)8 TaskState (pro.taskana.TaskState)8 TimeIntervalColumnHeader (pro.taskana.impl.report.impl.TimeIntervalColumnHeader)4 CategoryReport (pro.taskana.impl.report.impl.CategoryReport)3 ClassificationReport (pro.taskana.impl.report.impl.ClassificationReport)3 CustomFieldValueReport (pro.taskana.impl.report.impl.CustomFieldValueReport)3 DetailedClassificationReport (pro.taskana.impl.report.impl.DetailedClassificationReport)3 WorkbasketLevelReport (pro.taskana.impl.report.impl.WorkbasketLevelReport)3 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)1