From aebb87ab7fed0ab8f21809d5fe561168fe293806 Mon Sep 17 00:00:00 2001 From: Yanick Minder Date: Tue, 24 Dec 2024 10:47:04 +0100 Subject: [PATCH] update hostName and subDomain --- .../clientconfig/ClientConfigService.java | 8 +++---- .../clientconfig/ClientConfigServiceIT.java | 2 +- .../clientconfig/ClientConfigServiceTest.java | 22 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/backend/src/main/java/ch/puzzle/okr/service/clientconfig/ClientConfigService.java b/backend/src/main/java/ch/puzzle/okr/service/clientconfig/ClientConfigService.java index 1e51f13b4c..9011b6f967 100644 --- a/backend/src/main/java/ch/puzzle/okr/service/clientconfig/ClientConfigService.java +++ b/backend/src/main/java/ch/puzzle/okr/service/clientconfig/ClientConfigService.java @@ -62,7 +62,7 @@ public ClientConfigDto getConfigBasedOnActiveEnv(String hostName) { tenantClientCustomization.get().customStyles()); // } - private Optional getTenantConfig(String hostname, String... tenantsFromUrl) { + private Optional getTenantConfig(String hostName, String... tenantsFromUrl) { for (String tenant : tenantsFromUrl) { Optional tenantConfig = tenantConfigProvider.getTenantConfigById(tenant); if (tenantConfig.isPresent()) { @@ -71,11 +71,11 @@ private Optional getTenantConfig(String hostn } logger.info("get config found for " + tenant + ": failed"); } - logger.info("no config found for " + hostname + ": failed"); + logger.info("no config found for " + hostName + ": failed"); return Optional.empty(); } - private Optional getTenantClientCustomization(String hostname, + private Optional getTenantClientCustomization(String hostName, String... tenantsFromUrl) { for (String tenant : tenantsFromUrl) { Optional tenantCustomization = tenantClientCustomizationProvider @@ -86,7 +86,7 @@ private Optional getTenantClientCustomization(String } logger.info("get client customization for " + tenant + ": failed"); } - logger.info("no client customization found for " + hostname + ": failed"); + logger.info("no client customization found for " + hostName + ": failed"); return Optional.empty(); } } diff --git a/backend/src/test/java/ch/puzzle/okr/service/clientconfig/ClientConfigServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/clientconfig/ClientConfigServiceIT.java index 7af23c4b51..e49f3b8941 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/clientconfig/ClientConfigServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/clientconfig/ClientConfigServiceIT.java @@ -43,7 +43,7 @@ private static Stream tenantConfigs() { .of("acme.okr.puzzle.ch", "prod", "http://localhost:8544/realms/pitc", "acme_okr_staging")); } - @DisplayName("Should throw exception on getConfigBasedOnActiveEnv() when subdomain is invalid") + @DisplayName("Should throw exception on getConfigBasedOnActiveEnv() when subDomain is invalid") @Test void getConfigBasedOnActiveEnvWithInvalidSubdomainThrowsException() { assertThrowsExactly(EntityNotFoundException.class, diff --git a/backend/src/test/java/ch/puzzle/okr/service/clientconfig/ClientConfigServiceTest.java b/backend/src/test/java/ch/puzzle/okr/service/clientconfig/ClientConfigServiceTest.java index e0ef09f825..a840fa3512 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/clientconfig/ClientConfigServiceTest.java +++ b/backend/src/test/java/ch/puzzle/okr/service/clientconfig/ClientConfigServiceTest.java @@ -16,41 +16,41 @@ public class ClientConfigServiceTest { - @ParameterizedTest(name = "Should be successful on getConfigBasedOnActiveEnv() when tenant is configured properly with tenant {0} and hostname {1}") + @ParameterizedTest(name = "Should be successful on getConfigBasedOnActiveEnv() when tenant is configured properly with tenant {0} and hostName {1}") @CsvSource({ "pitc,pitc.ork.ch", "acme,acme-ork.ch" }) - void getConfigBasedOnActiveEnvShouldBeSuccessfulWhenTenantIsConfiguredProperly(String tenant, String hostname) { + void getConfigBasedOnActiveEnvShouldBeSuccessfulWhenTenantIsConfiguredProperly(String tenant, String hostName) { // arrange TenantConfigProvider.TenantConfig tenantConfig = getTenantConfig(tenant); TenantClientCustomization tenantCustomization = getTenantClientCustomization(tenant); ClientConfigService service = getClientConfig(tenantConfig, tenantCustomization, tenant); // act - ClientConfigDto configBasedOnActiveEnv = service.getConfigBasedOnActiveEnv(hostname); + ClientConfigDto configBasedOnActiveEnv = service.getConfigBasedOnActiveEnv(hostName); // assert assertClientConfigDto(configBasedOnActiveEnv, tenant); } - @ParameterizedTest(name = "Should throw exception on getConfigBasedOnActiveEnv() when client customization is not found for tenant {0}, hostname {1} and subdomain {2}") + @ParameterizedTest(name = "Should throw exception on getConfigBasedOnActiveEnv() when client customization is not found for tenant {0}, hostName {1} and subDomain {2}") @CsvSource({ "pitc,pitc.okr.ch,pitc", "acme,acme-okr.ch,acme-okr" }) - void getConfigBasedOnActiveEnvShouldThrowExceptionIfClientCustomizationIsNotFound(String tenant, String hostname, - String subdomain) { + void getConfigBasedOnActiveEnvShouldThrowExceptionIfClientCustomizationIsNotFound(String tenant, String hostName, + String subDomain) { // arrange TenantConfigProvider.TenantConfig tenantConfig = getTenantConfig(tenant); ClientConfigService service = getClientConfig(tenantConfig, tenant); // act + assert EntityNotFoundException entityNotFoundException = // - assertThrows(EntityNotFoundException.class, () -> service.getConfigBasedOnActiveEnv(hostname)); + assertThrows(EntityNotFoundException.class, () -> service.getConfigBasedOnActiveEnv(hostName)); - String expectedErrorMessage = "Could not find tenant client customization for subdomain:" + subdomain; + String expectedErrorMessage = "Could not find tenant client customization for subDomain:" + subDomain; assertEquals(expectedErrorMessage, entityNotFoundException.getMessage()); } - @ParameterizedTest(name = "Should throw exception getConfigBasedOnActiveEnv when client config is not found for tenant {0}, hostname {1} and subdomain {2} ") + @ParameterizedTest(name = "Should throw exception getConfigBasedOnActiveEnv when client config is not found for tenant {0}, hostname {1} and subDomain {2} ") @CsvSource({ "pitc,pitc.okr.ch,pitc", "acme,acme-okr.ch,acme-okr" }) void getConfigBasedOnActiveEnvShouldThrowExceptionIfClientConfigIsNotFound(String tenant, String hostname, - String subdomain) { + String subDomain) { // arrange TenantClientCustomization tenantCustomization = getTenantClientCustomization(tenant); ClientConfigService service = getClientConfig(tenantCustomization, tenant); @@ -59,7 +59,7 @@ void getConfigBasedOnActiveEnvShouldThrowExceptionIfClientConfigIsNotFound(Strin EntityNotFoundException entityNotFoundException = // assertThrows(EntityNotFoundException.class, () -> service.getConfigBasedOnActiveEnv(hostname)); - String expectedErrorMessage = "Could not find tenant config for subdomain:" + subdomain; + String expectedErrorMessage = "Could not find tenant config for subDomain:" + subDomain; assertEquals(expectedErrorMessage, entityNotFoundException.getMessage()); }