diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index 6fd4107515b07e7a6e6197e0bae9ff07b25db063..58ff6b8aeeff343f7af013e6c3ff8e22c31d326b 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -124,8 +124,8 @@ spec: value: {{ .Values.ozgcloud.feature.organisationsEinheiten | quote }} {{- end }} {{- if eq ((.Values.ozgcloud).feature).organisationsEinheiten "true" }} - - name: ozgcloud_organisationseinheit_zufisearchuri - value: {{ required "ozgcloud.organisationsEinheit.zufiSearchUri must be set if feature organisationsEinheiten is activated" ((.Values.ozgcloud).organisationsEinheit).zufiSearchUri}} + - name: ozgcloud_organisationeinheit_zufisearchuri + value: {{ required "ozgcloud.organisationEinheit.zufiSearchUri must be set if feature organisationsEinheiten is activated" ((.Values.ozgcloud).organisationEinheit).zufiSearchUri}} {{- end }} envFrom: {{- if (.Values.database).useExternal }} diff --git a/src/main/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitProperties.java b/src/main/java/de/ozgcloud/admin/organisationseinheit/OrganisationEinheitProperties.java similarity index 87% rename from src/main/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitProperties.java rename to src/main/java/de/ozgcloud/admin/organisationseinheit/OrganisationEinheitProperties.java index cda6c085bbff016788b37a9e3077bb99507e9585..1cc05b7da91d832c508f2f1f504cfb932dd407e4 100644 --- a/src/main/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitProperties.java +++ b/src/main/java/de/ozgcloud/admin/organisationseinheit/OrganisationEinheitProperties.java @@ -36,11 +36,11 @@ import lombok.Setter; @Setter @Getter @Configuration -@ConfigurationProperties(prefix = OrganisationsEinheitProperties.ORGANISATIONS_EINHEIT_PROPERTIES_PREFIX) +@ConfigurationProperties(prefix = OrganisationEinheitProperties.ORGANISATION_EINHEIT_PROPERTIES_PREFIX) @ConditionalOnProperty(prefix = FeatureToggleProperties.FEATURE_TOGGLE_PREFIX, name = "organisationsEinheiten", havingValue = "true") -class OrganisationsEinheitProperties { +class OrganisationEinheitProperties { - static final String ORGANISATIONS_EINHEIT_PROPERTIES_PREFIX = "ozgcloud.organisations-einheit"; + static final String ORGANISATION_EINHEIT_PROPERTIES_PREFIX = "ozgcloud.organisation-einheit"; /* * Uri pointing to the endpoint in Alfa that searches for Organisationseinheiten diff --git a/src/main/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitRootProcessor.java b/src/main/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitRootProcessor.java index 6265c9696839540ba2d4c3fd9f8b954bd9732027..8e613dda4bb29b3382e1ed2ecf10fa245b64f79a 100644 --- a/src/main/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitRootProcessor.java +++ b/src/main/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitRootProcessor.java @@ -44,23 +44,23 @@ import lombok.RequiredArgsConstructor; @ConditionalOnProperty(prefix = FeatureToggleProperties.FEATURE_TOGGLE_PREFIX, name = "organisations-einheiten", havingValue = "true") class OrganisationsEinheitRootProcessor implements RepresentationModelProcessor<EntityModel<Root>> { - static final String REL_ORGANISATIONS_EINHEITEN = "organisationsEinheiten"; - static final String REL_SEARCH_ORGANISATIONS_EINHEIT = "searchOrganisationsEinheit"; + static final String REL_ORGANISATION_EINHEITEN = "organisationsEinheiten"; + static final String REL_SEARCH_ORGANISATION_EINHEIT = "searchOrganisationEinheit"; - private final OrganisationsEinheitProperties organisationsEinheitProperties; + private final OrganisationEinheitProperties organisationsEinheitProperties; private final CurrentUserService currentUserService; @Override public EntityModel<Root> process(EntityModel<Root> model) { return model.addAllIf(currentUserService.hasRole(UserRole.ADMIN_ADMIN), - () -> List.of(buildGetAllOrganisationsEinheitenLink(), buildSearchOrganisationsEinheitLink())); + () -> List.of(buildGetAllOrganisationEinheitenLink(), buildSearchOrganisationEinheitLink())); } - private Link buildGetAllOrganisationsEinheitenLink() { - return linkTo(methodOn(OrganisationsEinheitController.class).getAll()).withRel(REL_ORGANISATIONS_EINHEITEN); + private Link buildGetAllOrganisationEinheitenLink() { + return linkTo(methodOn(OrganisationsEinheitController.class).getAll()).withRel(REL_ORGANISATION_EINHEITEN); } - private Link buildSearchOrganisationsEinheitLink() { - return Link.of(organisationsEinheitProperties.getZufiSearchUri(), REL_SEARCH_ORGANISATIONS_EINHEIT); + private Link buildSearchOrganisationEinheitLink() { + return Link.of(organisationsEinheitProperties.getZufiSearchUri(), REL_SEARCH_ORGANISATION_EINHEIT); } } diff --git a/src/test/helm/deployment_features_test.yaml b/src/test/helm/deployment_features_test.yaml index 9d32ac541d522ee86aae58ec6da622af76b878b3..d1d562160ef83483e3d37c7f939865b7baac18e2 100644 --- a/src/test/helm/deployment_features_test.yaml +++ b/src/test/helm/deployment_features_test.yaml @@ -60,7 +60,7 @@ tests: postfach: "true" benutzerRollen: "true" organisationsEinheiten: "true" - organisationsEinheit: + organisationEinheit: zufiSearchUri: alfa/zufi/search/endpoint?searchBy={searchBy} asserts: - contains: diff --git a/src/test/helm/deployment_zufi_test.yaml b/src/test/helm/deployment_zufi_test.yaml index 58c8f7a41723ea089fa5e1156ba0a04f92ad0212..e342ff4be91b397f84da64cf8606fc8d99f6e082 100644 --- a/src/test/helm/deployment_zufi_test.yaml +++ b/src/test/helm/deployment_zufi_test.yaml @@ -41,37 +41,37 @@ tests: ozgcloud: feature: organisationsEinheiten: "false" - organisationsEinheit: + organisationEinheit: zufiSearchUri: alfa/zufi/search/endpoint?searchBy={searchBy} asserts: - notContains: path: spec.template.spec.containers[0].env content: - name: ozgcloud_organisationseinheit_zufisearchuri + name: ozgcloud_organisationeinheit_zufisearchuri any: true - it: should not contain zufi search uri if organisationseinheit feature toggle is disabled set: ozgcloud: - organisationsEinheit: + organisationEinheit: zufiSearchUri: alfa/zufi/search/endpoint?searchBy={searchBy} asserts: - notContains: path: spec.template.spec.containers[0].env content: - name: ozgcloud_organisationseinheit_zufisearchuri + name: ozgcloud_organisationeinheit_zufisearchuri any: true - it: should set zufi search uri set: ozgcloud: feature: organisationsEinheiten: "true" - organisationsEinheit: + organisationEinheit: zufiSearchUri: alfa/zufi/search/endpoint?searchBy={searchBy} asserts: - contains: path: spec.template.spec.containers[0].env content: - name: ozgcloud_organisationseinheit_zufisearchuri + name: ozgcloud_organisationeinheit_zufisearchuri value: alfa/zufi/search/endpoint?searchBy={searchBy} - it: should fail if zufi search uri is not set set: @@ -80,4 +80,4 @@ tests: organisationsEinheiten: "true" asserts: - failedTemplate: - errorMessage: "ozgcloud.organisationsEinheit.zufiSearchUri must be set if feature organisationsEinheiten is activated" + errorMessage: "ozgcloud.organisationEinheit.zufiSearchUri must be set if feature organisationsEinheiten is activated" diff --git a/src/test/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitRootProcessorITCase.java b/src/test/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitRootProcessorITCase.java index a36223d955c5d6a3663948c515fdb660a6a220dc..c1cbf97a6669f18cd7f6f22b8bd94a4b126e69bb 100644 --- a/src/test/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitRootProcessorITCase.java +++ b/src/test/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitRootProcessorITCase.java @@ -39,8 +39,9 @@ class OrganisationsEinheitRootProcessorITCase { @Nested @SpringBootTest(properties = { "ozgcloud.feature.organisations-einheiten=true", - "ozgcloud.organisations-einheit.zufi-search-url=foo" + "ozgcloud.organisation-einheit.zufi-search-url=foo" }) + @ITCase class TestFeatureEnabled { @@ -54,10 +55,7 @@ class OrganisationsEinheitRootProcessorITCase { } @Nested - @SpringBootTest(properties = { - "ozgcloud.feature.organisations-einheiten=false", - "ozgcloud.organisations-einheit.zufi-search-url=foo" - }) + @SpringBootTest(properties = { "ozgcloud.feature.organisations-einheiten=false", "ozgcloud.organisation-einheit.zufi-search-url=foo" }) @ITCase class TestFeatureDisabled { diff --git a/src/test/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitRootProcessorTest.java b/src/test/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitRootProcessorTest.java index e697c213b26257d429a2f13a721b74933869ddf6..47323d43651ecfe9be484f7b6c625e8fa68292a2 100644 --- a/src/test/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitRootProcessorTest.java +++ b/src/test/java/de/ozgcloud/admin/organisationseinheit/OrganisationsEinheitRootProcessorTest.java @@ -47,7 +47,7 @@ class OrganisationsEinheitRootProcessorTest { @InjectMocks private OrganisationsEinheitRootProcessor organisationsEinheitRootProcessor; @Mock - private OrganisationsEinheitProperties organisationsEinheitProperties; + private OrganisationEinheitProperties organisationsEinheitProperties; @Mock private CurrentUserService currentUserService; @@ -95,14 +95,14 @@ class OrganisationsEinheitRootProcessorTest { void shouldExist() { var model = processModel(); - assertThat(model.getLink(OrganisationsEinheitRootProcessor.REL_ORGANISATIONS_EINHEITEN)).isNotEmpty(); + assertThat(model.getLink(OrganisationsEinheitRootProcessor.REL_ORGANISATION_EINHEITEN)).isNotEmpty(); } @Test void shouldHaveHref() { var model = processModel(); - assertThat(model.getLink(OrganisationsEinheitRootProcessor.REL_ORGANISATIONS_EINHEITEN)) + assertThat(model.getLink(OrganisationsEinheitRootProcessor.REL_ORGANISATION_EINHEITEN)) .get() .extracting(Link::getHref) .isEqualTo(OrganisationsEinheitController.PATH); @@ -116,7 +116,7 @@ class OrganisationsEinheitRootProcessorTest { void shouldExistsIfFeatureEnabled() { var model = processModel(); - assertThat(model.getLink(OrganisationsEinheitRootProcessor.REL_SEARCH_ORGANISATIONS_EINHEIT)).isNotEmpty(); + assertThat(model.getLink(OrganisationsEinheitRootProcessor.REL_SEARCH_ORGANISATION_EINHEIT)).isNotEmpty(); } @Test @@ -131,7 +131,7 @@ class OrganisationsEinheitRootProcessorTest { void shouldHaveHref() { var model = processModel(); - assertThat(model.getLink(OrganisationsEinheitRootProcessor.REL_SEARCH_ORGANISATIONS_EINHEIT)) + assertThat(model.getLink(OrganisationsEinheitRootProcessor.REL_SEARCH_ORGANISATION_EINHEIT)) .get() .extracting(Link::getHref) .isEqualTo(zufiSearchUri); @@ -141,7 +141,7 @@ class OrganisationsEinheitRootProcessorTest { void shouldBeTemplated() { var model = processModel(); - assertThat(model.getLink(OrganisationsEinheitRootProcessor.REL_SEARCH_ORGANISATIONS_EINHEIT)) + assertThat(model.getLink(OrganisationsEinheitRootProcessor.REL_SEARCH_ORGANISATION_EINHEIT)) .get() .extracting(Link::isTemplated) .isEqualTo(true);