TSK-271: Add custom holiday support to the monitor
This commit is contained in:
parent
6f6d884e02
commit
603afc8a2d
|
@ -1,6 +1,8 @@
|
||||||
package pro.taskana.configuration;
|
package pro.taskana.configuration;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
@ -36,6 +38,9 @@ public class TaskanaEngineConfiguration {
|
||||||
protected boolean securityEnabled = true;
|
protected boolean securityEnabled = true;
|
||||||
protected boolean useManagedTransactions;
|
protected boolean useManagedTransactions;
|
||||||
|
|
||||||
|
private boolean germanPublicHolidaysEnabled;
|
||||||
|
private List<LocalDate> customHolidays;
|
||||||
|
|
||||||
public TaskanaEngineConfiguration(boolean enableSecurity) {
|
public TaskanaEngineConfiguration(boolean enableSecurity) {
|
||||||
this.securityEnabled = enableSecurity;
|
this.securityEnabled = enableSecurity;
|
||||||
}
|
}
|
||||||
|
@ -134,6 +139,22 @@ public class TaskanaEngineConfiguration {
|
||||||
this.propertiesSeparator = propertiesSeparator;
|
this.propertiesSeparator = propertiesSeparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isGermanPublicHolidaysEnabled() {
|
||||||
|
return this.germanPublicHolidaysEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGermanPublicHolidaysEnabled(boolean germanPublicHolidaysEnabled) {
|
||||||
|
this.germanPublicHolidaysEnabled = germanPublicHolidaysEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LocalDate> getCustomHolidays() {
|
||||||
|
return customHolidays;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomHolidays(List<LocalDate> customHolidays) {
|
||||||
|
this.customHolidays = customHolidays;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to determine whether all access ids (user Id and group ids) should be used in lower case.
|
* Helper method to determine whether all access ids (user Id and group ids) should be used in lower case.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,6 +2,7 @@ package pro.taskana.impl;
|
||||||
|
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
|
@ -27,12 +28,16 @@ public final class DaysToWorkingDaysConverter {
|
||||||
private static ArrayList<Integer> positiveDaysToWorkingDays;
|
private static ArrayList<Integer> positiveDaysToWorkingDays;
|
||||||
private static ArrayList<Integer> negativeDaysToWorkingDays;
|
private static ArrayList<Integer> negativeDaysToWorkingDays;
|
||||||
private static Instant dateCreated;
|
private static Instant dateCreated;
|
||||||
|
private static LocalDate easterSunday;
|
||||||
|
private static boolean germanHolidaysEnabled;
|
||||||
|
private static List<LocalDate> customHolidays;
|
||||||
|
|
||||||
private DaysToWorkingDaysConverter(List<ReportLineItemDefinition> reportLineItemDefinitions,
|
private DaysToWorkingDaysConverter(List<ReportLineItemDefinition> reportLineItemDefinitions,
|
||||||
Instant referenceDate) {
|
Instant referenceDate) {
|
||||||
|
easterSunday = getEasterSunday(LocalDateTime.ofInstant(referenceDate, ZoneId.systemDefault()).getYear());
|
||||||
|
dateCreated = referenceDate;
|
||||||
positiveDaysToWorkingDays = generatePositiveDaysToWorkingDays(reportLineItemDefinitions, referenceDate);
|
positiveDaysToWorkingDays = generatePositiveDaysToWorkingDays(reportLineItemDefinitions, referenceDate);
|
||||||
negativeDaysToWorkingDays = generateNegativeDaysToWorkingDays(reportLineItemDefinitions, referenceDate);
|
negativeDaysToWorkingDays = generateNegativeDaysToWorkingDays(reportLineItemDefinitions, referenceDate);
|
||||||
dateCreated = referenceDate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,10 +165,77 @@ public final class DaysToWorkingDaysConverter {
|
||||||
if (LocalDateTime.ofInstant(referenceDate, ZoneId.systemDefault()).plusDays(day).getDayOfWeek().equals(
|
if (LocalDateTime.ofInstant(referenceDate, ZoneId.systemDefault()).plusDays(day).getDayOfWeek().equals(
|
||||||
DayOfWeek.SATURDAY)
|
DayOfWeek.SATURDAY)
|
||||||
|| LocalDateTime.ofInstant(referenceDate, ZoneId.systemDefault()).plusDays(day).getDayOfWeek().equals(
|
|| LocalDateTime.ofInstant(referenceDate, ZoneId.systemDefault()).plusDays(day).getDayOfWeek().equals(
|
||||||
DayOfWeek.SUNDAY)) {
|
DayOfWeek.SUNDAY)
|
||||||
|
|| isHoliday(LocalDateTime.ofInstant(referenceDate, ZoneId.systemDefault()).plusDays(day).toLocalDate())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isHoliday(LocalDate date) {
|
||||||
|
if (germanHolidaysEnabled) {
|
||||||
|
// Fix and movable holidays that are valid throughout Germany: New years day, Labour Day, Day of German
|
||||||
|
// Unity, Christmas, Good Friday, Easter Monday, Ascension Day, Whit Monday.
|
||||||
|
if (date.getDayOfMonth() == 1 && date.getMonthValue() == 1
|
||||||
|
|| date.getDayOfMonth() == 1 && date.getMonthValue() == 5
|
||||||
|
|| date.getDayOfMonth() == 3 && date.getMonthValue() == 10
|
||||||
|
|| date.getDayOfMonth() == 25 && date.getMonthValue() == 12
|
||||||
|
|| date.getDayOfMonth() == 26 && date.getMonthValue() == 12
|
||||||
|
|| easterSunday.minusDays(2).equals(date)
|
||||||
|
|| easterSunday.plusDays(1).equals(date)
|
||||||
|
|| easterSunday.plusDays(39).equals(date)
|
||||||
|
|| easterSunday.plusDays(50).equals(date)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (customHolidays != null) {
|
||||||
|
// Custom holidays that can be configured in the TaskanaEngineConfiguration
|
||||||
|
for (LocalDate customHoliday : customHolidays) {
|
||||||
|
if (date.equals(customHoliday)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getEasterSunday(int year) {
|
||||||
|
// Formula to compute Easter Sunday by Gauss.
|
||||||
|
int a = year % 19;
|
||||||
|
int b = year % 4;
|
||||||
|
int c = year % 7;
|
||||||
|
int k = year / 100;
|
||||||
|
int p = (13 + 8 * k) / 25;
|
||||||
|
int q = k / 4;
|
||||||
|
int m = (15 - p + k - q) % 30;
|
||||||
|
int n = (4 + k - q) % 7;
|
||||||
|
int d = (19 * a + m) % 30;
|
||||||
|
|
||||||
|
int e = (2 * b + 4 * c + 6 * d + n) % 7;
|
||||||
|
|
||||||
|
if (d == 29 && e == 6) {
|
||||||
|
return LocalDate.of(year, 3, 15).plusDays(d + e);
|
||||||
|
}
|
||||||
|
if (d == 28 && e == 6 && (11 * m + 11) % 30 < 19) {
|
||||||
|
return LocalDate.of(year, 3, 15).plusDays(d + e);
|
||||||
|
}
|
||||||
|
return LocalDate.of(year, 3, 22).plusDays(d + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setCustomHolidays(List<LocalDate> holidays) {
|
||||||
|
customHolidays = holidays;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LocalDate> getCustomHolidays() {
|
||||||
|
return customHolidays;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setGermanPublicHolidaysEnabled(boolean germanPublicHolidaysEnabled) {
|
||||||
|
germanHolidaysEnabled = germanPublicHolidaysEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGermanPublicHolidayEnabled() {
|
||||||
|
return germanHolidaysEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,8 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
||||||
try {
|
try {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
|
|
||||||
|
configureDaysToWorkingDaysConverter();
|
||||||
|
|
||||||
Report report = new Report();
|
Report report = new Report();
|
||||||
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper
|
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper
|
||||||
.getTaskCountOfWorkbasketsByWorkbasketsAndStates(workbasketIds, states, categories, domains);
|
.getTaskCountOfWorkbasketsByWorkbasketsAndStates(workbasketIds, states, categories, domains);
|
||||||
|
@ -61,7 +63,6 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
||||||
} finally {
|
} finally {
|
||||||
taskanaEngineImpl.returnConnection();
|
taskanaEngineImpl.returnConnection();
|
||||||
LOGGER.debug("exit from getWorkbasketLevelReport().");
|
LOGGER.debug("exit from getWorkbasketLevelReport().");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +92,8 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
||||||
try {
|
try {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
|
|
||||||
|
configureDaysToWorkingDaysConverter();
|
||||||
|
|
||||||
Report report = new Report();
|
Report report = new Report();
|
||||||
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper
|
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper
|
||||||
.getTaskCountOfCategoriesByWorkbasketsAndStates(workbasketIds, states, categories, domains);
|
.getTaskCountOfCategoriesByWorkbasketsAndStates(workbasketIds, states, categories, domains);
|
||||||
|
@ -130,6 +133,8 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
||||||
try {
|
try {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
|
|
||||||
|
configureDaysToWorkingDaysConverter();
|
||||||
|
|
||||||
ClassificationReport report = new ClassificationReport();
|
ClassificationReport report = new ClassificationReport();
|
||||||
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper
|
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper
|
||||||
.getTaskCountOfClassificationsByWorkbasketsAndStates(workbasketIds, states, categories, domains);
|
.getTaskCountOfClassificationsByWorkbasketsAndStates(workbasketIds, states, categories, domains);
|
||||||
|
@ -173,6 +178,8 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
||||||
try {
|
try {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
|
|
||||||
|
configureDaysToWorkingDaysConverter();
|
||||||
|
|
||||||
DetailedClassificationReport report = new DetailedClassificationReport();
|
DetailedClassificationReport report = new DetailedClassificationReport();
|
||||||
List<DetailedMonitorQueryItem> detailedMonitorQueryItems = taskMonitorMapper
|
List<DetailedMonitorQueryItem> detailedMonitorQueryItems = taskMonitorMapper
|
||||||
.getTaskCountOfDetailedClassificationsByWorkbasketsAndStates(workbasketIds, states, categories,
|
.getTaskCountOfDetailedClassificationsByWorkbasketsAndStates(workbasketIds, states, categories,
|
||||||
|
@ -217,6 +224,8 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
||||||
try {
|
try {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
|
|
||||||
|
configureDaysToWorkingDaysConverter();
|
||||||
|
|
||||||
Report report = new Report();
|
Report report = new Report();
|
||||||
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper
|
List<MonitorQueryItem> monitorQueryItems = taskMonitorMapper
|
||||||
.getTaskCountOfCustomFieldValuesByWorkbasketsAndStatesAndCustomField(workbasketIds, states, categories,
|
.getTaskCountOfCustomFieldValuesByWorkbasketsAndStatesAndCustomField(workbasketIds, states, categories,
|
||||||
|
@ -230,4 +239,10 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void configureDaysToWorkingDaysConverter() {
|
||||||
|
DaysToWorkingDaysConverter.setCustomHolidays(taskanaEngineImpl.getConfiguration().getCustomHolidays());
|
||||||
|
DaysToWorkingDaysConverter.setGermanPublicHolidaysEnabled(
|
||||||
|
this.taskanaEngineImpl.getConfiguration().isGermanPublicHolidaysEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class ProvideCategoryReportAccTest {
|
||||||
cleaner.clearDb(dataSource, true);
|
cleaner.clearDb(dataSource, true);
|
||||||
dataSource = TaskanaEngineConfigurationTest.getDataSource();
|
dataSource = TaskanaEngineConfigurationTest.getDataSource();
|
||||||
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
|
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
|
||||||
|
taskanaEngineConfiguration.setGermanPublicHolidaysEnabled(false);
|
||||||
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
||||||
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
||||||
cleaner.clearDb(dataSource, false);
|
cleaner.clearDb(dataSource, false);
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class ProvideClassificationReportAccTest {
|
||||||
cleaner.clearDb(dataSource, true);
|
cleaner.clearDb(dataSource, true);
|
||||||
dataSource = TaskanaEngineConfigurationTest.getDataSource();
|
dataSource = TaskanaEngineConfigurationTest.getDataSource();
|
||||||
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
|
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
|
||||||
|
taskanaEngineConfiguration.setGermanPublicHolidaysEnabled(false);
|
||||||
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
||||||
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
||||||
cleaner.clearDb(dataSource, false);
|
cleaner.clearDb(dataSource, false);
|
||||||
|
|
|
@ -52,6 +52,7 @@ public class ProvideCustomFieldValueReportAccTest {
|
||||||
cleaner.clearDb(dataSource, true);
|
cleaner.clearDb(dataSource, true);
|
||||||
dataSource = TaskanaEngineConfigurationTest.getDataSource();
|
dataSource = TaskanaEngineConfigurationTest.getDataSource();
|
||||||
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
|
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
|
||||||
|
taskanaEngineConfiguration.setGermanPublicHolidaysEnabled(false);
|
||||||
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
||||||
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
||||||
cleaner.clearDb(dataSource, false);
|
cleaner.clearDb(dataSource, false);
|
||||||
|
|
|
@ -54,6 +54,7 @@ public class ProvideDetailedClassificationReportAccTest {
|
||||||
cleaner.clearDb(dataSource, true);
|
cleaner.clearDb(dataSource, true);
|
||||||
dataSource = TaskanaEngineConfigurationTest.getDataSource();
|
dataSource = TaskanaEngineConfigurationTest.getDataSource();
|
||||||
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
|
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
|
||||||
|
taskanaEngineConfiguration.setGermanPublicHolidaysEnabled(false);
|
||||||
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
||||||
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
||||||
cleaner.clearDb(dataSource, false);
|
cleaner.clearDb(dataSource, false);
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class ProvideWorkbasketLevelReportAccTest {
|
||||||
cleaner.clearDb(dataSource, true);
|
cleaner.clearDb(dataSource, true);
|
||||||
dataSource = TaskanaEngineConfigurationTest.getDataSource();
|
dataSource = TaskanaEngineConfigurationTest.getDataSource();
|
||||||
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
|
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
|
||||||
|
taskanaEngineConfiguration.setGermanPublicHolidaysEnabled(false);
|
||||||
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
||||||
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
((TaskanaEngineImpl) taskanaEngine).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
||||||
cleaner.clearDb(dataSource, false);
|
cleaner.clearDb(dataSource, false);
|
||||||
|
|
|
@ -4,9 +4,12 @@ import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import static org.junit.Assert.assertNotEquals;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,6 +17,14 @@ import org.junit.Test;
|
||||||
*/
|
*/
|
||||||
public class DaysToWorkingDaysConverterTest {
|
public class DaysToWorkingDaysConverterTest {
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setup() {
|
||||||
|
DaysToWorkingDaysConverter.setGermanPublicHolidaysEnabled(true);
|
||||||
|
LocalDate dayOfReformation = LocalDate.of(2018, 10, 31);
|
||||||
|
LocalDate allSaintsDays = LocalDate.of(2018, 11, 1);
|
||||||
|
DaysToWorkingDaysConverter.setCustomHolidays(Arrays.asList(dayOfReformation, allSaintsDays));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInitializeForDifferentReportLineItemDefinitions() {
|
public void testInitializeForDifferentReportLineItemDefinitions() {
|
||||||
DaysToWorkingDaysConverter instance1 = DaysToWorkingDaysConverter
|
DaysToWorkingDaysConverter instance1 = DaysToWorkingDaysConverter
|
||||||
|
@ -61,6 +72,146 @@ public class DaysToWorkingDaysConverterTest {
|
||||||
assertEquals(16, instance.convertDaysToWorkingDays(16));
|
assertEquals(16, instance.convertDaysToWorkingDays(16));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEasterHolidays() {
|
||||||
|
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||||
|
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-03-28T00:00:00.000Z"));
|
||||||
|
|
||||||
|
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(1));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(2));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(3));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(4));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(5));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(6));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWhitsunHolidays() {
|
||||||
|
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||||
|
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-05-16T00:00:00.000Z"));
|
||||||
|
|
||||||
|
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(1));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(2));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(3));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(4));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(5));
|
||||||
|
assertEquals(3, instance.convertDaysToWorkingDays(6));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLabourDayHoliday() {
|
||||||
|
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||||
|
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-04-26T00:00:00.000Z"));
|
||||||
|
|
||||||
|
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(1));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(2));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(3));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(4));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(5));
|
||||||
|
assertEquals(3, instance.convertDaysToWorkingDays(6));
|
||||||
|
assertEquals(4, instance.convertDaysToWorkingDays(7));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAscensionDayHoliday() {
|
||||||
|
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||||
|
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-05-07T00:00:00.000Z"));
|
||||||
|
|
||||||
|
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(1));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(2));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(3));
|
||||||
|
assertEquals(3, instance.convertDaysToWorkingDays(4));
|
||||||
|
assertEquals(3, instance.convertDaysToWorkingDays(5));
|
||||||
|
assertEquals(3, instance.convertDaysToWorkingDays(6));
|
||||||
|
assertEquals(4, instance.convertDaysToWorkingDays(7));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDayOfGermanUnityHoliday() {
|
||||||
|
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||||
|
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-10-01T00:00:00.000Z"));
|
||||||
|
|
||||||
|
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(1));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(2));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(3));
|
||||||
|
assertEquals(3, instance.convertDaysToWorkingDays(4));
|
||||||
|
assertEquals(3, instance.convertDaysToWorkingDays(5));
|
||||||
|
assertEquals(3, instance.convertDaysToWorkingDays(6));
|
||||||
|
assertEquals(4, instance.convertDaysToWorkingDays(7));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testChristmasAndNewYearHolidays() {
|
||||||
|
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||||
|
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-12-20T00:00:00.000Z"));
|
||||||
|
|
||||||
|
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(1));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(2));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(3));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(4));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(5));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(6));
|
||||||
|
assertEquals(3, instance.convertDaysToWorkingDays(7));
|
||||||
|
assertEquals(4, instance.convertDaysToWorkingDays(8));
|
||||||
|
assertEquals(4, instance.convertDaysToWorkingDays(9));
|
||||||
|
assertEquals(4, instance.convertDaysToWorkingDays(10));
|
||||||
|
assertEquals(5, instance.convertDaysToWorkingDays(11));
|
||||||
|
assertEquals(5, instance.convertDaysToWorkingDays(12));
|
||||||
|
assertEquals(6, instance.convertDaysToWorkingDays(13));
|
||||||
|
assertEquals(7, instance.convertDaysToWorkingDays(14));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCustomHolidaysWithDayOfReformationAndAllSaintsDay() {
|
||||||
|
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||||
|
.initialize(getLargeListOfReportLineItemDefinitions(), Instant.parse("2018-10-26T00:00:00.000Z"));
|
||||||
|
|
||||||
|
assertEquals(0, instance.convertDaysToWorkingDays(0));
|
||||||
|
assertEquals(0, instance.convertDaysToWorkingDays(1));
|
||||||
|
assertEquals(0, instance.convertDaysToWorkingDays(2));
|
||||||
|
assertEquals(1, instance.convertDaysToWorkingDays(3));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(4));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(5));
|
||||||
|
assertEquals(2, instance.convertDaysToWorkingDays(6));
|
||||||
|
assertEquals(3, instance.convertDaysToWorkingDays(7));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testgetEasterSunday() {
|
||||||
|
DaysToWorkingDaysConverter instance = DaysToWorkingDaysConverter
|
||||||
|
.initialize(getShortListOfReportLineItemDefinitions(), Instant.parse("2018-02-27T00:00:00.000Z"));
|
||||||
|
|
||||||
|
assertEquals(LocalDate.of(2018, 4, 1), instance.getEasterSunday(2018));
|
||||||
|
assertEquals(LocalDate.of(2019, 4, 21), instance.getEasterSunday(2019));
|
||||||
|
assertEquals(LocalDate.of(2020, 4, 12), instance.getEasterSunday(2020));
|
||||||
|
assertEquals(LocalDate.of(2021, 4, 4), instance.getEasterSunday(2021));
|
||||||
|
assertEquals(LocalDate.of(2022, 4, 17), instance.getEasterSunday(2022));
|
||||||
|
assertEquals(LocalDate.of(2023, 4, 9), instance.getEasterSunday(2023));
|
||||||
|
assertEquals(LocalDate.of(2024, 3, 31), instance.getEasterSunday(2024));
|
||||||
|
assertEquals(LocalDate.of(2025, 4, 20), instance.getEasterSunday(2025));
|
||||||
|
assertEquals(LocalDate.of(2026, 4, 5), instance.getEasterSunday(2026));
|
||||||
|
assertEquals(LocalDate.of(2027, 3, 28), instance.getEasterSunday(2027));
|
||||||
|
assertEquals(LocalDate.of(2028, 4, 16), instance.getEasterSunday(2028));
|
||||||
|
assertEquals(LocalDate.of(2029, 4, 1), instance.getEasterSunday(2029));
|
||||||
|
assertEquals(LocalDate.of(2030, 4, 21), instance.getEasterSunday(2030));
|
||||||
|
assertEquals(LocalDate.of(2031, 4, 13), instance.getEasterSunday(2031));
|
||||||
|
assertEquals(LocalDate.of(2032, 3, 28), instance.getEasterSunday(2032));
|
||||||
|
assertEquals(LocalDate.of(2033, 4, 17), instance.getEasterSunday(2033));
|
||||||
|
assertEquals(LocalDate.of(2034, 4, 9), instance.getEasterSunday(2034));
|
||||||
|
assertEquals(LocalDate.of(2035, 3, 25), instance.getEasterSunday(2035));
|
||||||
|
assertEquals(LocalDate.of(2040, 4, 1), instance.getEasterSunday(2040));
|
||||||
|
assertEquals(LocalDate.of(2050, 4, 10), instance.getEasterSunday(2050));
|
||||||
|
assertEquals(LocalDate.of(2100, 3, 28), instance.getEasterSunday(2100));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private List<ReportLineItemDefinition> getShortListOfReportLineItemDefinitions() {
|
private List<ReportLineItemDefinition> getShortListOfReportLineItemDefinitions() {
|
||||||
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
List<ReportLineItemDefinition> reportLineItemDefinitions = new ArrayList<>();
|
||||||
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -3));
|
reportLineItemDefinitions.add(new ReportLineItemDefinition(Integer.MIN_VALUE, -3));
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.mockito.Mockito;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
|
|
||||||
|
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
import pro.taskana.mappings.TaskMonitorMapper;
|
import pro.taskana.mappings.TaskMonitorMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +36,9 @@ public class TaskMonitorServiceImplTest {
|
||||||
@Mock
|
@Mock
|
||||||
private TaskanaEngineImpl taskanaEngineImplMock;
|
private TaskanaEngineImpl taskanaEngineImplMock;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private TaskanaEngineConfiguration taskanaEngineConfiguration;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private TaskMonitorMapper taskMonitorMapperMock;
|
private TaskMonitorMapper taskMonitorMapperMock;
|
||||||
|
|
||||||
|
@ -43,6 +47,9 @@ public class TaskMonitorServiceImplTest {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
Mockito.doNothing().when(taskanaEngineImplMock).openConnection();
|
Mockito.doNothing().when(taskanaEngineImplMock).openConnection();
|
||||||
Mockito.doNothing().when(taskanaEngineImplMock).returnConnection();
|
Mockito.doNothing().when(taskanaEngineImplMock).returnConnection();
|
||||||
|
doReturn(taskanaEngineConfiguration).when(taskanaEngineImplMock).getConfiguration();
|
||||||
|
doReturn(true).when(taskanaEngineConfiguration).isGermanPublicHolidaysEnabled();
|
||||||
|
doReturn(null).when(taskanaEngineConfiguration).getCustomHolidays();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -63,10 +70,13 @@ public class TaskMonitorServiceImplTest {
|
||||||
Report actualResult = cut.getWorkbasketLevelReport(workbasketIds, states, categories, domains);
|
Report actualResult = cut.getWorkbasketLevelReport(workbasketIds, states, categories, domains);
|
||||||
|
|
||||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||||
|
verify(taskanaEngineImplMock, times(2)).getConfiguration();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
|
||||||
verify(taskMonitorMapperMock, times(1)).getTaskCountOfWorkbasketsByWorkbasketsAndStates(any(), any(), any(),
|
verify(taskMonitorMapperMock, times(1)).getTaskCountOfWorkbasketsByWorkbasketsAndStates(any(), any(), any(),
|
||||||
any());
|
any());
|
||||||
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock);
|
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||||
|
|
||||||
assertNotNull(actualResult);
|
assertNotNull(actualResult);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
@ -96,10 +106,13 @@ public class TaskMonitorServiceImplTest {
|
||||||
reportLineItemDefinitions);
|
reportLineItemDefinitions);
|
||||||
|
|
||||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||||
|
verify(taskanaEngineImplMock, times(2)).getConfiguration();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
|
||||||
verify(taskMonitorMapperMock, times(1)).getTaskCountOfWorkbasketsByWorkbasketsAndStates(any(), any(), any(),
|
verify(taskMonitorMapperMock, times(1)).getTaskCountOfWorkbasketsByWorkbasketsAndStates(any(), any(), any(),
|
||||||
any());
|
any());
|
||||||
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock);
|
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||||
|
|
||||||
assertNotNull(actualResult);
|
assertNotNull(actualResult);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
@ -132,10 +145,13 @@ public class TaskMonitorServiceImplTest {
|
||||||
Report actualResult = cut.getCategoryReport(workbasketIds, states, categories, domains);
|
Report actualResult = cut.getCategoryReport(workbasketIds, states, categories, domains);
|
||||||
|
|
||||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||||
|
verify(taskanaEngineImplMock, times(2)).getConfiguration();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
|
||||||
verify(taskMonitorMapperMock, times(1)).getTaskCountOfCategoriesByWorkbasketsAndStates(any(), any(), any(),
|
verify(taskMonitorMapperMock, times(1)).getTaskCountOfCategoriesByWorkbasketsAndStates(any(), any(), any(),
|
||||||
any());
|
any());
|
||||||
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock);
|
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||||
|
|
||||||
assertNotNull(actualResult);
|
assertNotNull(actualResult);
|
||||||
assertEquals(actualResult.getReportLines().get("EXTERN").getTotalNumberOfTasks(), 1);
|
assertEquals(actualResult.getReportLines().get("EXTERN").getTotalNumberOfTasks(), 1);
|
||||||
|
@ -164,10 +180,13 @@ public class TaskMonitorServiceImplTest {
|
||||||
reportLineItemDefinitions);
|
reportLineItemDefinitions);
|
||||||
|
|
||||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||||
|
verify(taskanaEngineImplMock, times(2)).getConfiguration();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
|
||||||
verify(taskMonitorMapperMock, times(1)).getTaskCountOfCategoriesByWorkbasketsAndStates(any(), any(), any(),
|
verify(taskMonitorMapperMock, times(1)).getTaskCountOfCategoriesByWorkbasketsAndStates(any(), any(), any(),
|
||||||
any());
|
any());
|
||||||
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock);
|
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||||
|
|
||||||
assertNotNull(actualResult);
|
assertNotNull(actualResult);
|
||||||
assertEquals(actualResult.getReportLines().get("EXTERN").getTotalNumberOfTasks(), 1);
|
assertEquals(actualResult.getReportLines().get("EXTERN").getTotalNumberOfTasks(), 1);
|
||||||
|
@ -193,10 +212,13 @@ public class TaskMonitorServiceImplTest {
|
||||||
ClassificationReport actualResult = cut.getClassificationReport(workbasketIds, states, categories, domains);
|
ClassificationReport actualResult = cut.getClassificationReport(workbasketIds, states, categories, domains);
|
||||||
|
|
||||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||||
|
verify(taskanaEngineImplMock, times(2)).getConfiguration();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
|
||||||
verify(taskMonitorMapperMock, times(1)).getTaskCountOfClassificationsByWorkbasketsAndStates(any(), any(), any(),
|
verify(taskMonitorMapperMock, times(1)).getTaskCountOfClassificationsByWorkbasketsAndStates(any(), any(), any(),
|
||||||
any());
|
any());
|
||||||
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock);
|
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||||
|
|
||||||
assertNotNull(actualResult);
|
assertNotNull(actualResult);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
@ -226,10 +248,13 @@ public class TaskMonitorServiceImplTest {
|
||||||
reportLineItemDefinitions);
|
reportLineItemDefinitions);
|
||||||
|
|
||||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||||
|
verify(taskanaEngineImplMock, times(2)).getConfiguration();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
|
||||||
verify(taskMonitorMapperMock, times(1)).getTaskCountOfClassificationsByWorkbasketsAndStates(any(), any(), any(),
|
verify(taskMonitorMapperMock, times(1)).getTaskCountOfClassificationsByWorkbasketsAndStates(any(), any(), any(),
|
||||||
any());
|
any());
|
||||||
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock);
|
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||||
|
|
||||||
assertNotNull(actualResult);
|
assertNotNull(actualResult);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
@ -262,10 +287,13 @@ public class TaskMonitorServiceImplTest {
|
||||||
categories, domains);
|
categories, domains);
|
||||||
|
|
||||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||||
|
verify(taskanaEngineImplMock, times(2)).getConfiguration();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
|
||||||
verify(taskMonitorMapperMock, times(1)).getTaskCountOfDetailedClassificationsByWorkbasketsAndStates(any(),
|
verify(taskMonitorMapperMock, times(1)).getTaskCountOfDetailedClassificationsByWorkbasketsAndStates(any(),
|
||||||
any(), any(), any());
|
any(), any(), any());
|
||||||
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock);
|
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||||
|
|
||||||
DetailedReportLine line = (DetailedReportLine) actualResult.getReportLines()
|
DetailedReportLine line = (DetailedReportLine) actualResult.getReportLines()
|
||||||
.get("CLI:000000000000000000000000000000000001");
|
.get("CLI:000000000000000000000000000000000001");
|
||||||
|
@ -295,14 +323,16 @@ public class TaskMonitorServiceImplTest {
|
||||||
.getTaskCountOfDetailedClassificationsByWorkbasketsAndStates(workbasketIds, states, categories, domains);
|
.getTaskCountOfDetailedClassificationsByWorkbasketsAndStates(workbasketIds, states, categories, domains);
|
||||||
|
|
||||||
DetailedClassificationReport actualResult = cut.getDetailedClassificationReport(workbasketIds, states,
|
DetailedClassificationReport actualResult = cut.getDetailedClassificationReport(workbasketIds, states,
|
||||||
categories,
|
categories, domains, reportLineItemDefinitions);
|
||||||
domains, reportLineItemDefinitions);
|
|
||||||
|
|
||||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||||
|
verify(taskanaEngineImplMock, times(2)).getConfiguration();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
|
||||||
verify(taskMonitorMapperMock, times(1)).getTaskCountOfDetailedClassificationsByWorkbasketsAndStates(any(),
|
verify(taskMonitorMapperMock, times(1)).getTaskCountOfDetailedClassificationsByWorkbasketsAndStates(any(),
|
||||||
any(), any(), any());
|
any(), any(), any());
|
||||||
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock);
|
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||||
|
|
||||||
DetailedReportLine line = (DetailedReportLine) actualResult.getReportLines()
|
DetailedReportLine line = (DetailedReportLine) actualResult.getReportLines()
|
||||||
.get("CLI:000000000000000000000000000000000001");
|
.get("CLI:000000000000000000000000000000000001");
|
||||||
|
@ -339,10 +369,13 @@ public class TaskMonitorServiceImplTest {
|
||||||
CustomField.CUSTOM_1);
|
CustomField.CUSTOM_1);
|
||||||
|
|
||||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||||
|
verify(taskanaEngineImplMock, times(2)).getConfiguration();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
|
||||||
verify(taskMonitorMapperMock, times(1))
|
verify(taskMonitorMapperMock, times(1))
|
||||||
.getTaskCountOfCustomFieldValuesByWorkbasketsAndStatesAndCustomField(any(), any(), any(), any(), any());
|
.getTaskCountOfCustomFieldValuesByWorkbasketsAndStatesAndCustomField(any(), any(), any(), any(), any());
|
||||||
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock);
|
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||||
|
|
||||||
assertNotNull(actualResult);
|
assertNotNull(actualResult);
|
||||||
assertEquals(actualResult.getReportLines().get("Geschaeftsstelle A").getTotalNumberOfTasks(), 1);
|
assertEquals(actualResult.getReportLines().get("Geschaeftsstelle A").getTotalNumberOfTasks(), 1);
|
||||||
|
@ -372,10 +405,13 @@ public class TaskMonitorServiceImplTest {
|
||||||
CustomField.CUSTOM_1, reportLineItemDefinitions);
|
CustomField.CUSTOM_1, reportLineItemDefinitions);
|
||||||
|
|
||||||
verify(taskanaEngineImplMock, times(1)).openConnection();
|
verify(taskanaEngineImplMock, times(1)).openConnection();
|
||||||
|
verify(taskanaEngineImplMock, times(2)).getConfiguration();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).isGermanPublicHolidaysEnabled();
|
||||||
|
verify(taskanaEngineConfiguration, times(1)).getCustomHolidays();
|
||||||
verify(taskMonitorMapperMock, times(1))
|
verify(taskMonitorMapperMock, times(1))
|
||||||
.getTaskCountOfCustomFieldValuesByWorkbasketsAndStatesAndCustomField(any(), any(), any(), any(), any());
|
.getTaskCountOfCustomFieldValuesByWorkbasketsAndStatesAndCustomField(any(), any(), any(), any(), any());
|
||||||
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
verify(taskanaEngineImplMock, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock);
|
verifyNoMoreInteractions(taskanaEngineImplMock, taskMonitorMapperMock, taskanaEngineConfiguration);
|
||||||
|
|
||||||
assertNotNull(actualResult);
|
assertNotNull(actualResult);
|
||||||
assertEquals(actualResult.getReportLines().get("Geschaeftsstelle A").getTotalNumberOfTasks(), 1);
|
assertEquals(actualResult.getReportLines().get("Geschaeftsstelle A").getTotalNumberOfTasks(), 1);
|
||||||
|
|
Loading…
Reference in New Issue