Search in sources :

Example 11 with CustomField

use of pro.taskana.CustomField 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 12 with CustomField

use of pro.taskana.CustomField 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);
}
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) CategoryReport(pro.taskana.impl.report.impl.CategoryReport) Test(org.junit.Test)

Example 13 with CustomField

use of pro.taskana.CustomField in project taskana by Taskana.

the class TaskMonitorServiceImplTest method testGetTotalNumbersOfCustomFieldValueReport.

@Test
public void testGetTotalNumbersOfCustomFieldValueReport() 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("Geschaeftsstelle A");
    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);
    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.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) Test(org.junit.Test)

Example 14 with CustomField

use of pro.taskana.CustomField 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 15 with CustomField

use of pro.taskana.CustomField in project taskana by Taskana.

the class TaskMonitorServiceImplTest method testGetTaskIdsOfCategoryReportLineItems.

@Test
public void testGetTaskIdsOfCategoryReportLineItems() 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));
    SelectedItem selectedItem = new SelectedItem();
    selectedItem.setKey("EXTERN");
    selectedItem.setLowerAgeLimit(1);
    selectedItem.setUpperAgeLimit(5);
    List<SelectedItem> selectedItems = Collections.singletonList(selectedItem);
    List<String> expectedResult = Collections.singletonList("TKI:000000000000000000000000000000000001");
    doReturn(expectedResult).when(taskMonitorMapperMock).getTaskIdsOfCategoriesBySelectedItems(workbasketIds, states, categories, domains, customField, customFieldValues, selectedItems);
    List<String> actualResult = cut.getTaskIdsOfCategoryReportLineItems(workbasketIds, states, categories, domains, customField, customFieldValues, reportLineItemDefinitions, selectedItems);
    verify(taskanaEngineImplMock, times(1)).openConnection();
    verify(taskanaEngineImplMock, times(2)).getConfiguration();
    verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
    verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
    verify(taskMonitorMapperMock, times(1)).getTaskIdsOfCategoriesBySelectedItems(any(), any(), any(), any(), any(), any(), any());
    verify(taskanaEngineImplMock, times(1)).returnConnection();
    verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
    assertNotNull(actualResult);
    assertEquals(expectedResult, actualResult);
}
Also used : CustomField(pro.taskana.CustomField) TaskState(pro.taskana.TaskState) TimeIntervalColumnHeader(pro.taskana.impl.report.impl.TimeIntervalColumnHeader) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)26 CustomField (pro.taskana.CustomField)26 TimeIntervalColumnHeader (pro.taskana.impl.report.impl.TimeIntervalColumnHeader)19 TaskMonitorService (pro.taskana.TaskMonitorService)15 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)15 TaskState (pro.taskana.TaskState)12 CustomFieldValueReport (pro.taskana.impl.report.impl.CustomFieldValueReport)12 ArrayList (java.util.ArrayList)11 DetailedMonitorQueryItem (pro.taskana.impl.report.impl.DetailedMonitorQueryItem)11 MonitorQueryItem (pro.taskana.impl.report.impl.MonitorQueryItem)8 DetailedClassificationReport (pro.taskana.impl.report.impl.DetailedClassificationReport)5 CategoryReport (pro.taskana.impl.report.impl.CategoryReport)3 ClassificationReport (pro.taskana.impl.report.impl.ClassificationReport)3 DetailedReportRow (pro.taskana.impl.report.impl.DetailedReportRow)3 WorkbasketLevelReport (pro.taskana.impl.report.impl.WorkbasketLevelReport)3 SelectedItem (pro.taskana.impl.SelectedItem)1