TSK-260: Create classification report

- Reuse existing monitoring methods to create a report for
classifications
- Create methods in service and mapper and add tests
- Modify monitoring sample data by adding domains
This commit is contained in:
Konstantin Kläger 2018-02-07 13:57:26 +01:00 committed by Holger Hagen
parent 4fcb15aca8
commit b361d59a5e
7 changed files with 427 additions and 24 deletions

View File

@ -132,4 +132,66 @@ public interface TaskMonitorService {
*/
Report getCategoryReport(List<Workbasket> workbaskets, List<TaskState> states,
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays);
/**
* Returns a {@link Report} grouped by classifications for a given list of {@link Workbasket}s and for a given list
* of {@link TaskState}s. The report only contains the number of all tasks of the respective classification as well
* as the total sum of all tasks. Only tasks with a state in the list of TaskStates are provided. Task with
* Timestamp DUE = null are not considered.
*
* @param workbaskets
* a list of {@link Workbasket} objects that whose task should be counted in the report
* @param states
* a list of {@link TaskState} objects that specify the states of the tasks that are provided
* @return a {@link Report} object that only contains the number of all tasks of the respective classification as
* well as the total number of all tasks
*/
Report getClassificationReport(List<Workbasket> workbaskets, List<TaskState> states);
/**
* Returns a {@link Report} grouped by classifications for a given list of {@link Workbasket}s, a given list of
* {@link TaskState}s and a given list of {@link ReportLineItemDefinition}s. For each classification the report
* contains a list of ReportLineItems that subdivides the report in to different cluster grouped by the due date. By
* default the age of the tasks is counted in working days. Only tasks with a state in the list of TaskStates are
* provided. Tasks with Timestamp DUE = null are not considered.
*
* @param workbaskets
* a list of {@link Workbasket} objects that should be listed in the report
* @param states
* a list of {@link TaskState} objects that specify the states of the tasks that are provided
* @param reportLineItemDefinitions
* a list of {@link ReportLineItemDefinition} objects that specify the subdivision into different cluster
* of due dates. Days in past are represented as negative values and days in the future are represented
* as positive values. To avoid tasks are counted multiple times or not be listed in the report, these
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
* should represent a single day, lowerLimit and upperLimit have to be equal.
* @return a {@link Report} object that represents an overview of all tasks of the respective classification
*/
Report getClassificationReport(List<Workbasket> workbaskets, List<TaskState> states,
List<ReportLineItemDefinition> reportLineItemDefinitions);
/**
* Returns a {@link Report} grouped by classifications for a given list of {@link Workbasket}s, a given list of
* {@link TaskState}s and a given list of {@link ReportLineItemDefinition}s. For each classification the report
* contains a list of ReportLineItems that subdivides the report in to different cluster grouped by the due date.
* Only tasks with a state in the list of TaskStates are provided. Tasks with Timestamp DUE = null are not
* considered.
*
* @param workbaskets
* a list of {@link Workbasket} objects that should be listed in the report
* @param states
* a list of {@link TaskState} objects that specify the states of the tasks that are provided
* @param reportLineItemDefinitions
* a list of {@link ReportLineItemDefinition} objects that specify the subdivision into different cluster
* of due dates. Days in past are represented as negative values and days in the future are represented
* as positive values. To avoid tasks are counted multiple times or not be listed in the report, these
* reportLineItemDefinitions should not overlap and should not have gaps. If the ReportLineDefinition
* should represent a single day, lowerLimit and upperLimit have to be equal.
* @param inWorkingDays
* a boolean parameter that specifies whether the age of the tasks should be counted in days or in
* working days.
* @return a {@link Report} object that represents an overview of all tasks of the respective classification
*/
Report getClassificationReport(List<Workbasket> workbaskets, List<TaskState> states,
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays);
}

View File

@ -101,6 +101,40 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
}
}
@Override
public Report getClassificationReport(List<Workbasket> workbaskets, List<TaskState> states) {
return getClassificationReport(workbaskets, states, null, false);
}
@Override
public Report getClassificationReport(List<Workbasket> workbaskets, List<TaskState> states,
List<ReportLineItemDefinition> reportLineItemDefinitions) {
return getClassificationReport(workbaskets, states, reportLineItemDefinitions, true);
}
@Override
public Report getClassificationReport(List<Workbasket> workbaskets, List<TaskState> states,
List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"entry to getClassificationReport(workbaskets = {}, states = {}, reportLineItemDefinitions = {})",
LoggerUtils.listToString(workbaskets), LoggerUtils.listToString(states),
LoggerUtils.listToString(reportLineItemDefinitions));
}
try {
taskanaEngineImpl.openConnection();
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper
.getTaskCountOfClassificationsByWorkbasketsAndStates(workbaskets, states);
return createReport(reportLineItemDefinitions, inWorkingDays, monitorQueryItems);
} finally {
taskanaEngineImpl.returnConnection();
LOGGER.debug("exit from getClassificationReport().");
}
}
private Report createReport(List<ReportLineItemDefinition> reportLineItemDefinitions, boolean inWorkingDays,
List<MonitorQueryItem> monitorQueryItems) {
Report report = new Report();

View File

@ -52,4 +52,22 @@ public interface TaskMonitorMapper {
@Param("workbaskets") List<Workbasket> workbaskets,
@Param("states") List<TaskState> states);
@Select("<script>"
+ "<if test=\"_databaseId == 'db2'\">SELECT CLASSIFICATION_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP)) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> "
+ "<if test=\"_databaseId == 'h2'\">SELECT CLASSIFICATION_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE) as AGE_IN_DAYS, COUNT(*) as NUMBER_OF_TASKS</if> "
+ "FROM TASK "
+ "WHERE WORKBASKET_KEY IN (<foreach collection='workbaskets' item='workbasket' separator=','>#{workbasket.key}</foreach>) "
+ "AND STATE IN (<foreach collection='states' item='state' separator=','>#{state}</foreach>) "
+ "AND DUE IS NOT NULL "
+ "<if test=\"_databaseId == 'db2'\">GROUP BY CLASSIFICATION_KEY, (DAYS(DUE) - DAYS(CURRENT_TIMESTAMP))</if> "
+ "<if test=\"_databaseId == 'h2'\">GROUP BY CLASSIFICATION_KEY, DATEDIFF('DAY', CURRENT_TIMESTAMP, DUE)</if> "
+ "</script>")
@Results({
@Result(column = "CLASSIFICATION_KEY", property = "key"),
@Result(column = "AGE_IN_DAYS", property = "ageInDays"),
@Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks") })
List<MonitorQueryItem> getTaskCountOfClassificationsByWorkbasketsAndStates(
@Param("workbaskets") List<Workbasket> workbaskets,
@Param("states") List<TaskState> states);
}

View File

@ -130,25 +130,6 @@ public class ProvideCategoryReportAccTest {
}
@WithAccessId(userName = "monitor_user_1")
@Test
public void testGetCategoryReportIfWorkbasketContainsNoTask()
throws WorkbasketNotFoundException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<Workbasket> workbaskets = new ArrayList<>();
WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService
.getWorkbasket("WBI:000000000000000000000000000000000004");
workbaskets.add(workbasket);
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
Report report = taskMonitorService.getCategoryReport(workbaskets, states);
assertNotNull(report);
assertEquals(0, report.getDetailLines().size());
assertEquals(0, report.getSumLine().getTotalNumberOfTasks());
}
private List<Workbasket> getListOfWorkbaskets() throws WorkbasketNotFoundException, NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();

View File

@ -0,0 +1,246 @@
package acceptance.monitoring;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.sql.DataSource;
import org.h2.store.fs.FileUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import pro.taskana.Classification;
import pro.taskana.ClassificationService;
import pro.taskana.TaskMonitorService;
import pro.taskana.TaskanaEngine;
import pro.taskana.TaskanaEngine.ConnectionManagementMode;
import pro.taskana.Workbasket;
import pro.taskana.WorkbasketService;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.database.TestDataGenerator;
import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.impl.ClassificationImpl;
import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.impl.WorkbasketImpl;
import pro.taskana.impl.configuration.DBCleaner;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest;
import pro.taskana.model.Report;
import pro.taskana.model.ReportLineItem;
import pro.taskana.model.ReportLineItemDefinition;
import pro.taskana.model.TaskState;
import pro.taskana.security.JAASRunner;
import pro.taskana.security.WithAccessId;
/**
* Acceptance test for all "classification report" scenarios.
*/
@RunWith(JAASRunner.class)
public class ProvideClassificationReportAccTest {
protected static TaskanaEngineConfiguration taskanaEngineConfiguration;
protected static TaskanaEngine taskanaEngine;
@BeforeClass
public static void setupTest() throws Exception {
resetDb();
}
public static void resetDb() throws SQLException, IOException {
DataSource dataSource = TaskanaEngineConfigurationTest.getDataSource();
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(dataSource, true);
dataSource = TaskanaEngineConfigurationTest.getDataSource();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
cleaner.clearDb(dataSource, false);
TestDataGenerator testDataGenerator = new TestDataGenerator();
testDataGenerator.generateMonitoringTestData(dataSource);
}
@WithAccessId(userName = "monitor_user_1")
@Test
public void testGetTotalNumbersOfTasksOfClassificationReport()
throws WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<Workbasket> workbaskets = getListOfWorkbaskets();
List<Classification> classifications = getListOfClassifications();
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
Report report = taskMonitorService.getClassificationReport(workbaskets, states);
assertNotNull(report);
assertEquals(10, report.getDetailLines().get(classifications.get(0).getKey()).getTotalNumberOfTasks());
assertEquals(10, report.getDetailLines().get(classifications.get(1).getKey()).getTotalNumberOfTasks());
assertEquals(7, report.getDetailLines().get(classifications.get(2).getKey()).getTotalNumberOfTasks());
assertEquals(10, report.getDetailLines().get(classifications.get(3).getKey()).getTotalNumberOfTasks());
assertEquals(13, report.getDetailLines().get(classifications.get(4).getKey()).getTotalNumberOfTasks());
assertEquals(0, report.getDetailLines().get(classifications.get(0).getKey()).getLineItems().size());
assertEquals(0, report.getDetailLines().get(classifications.get(1).getKey()).getLineItems().size());
assertEquals(0, report.getDetailLines().get(classifications.get(2).getKey()).getLineItems().size());
assertEquals(0, report.getDetailLines().get(classifications.get(3).getKey()).getLineItems().size());
assertEquals(0, report.getDetailLines().get(classifications.get(4).getKey()).getLineItems().size());
assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
}
@WithAccessId(userName = "monitor_user_1")
@Test
public void testGetClassificationReportWithReportLineItemDefinitions()
throws WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<Workbasket> workbaskets = getListOfWorkbaskets();
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<Classification> classifications = getListOfClassifications();
List<ReportLineItemDefinition> reportLineItemDefinitions = getListOfReportLineItemDefinitions();
Report report = taskMonitorService.getClassificationReport(workbaskets, states, reportLineItemDefinitions);
int sumLineCount = report.getSumLine().getLineItems().get(0).getNumberOfTasks()
+ report.getSumLine().getLineItems().get(1).getNumberOfTasks()
+ report.getSumLine().getLineItems().get(2).getNumberOfTasks()
+ report.getSumLine().getLineItems().get(3).getNumberOfTasks()
+ report.getSumLine().getLineItems().get(4).getNumberOfTasks()
+ report.getSumLine().getLineItems().get(5).getNumberOfTasks()
+ report.getSumLine().getLineItems().get(6).getNumberOfTasks()
+ report.getSumLine().getLineItems().get(7).getNumberOfTasks()
+ report.getSumLine().getLineItems().get(8).getNumberOfTasks();
assertNotNull(report);
assertEquals(10, report.getDetailLines().get(classifications.get(0).getKey()).getTotalNumberOfTasks());
assertEquals(10, report.getDetailLines().get(classifications.get(1).getKey()).getTotalNumberOfTasks());
assertEquals(7, report.getDetailLines().get(classifications.get(2).getKey()).getTotalNumberOfTasks());
assertEquals(10, report.getDetailLines().get(classifications.get(3).getKey()).getTotalNumberOfTasks());
assertEquals(13, report.getDetailLines().get(classifications.get(4).getKey()).getTotalNumberOfTasks());
assertEquals(11, report.getSumLine().getLineItems().get(0).getNumberOfTasks());
assertEquals(8, report.getSumLine().getLineItems().get(1).getNumberOfTasks());
assertEquals(11, report.getSumLine().getLineItems().get(2).getNumberOfTasks());
assertEquals(0, report.getSumLine().getLineItems().get(3).getNumberOfTasks());
assertEquals(4, report.getSumLine().getLineItems().get(4).getNumberOfTasks());
assertEquals(0, report.getSumLine().getLineItems().get(5).getNumberOfTasks());
assertEquals(7, report.getSumLine().getLineItems().get(6).getNumberOfTasks());
assertEquals(4, report.getSumLine().getLineItems().get(7).getNumberOfTasks());
assertEquals(5, report.getSumLine().getLineItems().get(8).getNumberOfTasks());
assertEquals(50, report.getSumLine().getTotalNumberOfTasks());
assertEquals(50, sumLineCount);
}
@WithAccessId(userName = "monitor_user_1")
@Test
public void testEachItemOfClassificationReport()
throws WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<Workbasket> workbaskets = getListOfWorkbaskets();
List<TaskState> states = Arrays.asList(TaskState.READY, TaskState.CLAIMED);
List<Classification> classifications = getListOfClassifications();
List<ReportLineItemDefinition> reportLineItemDefinitions = getShortListOfReportLineItemDefinitions();
Report report = taskMonitorService.getClassificationReport(workbaskets, states, reportLineItemDefinitions);
List<ReportLineItem> line1 = report.getDetailLines().get(classifications.get(0).getKey()).getLineItems();
assertEquals(7, line1.get(0).getNumberOfTasks());
assertEquals(2, line1.get(1).getNumberOfTasks());
assertEquals(1, line1.get(2).getNumberOfTasks());
assertEquals(0, line1.get(3).getNumberOfTasks());
assertEquals(0, line1.get(4).getNumberOfTasks());
List<ReportLineItem> line2 = report.getDetailLines().get(classifications.get(1).getKey()).getLineItems();
assertEquals(5, line2.get(0).getNumberOfTasks());
assertEquals(3, line2.get(1).getNumberOfTasks());
assertEquals(1, line2.get(2).getNumberOfTasks());
assertEquals(1, line2.get(3).getNumberOfTasks());
assertEquals(0, line2.get(4).getNumberOfTasks());
List<ReportLineItem> line3 = report.getDetailLines().get(classifications.get(2).getKey()).getLineItems();
assertEquals(2, line3.get(0).getNumberOfTasks());
assertEquals(1, line3.get(1).getNumberOfTasks());
assertEquals(0, line3.get(2).getNumberOfTasks());
assertEquals(1, line3.get(3).getNumberOfTasks());
assertEquals(3, line3.get(4).getNumberOfTasks());
List<ReportLineItem> line4 = report.getDetailLines().get(classifications.get(3).getKey()).getLineItems();
assertEquals(2, line4.get(0).getNumberOfTasks());
assertEquals(2, line4.get(1).getNumberOfTasks());
assertEquals(2, line4.get(2).getNumberOfTasks());
assertEquals(0, line4.get(3).getNumberOfTasks());
assertEquals(4, line4.get(4).getNumberOfTasks());
List<ReportLineItem> line5 = report.getDetailLines().get(classifications.get(4).getKey()).getLineItems();
assertEquals(3, line5.get(0).getNumberOfTasks());
assertEquals(3, line5.get(1).getNumberOfTasks());
assertEquals(0, line5.get(2).getNumberOfTasks());
assertEquals(5, line5.get(3).getNumberOfTasks());
assertEquals(2, line5.get(4).getNumberOfTasks());
}
private List<Workbasket> getListOfWorkbaskets() throws WorkbasketNotFoundException, NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketImpl workbasket1 = (WorkbasketImpl) workbasketService
.getWorkbasket("WBI:000000000000000000000000000000000001");
WorkbasketImpl workbasket2 = (WorkbasketImpl) workbasketService
.getWorkbasket("WBI:000000000000000000000000000000000002");
WorkbasketImpl workbasket3 = (WorkbasketImpl) workbasketService
.getWorkbasket("WBI:000000000000000000000000000000000003");
WorkbasketImpl workbasket4 = (WorkbasketImpl) workbasketService
.getWorkbasket("WBI:000000000000000000000000000000000004");
return Arrays.asList(workbasket1, workbasket2, workbasket3, workbasket4);
}
private List<Classification> getListOfClassifications() throws ClassificationNotFoundException {
ClassificationService classificationService = taskanaEngine.getClassificationService();
ClassificationImpl c1 = (ClassificationImpl) classificationService.getClassification("L10000", "DOMAIN_A");
ClassificationImpl c2 = (ClassificationImpl) classificationService.getClassification("L20000", "DOMAIN_A");
ClassificationImpl c3 = (ClassificationImpl) classificationService.getClassification("L30000", "DOMAIN_A");
ClassificationImpl c4 = (ClassificationImpl) classificationService.getClassification("L40000", "DOMAIN_A");
ClassificationImpl c5 = (ClassificationImpl) classificationService.getClassification("L50000", "DOMAIN_A");
return Arrays.asList(c1, c2, c3, c4, c5);
}
private List<ReportLineItemDefinition> getListOfReportLineItemDefinitions() {
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -11));
reportLineItemDefinitions.add(new ReportLineItemDefinition(-10, -6));
reportLineItemDefinitions.add(new ReportLineItemDefinition(-5, -2));
reportLineItemDefinitions.add(new ReportLineItemDefinition(-1));
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
reportLineItemDefinitions.add(new ReportLineItemDefinition(1));
reportLineItemDefinitions.add(new ReportLineItemDefinition(2, 5));
reportLineItemDefinitions.add(new ReportLineItemDefinition(6, 10));
reportLineItemDefinitions.add(new ReportLineItemDefinition(11, Integer.MAX_VALUE));
return reportLineItemDefinitions;
}
private List<ReportLineItemDefinition> getShortListOfReportLineItemDefinitions() {
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -6));
reportLineItemDefinitions.add(new ReportLineItemDefinition(-5, -1));
reportLineItemDefinitions.add(new ReportLineItemDefinition(0));
reportLineItemDefinitions.add(new ReportLineItemDefinition(1, 5));
reportLineItemDefinitions.add(new ReportLineItemDefinition(6, Integer.MAX_VALUE));
return reportLineItemDefinitions;
}
@AfterClass
public static void cleanUpClass() {
FileUtils.deleteRecursive("~/data", true);
}
}

View File

@ -189,4 +189,66 @@ public class TaskMonitorServiceImplTest {
assertEquals(actualResult.getDetailLines().get("EXTERN").getLineItems().get(0).getNumberOfTasks(), 1);
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
}
@Test
public void testGetTotalNumbersOfClassificationReport() {
WorkbasketImpl workbasket = new WorkbasketImpl();
workbasket.setName("workbasket");
workbasket.setKey("wb1");
List<Workbasket> workbaskets = Arrays.asList(workbasket);
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
monitorQueryItem.setKey("L10000");
monitorQueryItem.setNumberOfTasks(1);
expectedResult.add(monitorQueryItem);
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfClassificationsByWorkbasketsAndStates(
workbaskets, states);
Report actualResult = cut.getClassificationReport(workbaskets, states);
verify(taskanaEngineImpl, times(1)).openConnection();
verify(taskMonitorMapperMock, times(1)).getTaskCountOfClassificationsByWorkbasketsAndStates(any(), any());
verify(taskanaEngineImpl, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
taskMonitorMapperMock, objectReferenceMapperMock, workbasketServiceMock);
assertNotNull(actualResult);
assertEquals(actualResult.getDetailLines().get("L10000").getTotalNumberOfTasks(), 1);
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
}
@Test
public void testGetClassificationReportWithReportLineItemDefinitions() {
WorkbasketImpl workbasket = new WorkbasketImpl();
workbasket.setName("workbasket");
workbasket.setKey("wb1");
List<Workbasket> workbaskets = Arrays.asList(workbasket);
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<ReportLineItemDefinition> reportLineItemDefinitions = Arrays.asList(new ReportLineItemDefinition(),
new ReportLineItemDefinition());
List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
monitorQueryItem.setKey("L10000");
monitorQueryItem.setAgeInDays(0);
monitorQueryItem.setNumberOfTasks(1);
expectedResult.add(monitorQueryItem);
doReturn(expectedResult).when(taskMonitorMapperMock).getTaskCountOfClassificationsByWorkbasketsAndStates(
workbaskets, states);
Report actualResult = cut.getClassificationReport(workbaskets, states, reportLineItemDefinitions);
verify(taskanaEngineImpl, times(1)).openConnection();
verify(taskMonitorMapperMock, times(1)).getTaskCountOfClassificationsByWorkbasketsAndStates(any(), any());
verify(taskanaEngineImpl, times(1)).returnConnection();
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
taskMonitorMapperMock, objectReferenceMapperMock, workbasketServiceMock);
assertNotNull(actualResult);
assertEquals(actualResult.getDetailLines().get("L10000").getTotalNumberOfTasks(), 1);
assertEquals(actualResult.getDetailLines().get("L10000").getLineItems().get(0).getNumberOfTasks(), 1);
assertEquals(actualResult.getSumLine().getTotalNumberOfTasks(), 1);
}
}

View File

@ -63,8 +63,8 @@ INSERT INTO WORKBASKET_ACCESS_LIST VALUES ('WAI:00000000000000000000000000000000
INSERT INTO WORKBASKET_ACCESS_LIST VALUES ('WAI:000000000000000000000000000000000004', 'USER_1_4', 'monitor_user_1', true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false);
-- Classifications
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000001', 'L10000', '', 'EXTERN', 'TASK', '', TRUE, CURRENT_TIMESTAMP, 'OLD-Leistungsfall', 'OLD-Leistungsfall', 999, 'P1D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000002', 'L20000', '', 'EXTERN', 'TASK', '', TRUE, CURRENT_TIMESTAMP, 'Beratungsprotokoll', 'Beratungsprotokoll', 1, 'P1D', '', 'VNR,RVNR,KOLVNR, ANR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000003', 'L30000', '', 'AUTOMATIC', 'TASK', '', TRUE, CURRENT_TIMESTAMP, 'Widerruf', 'Widerruf', 1, 'P1D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000004', 'L40000', '', 'MANUAL', 'TASK', '', TRUE, CURRENT_TIMESTAMP, 'Dynamikänderung', 'Dynamikänderung', 1, 'P1D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000005', 'L50000', 'L11010', 'EXTERN', 'TASK', '', TRUE, CURRENT_TIMESTAMP, 'Dynamik-Ablehnung', 'Dynamik-Ablehnung', 5, 'P5D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000001', 'L10000', '', 'EXTERN', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, 'OLD-Leistungsfall', 'OLD-Leistungsfall', 999, 'P1D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000002', 'L20000', '', 'EXTERN', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, 'Beratungsprotokoll', 'Beratungsprotokoll', 1, 'P1D', '', 'VNR,RVNR,KOLVNR, ANR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000003', 'L30000', '', 'AUTOMATIC', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, 'Widerruf', 'Widerruf', 1, 'P1D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000004', 'L40000', '', 'MANUAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, 'Dynamikänderung', 'Dynamikänderung', 1, 'P1D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000005', 'L50000', 'L11010', 'EXTERN', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, 'Dynamik-Ablehnung', 'Dynamik-Ablehnung', 5, 'P5D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');