use of pro.taskana.impl.report.impl.CategoryReport 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);
}
use of pro.taskana.impl.report.impl.CategoryReport in project taskana by Taskana.
the class TaskMonitorServiceImplTest method testGetCategoryReportWithReportLineItemDefinitions.
@Test
public void testGetCategoryReportWithReportLineItemDefinitions() 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("EXTERN");
monitorQueryItem.setAgeInDays(0);
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, 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)).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.getRow("EXTERN").getCells()[0], 1);
assertEquals(actualResult.getSumRow().getTotalValue(), 1);
}
use of pro.taskana.impl.report.impl.CategoryReport in project taskana by Taskana.
the class TaskMonitorServiceImpl method getCategoryReport.
@Override
public CategoryReport getCategoryReport(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 getCategoryReport(workbasketIds = {}, states = {}, categories = {}, " + "domains = {}, customField = {}, customFieldValues = {}, reportLineItemDefinitions = {}, " + "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();
CategoryReport report = new CategoryReport(columnHeaders);
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper.getTaskCountOfCategories(workbasketIds, states, categories, domains, customField, customFieldValues);
report.addItems(monitorQueryItems, new DaysToWorkingDaysPreProcessor<>(columnHeaders, inWorkingDays));
return report;
} finally {
taskanaEngineImpl.returnConnection();
LOGGER.debug("exit from getCategoryReport().");
}
}
use of pro.taskana.impl.report.impl.CategoryReport in project taskana by Taskana.
the class ProvideCategoryReportAccTest method testEachItemOfCategoryReportNotInWorkingDays.
@Test
public void testEachItemOfCategoryReportNotInWorkingDays() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
CategoryReport report = taskMonitorService.getCategoryReport(null, null, null, null, null, null, columnHeaders, false);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, columnHeaders));
}
assertNotNull(report);
assertEquals(3, report.rowSize());
int[] row1 = report.getRow("EXTERN").getCells();
assertArrayEquals(new int[] { 23, 0, 2, 0, 8 }, row1);
int[] row2 = report.getRow("AUTOMATIC").getCells();
assertArrayEquals(new int[] { 3, 0, 0, 0, 4 }, row2);
int[] row3 = report.getRow("MANUAL").getCells();
assertArrayEquals(new int[] { 4, 0, 2, 0, 4 }, row3);
}
use of pro.taskana.impl.report.impl.CategoryReport in project taskana by Taskana.
the class ProvideCategoryReportAccTest method testEachItemOfCategoryReportWithCategoryFilter.
@Test
public void testEachItemOfCategoryReportWithCategoryFilter() throws InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
CategoryReport report = taskMonitorService.getCategoryReport(null, null, categories, null, null, null, columnHeaders);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(reportToString(report, columnHeaders));
}
assertNotNull(report);
assertEquals(2, report.rowSize());
int[] row1 = report.getRow("AUTOMATIC").getCells();
assertArrayEquals(new int[] { 2, 1, 0, 1, 3 }, row1);
int[] row2 = report.getRow("MANUAL").getCells();
assertArrayEquals(new int[] { 2, 2, 2, 0, 4 }, row2);
}
Aggregations