diff --git a/backend/src/main/java/ch/puzzle/okr/multitenancy/TenantConfigProvider.java b/backend/src/main/java/ch/puzzle/okr/multitenancy/TenantConfigProvider.java index 453ef82b75..4c13e79e3c 100644 --- a/backend/src/main/java/ch/puzzle/okr/multitenancy/TenantConfigProvider.java +++ b/backend/src/main/java/ch/puzzle/okr/multitenancy/TenantConfigProvider.java @@ -85,8 +85,8 @@ public Optional getJwkSetUri(String tenantId) { return getTenantConfigById(tenantId).map(TenantConfig::jwkSetUri); } - public List getAllTenantIds() { - return new ArrayList<>(this.tenantConfigs.keySet()); + public Set getAllTenantIds() { + return this.tenantConfigs.keySet(); } public record TenantConfig(String tenantId, String[] okrChampionEmails, String jwkSetUri, String issuerUrl, diff --git a/backend/src/main/java/ch/puzzle/okr/service/business/QuarterBusinessService.java b/backend/src/main/java/ch/puzzle/okr/service/business/QuarterBusinessService.java index 1dbf394e99..6058ad25b6 100644 --- a/backend/src/main/java/ch/puzzle/okr/service/business/QuarterBusinessService.java +++ b/backend/src/main/java/ch/puzzle/okr/service/business/QuarterBusinessService.java @@ -12,6 +12,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; + import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -129,7 +131,7 @@ public void scheduledGenerationQuarters() { String initialTenant = TenantContext.getCurrentTenant(); - List tenantSchemas = this.tenantConfigProvider.getAllTenantIds(); + Set tenantSchemas = this.tenantConfigProvider.getAllTenantIds(); // If we are in the last month of a quarter, generate the next quarter if (isInLastMonthOfQuarter(currentQuarter, nextQuarter)) { for (String schema : tenantSchemas) { diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/QuarterPersistenceServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/QuarterPersistenceServiceIT.java index 3d48ffcddb..4ee29e0b9e 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/QuarterPersistenceServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/QuarterPersistenceServiceIT.java @@ -137,10 +137,10 @@ void getModelNameShouldReturnQuarter() { assertEquals(QUARTER, quarterPersistenceService.getModelName()); } - @ParameterizedTest + @ParameterizedTest(name = "Should generate quarter with Cron-Job when current month is the last month of the current quarter") @CsvSource(value = { "1,1,0", "2,1,0", "3,1,1", "4,1,0", "5,1,0", "6,2,1", "7,1,0", "8,1,0", "9,3,1", "10,3,0", "11,1,0", "12,4,1" }) - void testCronJob(int month, int quarterIndex, int amountOfInvocations) { + void shouldGenerateQuarterWithCronJob(int month, int quarterIndex, int amountOfInvocations) { int startQuarter = 7; ReflectionTestUtils.setField(quarterBusinessService, "quarterStart", startQuarter); int nextYear = Year.now().atMonth(startQuarter).plusMonths(month + 12 - 1).getYear();