From 97017c1b99837335248b7c2af128d8b33b1ebeb4 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 10 Jul 2025 11:55:53 +0200 Subject: [PATCH] rename package (+schema etc.) credentials to accounts (#185) Co-authored-by: Michael Hoennig Reviewed-on: https://dev.hostsharing.net/hostsharing/hs.hsadmin.ng/pulls/185 Reviewed-by: Timotheus Pokorra --- build.gradle.kts | 8 ++--- ...edentialContextResourceToEntityMapper.java | 4 +-- .../accounts}/HsCredentialsContext.java | 2 +- .../HsCredentialsContextRbacEntity.java | 6 ++-- .../HsCredentialsContextRbacRepository.java | 2 +- .../HsCredentialsContextRealEntity.java | 4 +-- .../HsCredentialsContextRealRepository.java | 2 +- .../HsCredentialsContextsController.java | 6 ++-- .../accounts}/HsCredentialsController.java | 14 ++++---- .../accounts}/HsCredentialsEntity.java | 6 ++-- .../accounts}/HsCredentialsEntityPatcher.java | 4 +-- .../accounts}/HsCredentialsRepository.java | 2 +- .../api-mappings.yaml | 4 +-- .../{credentials => accounts}/api-paths.yaml | 8 ++--- .../{credentials => accounts}/auth.yaml | 0 .../context-schemas.yaml | 0 .../{credentials => accounts}/contexts.yaml | 0 .../credentials-schemas.yaml | 0 .../credentials-with-uuid-used.yaml | 0 .../credentials-with-uuid.yaml | 0 .../credentials.yaml | 2 +- .../error-responses.yaml | 0 ...-office-person-test-data-for-accounts.sql} | 0 .../9500-hs-accounts-schema.sql} | 2 +- .../9510-hs-accounts.sql} | 36 +++++++++---------- .../9513-hs-accounts-context-rbac.md} | 0 .../9519-hs-accounts-test-data.sql} | 22 ++++++------ .../db/changelog/db.changelog-master.yaml | 10 +++--- .../hsadminng/arch/ArchitectureTest.java | 6 ++-- ...sCredentialsContextRbacEntityUnitTest.java | 2 +- ...sContextRbacRepositoryIntegrationTest.java | 4 +-- ...sCredentialsContextRealEntityUnitTest.java | 2 +- ...sContextRealRepositoryIntegrationTest.java | 10 +++--- ...CredentialsContextsControllerRestTest.java | 4 +-- .../HsCredentialsControllerRestTest.java | 4 +-- .../HsCredentialsEntityPatcherUnitTest.java | 6 ++-- ...sCredentialsRepositoryIntegrationTest.java | 8 ++--- .../scenarios/CreateCredentials.java | 8 ++--- .../scenarios/CredentialsScenarioTests.java | 2 +- .../released-prod-schema-with-test-data.sql | 2 +- 40 files changed, 101 insertions(+), 101 deletions(-) rename src/main/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/CredentialContextResourceToEntityMapper.java (95%) rename src/main/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsContext.java (97%) rename src/main/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsContextRbacEntity.java (89%) rename src/main/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsContextRbacRepository.java (94%) rename src/main/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsContextRealEntity.java (85%) rename src/main/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsContextRealRepository.java (94%) rename src/main/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsContextsController.java (85%) rename src/main/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsController.java (93%) rename src/main/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsEntity.java (95%) rename src/main/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsEntityPatcher.java (90%) rename src/main/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsRepository.java (93%) rename src/main/resources/api-definition/{credentials => accounts}/api-mappings.yaml (71%) rename src/main/resources/api-definition/{credentials => accounts}/api-paths.yaml (65%) rename src/main/resources/api-definition/{credentials => accounts}/auth.yaml (100%) rename src/main/resources/api-definition/{credentials => accounts}/context-schemas.yaml (100%) rename src/main/resources/api-definition/{credentials => accounts}/contexts.yaml (100%) rename src/main/resources/api-definition/{credentials => accounts}/credentials-schemas.yaml (100%) rename src/main/resources/api-definition/{credentials => accounts}/credentials-with-uuid-used.yaml (100%) rename src/main/resources/api-definition/{credentials => accounts}/credentials-with-uuid.yaml (100%) rename src/main/resources/api-definition/{credentials => accounts}/credentials.yaml (93%) rename src/main/resources/api-definition/{credentials => accounts}/error-responses.yaml (100%) rename src/main/resources/db/changelog/5-hs-office/502-person/{5028-hs-office-person-test-data-for-credentials.sql => 5028-hs-office-person-test-data-for-accounts.sql} (100%) rename src/main/resources/db/changelog/9-hs-global/{950-credentials/9500-hs-credentials-schema.sql => 950-accounts/9500-hs-accounts-schema.sql} (89%) rename src/main/resources/db/changelog/9-hs-global/{950-credentials/9510-hs-credentials.sql => 950-accounts/9510-hs-accounts.sql} (65%) rename src/main/resources/db/changelog/9-hs-global/{950-credentials/9513-hs-credentials-rbac.md => 950-accounts/9513-hs-accounts-context-rbac.md} (100%) rename src/main/resources/db/changelog/9-hs-global/{950-credentials/9519-hs-credentials-test-data.sql => 950-accounts/9519-hs-accounts-test-data.sql} (74%) rename src/test/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsContextRbacEntityUnitTest.java (91%) rename src/test/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsContextRbacRepositoryIntegrationTest.java (97%) rename src/test/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsContextRealEntityUnitTest.java (91%) rename src/test/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsContextRealRepositoryIntegrationTest.java (92%) rename src/test/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsContextsControllerRestTest.java (97%) rename src/test/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsControllerRestTest.java (97%) rename src/test/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsEntityPatcherUnitTest.java (96%) rename src/test/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/HsCredentialsRepositoryIntegrationTest.java (95%) rename src/test/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/scenarios/CreateCredentials.java (87%) rename src/test/java/net/hostsharing/hsadminng/{credentials => hs/accounts}/scenarios/CredentialsScenarioTests.java (98%) diff --git a/build.gradle.kts b/build.gradle.kts index fe3e294b..985d99de 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -216,11 +216,11 @@ openapiProcessor { targetDir(layout.buildDirectory.dir("generated/sources/openapi-javax").get().asFile.path) } - process("springCredentials") { + process("springAccounts") { processorName("spring") processor("io.openapiprocessor:openapi-processor-spring:2022.5") - apiPath(project.file("src/main/resources/api-definition/credentials/api-paths.yaml").path) - prop("mapping", project.file("src/main/resources/api-definition/credentials/api-mappings.yaml").path) + apiPath(project.file("src/main/resources/api-definition/accounts/api-paths.yaml").path) + prop("mapping", project.file("src/main/resources/api-definition/accounts/api-mappings.yaml").path) prop("showWarnings", true) prop("openApiNullable", true) targetDir(layout.buildDirectory.dir("generated/sources/openapi-javax").get().asFile.path) @@ -245,7 +245,7 @@ val processSpring = tasks.register("processSpring") { "processSpringHsOffice", "processSpringHsBooking", "processSpringHsHosting", - "processSpringCredentials" + "processSpringAccounts" ) } diff --git a/src/main/java/net/hostsharing/hsadminng/credentials/CredentialContextResourceToEntityMapper.java b/src/main/java/net/hostsharing/hsadminng/hs/accounts/CredentialContextResourceToEntityMapper.java similarity index 95% rename from src/main/java/net/hostsharing/hsadminng/credentials/CredentialContextResourceToEntityMapper.java rename to src/main/java/net/hostsharing/hsadminng/hs/accounts/CredentialContextResourceToEntityMapper.java index 6ffeb3ff..cd662752 100644 --- a/src/main/java/net/hostsharing/hsadminng/credentials/CredentialContextResourceToEntityMapper.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/accounts/CredentialContextResourceToEntityMapper.java @@ -1,9 +1,9 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import jakarta.persistence.EntityManager; import jakarta.persistence.EntityNotFoundException; import net.hostsharing.hsadminng.config.MessageTranslator; -import net.hostsharing.hsadminng.credentials.generated.api.v1.model.ContextResource; +import net.hostsharing.hsadminng.accounts.generated.api.v1.model.ContextResource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContext.java b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContext.java similarity index 97% rename from src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContext.java rename to src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContext.java index a18dfb7f..cb6ade77 100644 --- a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContext.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContext.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import jakarta.persistence.Column; import jakarta.persistence.GeneratedValue; diff --git a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRbacEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRbacEntity.java similarity index 89% rename from src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRbacEntity.java rename to src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRbacEntity.java index 6bf67e63..00fc3d70 100644 --- a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRbacEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRbacEntity.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import jakarta.persistence.AttributeOverride; import jakarta.persistence.AttributeOverrides; @@ -24,7 +24,7 @@ import static net.hostsharing.hsadminng.rbac.generator.RbacSpec.WITHOUT_IMPLICIT import static net.hostsharing.hsadminng.rbac.generator.RbacSpec.rbacViewFor; @Entity -@Table(schema = "hs_credentials", name = "context") // TODO_impl: RBAC rules for _rv do not yet work properly +@Table(schema = "hs_accounts", name = "context") // TODO_impl: RBAC rules for _rv do not yet work properly @SuperBuilder(toBuilder = true) @Getter @Setter @@ -50,6 +50,6 @@ public class HsCredentialsContextRbacEntity extends HsCredentialsContext { // TODO_impl: RBAC rules for _rv do not yet work properly (remove the X) public static void mainX(String[] args) throws IOException { - rbacX().generateWithBaseFileName("9-hs-global/950-credentials/9513-hs-credentials-rbac"); + rbacX().generateWithBaseFileName("9-hs-global/950-accounts/9513-hs-credentials-rbac"); } } diff --git a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRbacRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRbacRepository.java similarity index 94% rename from src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRbacRepository.java rename to src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRbacRepository.java index 484e0a5c..c8844cd2 100644 --- a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRbacRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRbacRepository.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import io.micrometer.core.annotation.Timed; import org.springframework.data.repository.Repository; diff --git a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRealEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRealEntity.java similarity index 85% rename from src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRealEntity.java rename to src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRealEntity.java index 192a079f..746bc760 100644 --- a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRealEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRealEntity.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import jakarta.persistence.AttributeOverride; import jakarta.persistence.AttributeOverrides; @@ -11,7 +11,7 @@ import lombok.Setter; import lombok.experimental.SuperBuilder; @Entity -@Table(schema = "hs_credentials", name = "context") +@Table(schema = "hs_accounts", name = "context") @SuperBuilder(toBuilder = true) @Getter @Setter diff --git a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRealRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRealRepository.java similarity index 94% rename from src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRealRepository.java rename to src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRealRepository.java index 842f3040..c335da9e 100644 --- a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRealRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRealRepository.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import io.micrometer.core.annotation.Timed; import org.springframework.data.repository.Repository; diff --git a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextsController.java b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextsController.java similarity index 85% rename from src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextsController.java rename to src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextsController.java index c43ff881..f5ad666f 100644 --- a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextsController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextsController.java @@ -1,12 +1,12 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import java.util.List; import io.micrometer.core.annotation.Timed; import net.hostsharing.hsadminng.config.NoSecurityRequirement; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.credentials.generated.api.v1.api.ContextsApi; -import net.hostsharing.hsadminng.credentials.generated.api.v1.model.ContextResource; +import net.hostsharing.hsadminng.accounts.generated.api.v1.api.ContextsApi; +import net.hostsharing.hsadminng.accounts.generated.api.v1.model.ContextResource; import net.hostsharing.hsadminng.mapper.StrictMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsController.java b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsController.java similarity index 93% rename from src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsController.java rename to src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsController.java index 08a4875e..fb597509 100644 --- a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsController.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import java.time.LocalDateTime; import java.time.ZoneOffset; @@ -10,11 +10,11 @@ import io.micrometer.core.annotation.Timed; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import net.hostsharing.hsadminng.config.MessageTranslator; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.credentials.generated.api.v1.api.CredentialsApi; -import net.hostsharing.hsadminng.credentials.generated.api.v1.model.CredentialsInsertResource; -import net.hostsharing.hsadminng.credentials.generated.api.v1.model.CredentialsPatchResource; -import net.hostsharing.hsadminng.credentials.generated.api.v1.model.CredentialsResource; -import net.hostsharing.hsadminng.credentials.generated.api.v1.model.HsOfficePersonResource; +import net.hostsharing.hsadminng.accounts.generated.api.v1.api.CredentialsApi; +import net.hostsharing.hsadminng.accounts.generated.api.v1.model.CredentialsInsertResource; +import net.hostsharing.hsadminng.accounts.generated.api.v1.model.CredentialsPatchResource; +import net.hostsharing.hsadminng.accounts.generated.api.v1.model.CredentialsResource; +import net.hostsharing.hsadminng.accounts.generated.api.v1.model.HsOfficePersonResource; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRbacRepository; import net.hostsharing.hsadminng.mapper.StrictMapper; import net.hostsharing.hsadminng.persistence.EntityManagerWrapper; @@ -118,7 +118,7 @@ public class HsCredentialsController implements CredentialsApi { // return the new credentials as a resource final var uri = MvcUriComponentsBuilder.fromController(getClass()) - .path("/api/hs/credentials/credentials/{id}") + .path("/api/hs/accounts/credentials/{id}") .buildAndExpand(newCredentialsEntity.getUuid()) .toUri(); final var newCredentialsResource = mapper.map( diff --git a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsEntity.java similarity index 95% rename from src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsEntity.java rename to src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsEntity.java index 8952a247..40215e90 100644 --- a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsEntity.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import jakarta.persistence.*; import lombok.*; @@ -19,7 +19,7 @@ import static jakarta.persistence.CascadeType.REFRESH; import static net.hostsharing.hsadminng.repr.Stringify.stringify; @Entity -@Table(schema = "hs_credentials", name = "credentials") +@Table(schema = "hs_accounts", name = "credentials") @Getter @Setter @Builder @@ -79,7 +79,7 @@ public class HsCredentialsEntity implements BaseEntity, Str @OneToMany(fetch = FetchType.LAZY, cascade = { MERGE, REFRESH }, orphanRemoval = true) @JoinTable( - name = "context_mapping", schema = "hs_credentials", + name = "context_mapping", schema = "hs_accounts", joinColumns = @JoinColumn(name = "credentials_uuid", referencedColumnName = "uuid"), inverseJoinColumns = @JoinColumn(name = "context_uuid", referencedColumnName = "uuid") ) diff --git a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsEntityPatcher.java b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsEntityPatcher.java similarity index 90% rename from src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsEntityPatcher.java rename to src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsEntityPatcher.java index 005c09ac..765e684e 100644 --- a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsEntityPatcher.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsEntityPatcher.java @@ -1,6 +1,6 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; -import net.hostsharing.hsadminng.credentials.generated.api.v1.model.CredentialsPatchResource; +import net.hostsharing.hsadminng.accounts.generated.api.v1.model.CredentialsPatchResource; import net.hostsharing.hsadminng.mapper.EntityPatcher; import net.hostsharing.hsadminng.mapper.OptionalFromJson; diff --git a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsRepository.java similarity index 93% rename from src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsRepository.java rename to src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsRepository.java index 14479e19..85dc445d 100644 --- a/src/main/java/net/hostsharing/hsadminng/credentials/HsCredentialsRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsRepository.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import io.micrometer.core.annotation.Timed; import net.hostsharing.hsadminng.hs.office.person.HsOfficePerson; diff --git a/src/main/resources/api-definition/credentials/api-mappings.yaml b/src/main/resources/api-definition/accounts/api-mappings.yaml similarity index 71% rename from src/main/resources/api-definition/credentials/api-mappings.yaml rename to src/main/resources/api-definition/accounts/api-mappings.yaml index 7785703a..4a0eb2ed 100644 --- a/src/main/resources/api-definition/credentials/api-mappings.yaml +++ b/src/main/resources/api-definition/accounts/api-mappings.yaml @@ -1,7 +1,7 @@ openapi-processor-mapping: v2 options: - package-name: net.hostsharing.hsadminng.credentials.generated.api.v1 + package-name: net.hostsharing.hsadminng.accounts.generated.api.v1 model-name-suffix: Resource bean-validation: true @@ -13,5 +13,5 @@ map: - type: string:uuid => java.util.UUID paths: - /api/hs/credentials/credentials/{credentialsUuid}: + /api/hs/accounts/credentials/{credentialsUuid}: null: org.openapitools.jackson.nullable.JsonNullable diff --git a/src/main/resources/api-definition/credentials/api-paths.yaml b/src/main/resources/api-definition/accounts/api-paths.yaml similarity index 65% rename from src/main/resources/api-definition/credentials/api-paths.yaml rename to src/main/resources/api-definition/accounts/api-paths.yaml index 0d42a123..81f5176d 100644 --- a/src/main/resources/api-definition/credentials/api-paths.yaml +++ b/src/main/resources/api-definition/accounts/api-paths.yaml @@ -10,18 +10,18 @@ paths: # Contexts - /api/hs/credentials/contexts: + /api/hs/accounts/contexts: $ref: "contexts.yaml" # Credentials - /api/hs/credentials/credentials/{credentialsUuid}/used: + /api/hs/accounts/credentials/{credentialsUuid}/used: $ref: "credentials-with-uuid-used.yaml" - /api/hs/credentials/credentials/{credentialsUuid}: + /api/hs/accounts/credentials/{credentialsUuid}: $ref: "credentials-with-uuid.yaml" - /api/hs/credentials/credentials: + /api/hs/accounts/credentials: $ref: "credentials.yaml" diff --git a/src/main/resources/api-definition/credentials/auth.yaml b/src/main/resources/api-definition/accounts/auth.yaml similarity index 100% rename from src/main/resources/api-definition/credentials/auth.yaml rename to src/main/resources/api-definition/accounts/auth.yaml diff --git a/src/main/resources/api-definition/credentials/context-schemas.yaml b/src/main/resources/api-definition/accounts/context-schemas.yaml similarity index 100% rename from src/main/resources/api-definition/credentials/context-schemas.yaml rename to src/main/resources/api-definition/accounts/context-schemas.yaml diff --git a/src/main/resources/api-definition/credentials/contexts.yaml b/src/main/resources/api-definition/accounts/contexts.yaml similarity index 100% rename from src/main/resources/api-definition/credentials/contexts.yaml rename to src/main/resources/api-definition/accounts/contexts.yaml diff --git a/src/main/resources/api-definition/credentials/credentials-schemas.yaml b/src/main/resources/api-definition/accounts/credentials-schemas.yaml similarity index 100% rename from src/main/resources/api-definition/credentials/credentials-schemas.yaml rename to src/main/resources/api-definition/accounts/credentials-schemas.yaml diff --git a/src/main/resources/api-definition/credentials/credentials-with-uuid-used.yaml b/src/main/resources/api-definition/accounts/credentials-with-uuid-used.yaml similarity index 100% rename from src/main/resources/api-definition/credentials/credentials-with-uuid-used.yaml rename to src/main/resources/api-definition/accounts/credentials-with-uuid-used.yaml diff --git a/src/main/resources/api-definition/credentials/credentials-with-uuid.yaml b/src/main/resources/api-definition/accounts/credentials-with-uuid.yaml similarity index 100% rename from src/main/resources/api-definition/credentials/credentials-with-uuid.yaml rename to src/main/resources/api-definition/accounts/credentials-with-uuid.yaml diff --git a/src/main/resources/api-definition/credentials/credentials.yaml b/src/main/resources/api-definition/accounts/credentials.yaml similarity index 93% rename from src/main/resources/api-definition/credentials/credentials.yaml rename to src/main/resources/api-definition/accounts/credentials.yaml index f2f598ba..0c3e0999 100644 --- a/src/main/resources/api-definition/credentials/credentials.yaml +++ b/src/main/resources/api-definition/accounts/credentials.yaml @@ -1,6 +1,6 @@ get: summary: Returns a list of all credentials. - description: Returns the list of all credentials which are visible to the current subject or any of it's assumed roles. + description: Returns the list of all credentials which are visible to the current subject or any of it's assumed roles. tags: - credentials operationId: getListOfCredentialsByPersonUuid diff --git a/src/main/resources/api-definition/credentials/error-responses.yaml b/src/main/resources/api-definition/accounts/error-responses.yaml similarity index 100% rename from src/main/resources/api-definition/credentials/error-responses.yaml rename to src/main/resources/api-definition/accounts/error-responses.yaml diff --git a/src/main/resources/db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data-for-credentials.sql b/src/main/resources/db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data-for-accounts.sql similarity index 100% rename from src/main/resources/db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data-for-credentials.sql rename to src/main/resources/db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data-for-accounts.sql diff --git a/src/main/resources/db/changelog/9-hs-global/950-credentials/9500-hs-credentials-schema.sql b/src/main/resources/db/changelog/9-hs-global/950-accounts/9500-hs-accounts-schema.sql similarity index 89% rename from src/main/resources/db/changelog/9-hs-global/950-credentials/9500-hs-credentials-schema.sql rename to src/main/resources/db/changelog/9-hs-global/950-accounts/9500-hs-accounts-schema.sql index fe79ccaa..ae415fdf 100644 --- a/src/main/resources/db/changelog/9-hs-global/950-credentials/9500-hs-credentials-schema.sql +++ b/src/main/resources/db/changelog/9-hs-global/950-accounts/9500-hs-accounts-schema.sql @@ -4,5 +4,5 @@ -- ============================================================================ --changeset michael.hoennig:hs-credentials-SCHEMA endDelimiter:--// -- ---------------------------------------------------------------------------- -CREATE SCHEMA hs_credentials; +CREATE SCHEMA hs_accounts; --// diff --git a/src/main/resources/db/changelog/9-hs-global/950-credentials/9510-hs-credentials.sql b/src/main/resources/db/changelog/9-hs-global/950-accounts/9510-hs-accounts.sql similarity index 65% rename from src/main/resources/db/changelog/9-hs-global/950-credentials/9510-hs-credentials.sql rename to src/main/resources/db/changelog/9-hs-global/950-accounts/9510-hs-accounts.sql index be615053..2dc10b27 100644 --- a/src/main/resources/db/changelog/9-hs-global/950-credentials/9510-hs-credentials.sql +++ b/src/main/resources/db/changelog/9-hs-global/950-accounts/9510-hs-accounts.sql @@ -5,7 +5,7 @@ --changeset michael.hoennig:hs-credentials-CREDENTIALS-TABLE endDelimiter:--// -- ---------------------------------------------------------------------------- -create table hs_credentials.credentials +create table hs_accounts.credentials ( uuid uuid PRIMARY KEY references rbac.subject (uuid) initially deferred, version int not null default 0, @@ -30,7 +30,7 @@ create table hs_credentials.credentials --changeset michael.hoennig:hs-credentials-context-CONTEXT-TABLE endDelimiter:--// -- ---------------------------------------------------------------------------- -create table hs_credentials.context +create table hs_accounts.context ( uuid uuid PRIMARY KEY, version int not null default 0, @@ -46,47 +46,47 @@ create table hs_credentials.context -- ============================================================================ --changeset michael.hoennig:hs-credentials-CONTEXT-IMMUTABLE-TRIGGER endDelimiter:--// -- ---------------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION hs_credentials.prevent_context_update() +CREATE OR REPLACE FUNCTION hs_accounts.prevent_context_update() RETURNS TRIGGER AS $$ BEGIN - RAISE EXCEPTION 'Updates to hs_credentials.context are not allowed.'; + RAISE EXCEPTION 'Updates to hs_accounts.context are not allowed.'; END; $$ LANGUAGE plpgsql; -- Trigger to enforce immutability CREATE TRIGGER context_immutable_trigger -BEFORE UPDATE ON hs_credentials.context -FOR EACH ROW EXECUTE FUNCTION hs_credentials.prevent_context_update(); +BEFORE UPDATE ON hs_accounts.context +FOR EACH ROW EXECUTE FUNCTION hs_accounts.prevent_context_update(); --// -- ============================================================================ ---changeset michael.hoennig:hs_credentials-CONTEXT-MAPPING endDelimiter:--// +--changeset michael.hoennig:hs_accounts-CONTEXT-MAPPING endDelimiter:--// -- ---------------------------------------------------------------------------- -create table hs_credentials.context_mapping +create table hs_accounts.context_mapping ( uuid uuid PRIMARY KEY DEFAULT uuid_generate_v4(), - credentials_uuid uuid references hs_credentials.credentials(uuid) ON DELETE CASCADE, - context_uuid uuid references hs_credentials.context(uuid) ON DELETE RESTRICT + credentials_uuid uuid references hs_accounts.credentials(uuid) ON DELETE CASCADE, + context_uuid uuid references hs_accounts.context(uuid) ON DELETE RESTRICT ); --// -- ============================================================================ ---changeset michael.hoennig:hs-hs_credentials-JOURNALS endDelimiter:--// +--changeset michael.hoennig:hs-hs_accounts-JOURNALS endDelimiter:--// -- ---------------------------------------------------------------------------- -call base.create_journal('hs_credentials.context_mapping'); -call base.create_journal('hs_credentials.context'); -call base.create_journal('hs_credentials.credentials'); +call base.create_journal('hs_accounts.context_mapping'); +call base.create_journal('hs_accounts.context'); +call base.create_journal('hs_accounts.credentials'); --// -- ============================================================================ ---changeset michael.hoennig:hs_credentials-HISTORICIZATION endDelimiter:--// +--changeset michael.hoennig:hs_accounts-HISTORICIZATION endDelimiter:--// -- ---------------------------------------------------------------------------- -call base.tx_create_historicization('hs_credentials.context_mapping'); -call base.tx_create_historicization('hs_credentials.context'); -call base.tx_create_historicization('hs_credentials.credentials'); +call base.tx_create_historicization('hs_accounts.context_mapping'); +call base.tx_create_historicization('hs_accounts.context'); +call base.tx_create_historicization('hs_accounts.credentials'); --// diff --git a/src/main/resources/db/changelog/9-hs-global/950-credentials/9513-hs-credentials-rbac.md b/src/main/resources/db/changelog/9-hs-global/950-accounts/9513-hs-accounts-context-rbac.md similarity index 100% rename from src/main/resources/db/changelog/9-hs-global/950-credentials/9513-hs-credentials-rbac.md rename to src/main/resources/db/changelog/9-hs-global/950-accounts/9513-hs-accounts-context-rbac.md diff --git a/src/main/resources/db/changelog/9-hs-global/950-credentials/9519-hs-credentials-test-data.sql b/src/main/resources/db/changelog/9-hs-global/950-accounts/9519-hs-accounts-test-data.sql similarity index 74% rename from src/main/resources/db/changelog/9-hs-global/950-credentials/9519-hs-credentials-test-data.sql rename to src/main/resources/db/changelog/9-hs-global/950-accounts/9519-hs-accounts-test-data.sql index 4a1e7342..1fd263ca 100644 --- a/src/main/resources/db/changelog/9-hs-global/950-credentials/9519-hs-credentials-test-data.sql +++ b/src/main/resources/db/changelog/9-hs-global/950-accounts/9519-hs-accounts-test-data.sql @@ -2,7 +2,7 @@ -- ============================================================================ ---changeset michael.hoennig:hs_credentials-credentials-TEST-DATA context:!without-test-data endDelimiter:--// +--changeset michael.hoennig:hs_accounts-credentials-TEST-DATA context:!without-test-data endDelimiter:--// -- ---------------------------------------------------------------------------- do language plpgsql $$ @@ -13,9 +13,9 @@ declare superuserFranSubjectUuid uuid; personFranUuid uuid; - context_HSADMIN_prod hs_credentials.context; - context_SSH_internal hs_credentials.context; - context_MATRIX_internal hs_credentials.context; + context_HSADMIN_prod hs_accounts.context; + context_SSH_internal hs_accounts.context; + context_MATRIX_internal hs_accounts.context; begin call base.defineContext('creating booking-project test-data', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN'); @@ -26,13 +26,13 @@ begin personFranUuid = (SELECT uuid FROM hs_office.person WHERE givenName='Fran'); -- Add test contexts - INSERT INTO hs_credentials.context (uuid, type, qualifier) VALUES + INSERT INTO hs_accounts.context (uuid, type, qualifier) VALUES ('11111111-1111-1111-1111-111111111111', 'HSADMIN', 'prod') RETURNING * INTO context_HSADMIN_prod; - INSERT INTO hs_credentials.context (uuid, type, qualifier) VALUES + INSERT INTO hs_accounts.context (uuid, type, qualifier) VALUES ('22222222-2222-2222-2222-222222222222', 'SSH', 'internal') RETURNING * INTO context_SSH_internal; - INSERT INTO hs_credentials.context (uuid, type, qualifier) VALUES + INSERT INTO hs_accounts.context (uuid, type, qualifier) VALUES ('33333333-3333-3333-3333-333333333333', 'MATRIX', 'internal') RETURNING * INTO context_MATRIX_internal; @@ -47,16 +47,16 @@ begin -- call rbac.grantPermissionToRole( -- rbac.createPermission(context_MATRIX_internal.uuid, 'SELECT'), -- rbac.global_ADMIN()); --- call rbac.grantRoleToRole(hs_credentials.context_REFERRER(context_SSH_internal), rbac.global_ADMIN()); --- call rbac.grantRoleToRole(hs_credentials.context_REFERRER(context_MATRIX_internal), rbac.global_ADMIN()); +-- call rbac.grantRoleToRole(hs_accounts.context_REFERRER(context_SSH_internal), rbac.global_ADMIN()); +-- call rbac.grantRoleToRole(hs_accounts.context_REFERRER(context_MATRIX_internal), rbac.global_ADMIN()); -- Add test credentials (linking to assumed rbac.subject UUIDs) - INSERT INTO hs_credentials.credentials (uuid, version, person_uuid, active, global_uid, global_gid, onboarding_token, totp_secret, phone_password, email_address, sms_number) VALUES + INSERT INTO hs_accounts.credentials (uuid, version, person_uuid, active, global_uid, global_gid, onboarding_token, totp_secret, phone_password, email_address, sms_number) VALUES ( superuserAlexSubjectUuid, 0, personAlexUuid, true, 1001, 1001, 'token-abc', 'otp-secret-1', 'phone-pw-1', 'alex@example.com', '111-222-3333'), ( superuserFranSubjectUuid, 0, personFranUuid, true, 1002, 1002, 'token-def', 'otp-secret-2', 'phone-pw-2', 'fran@example.com', '444-555-6666'); -- Map credentials to contexts - INSERT INTO hs_credentials.context_mapping (credentials_uuid, context_uuid) VALUES + INSERT INTO hs_accounts.context_mapping (credentials_uuid, context_uuid) VALUES (superuserAlexSubjectUuid, '11111111-1111-1111-1111-111111111111'), -- HSADMIN context (superuserFranSubjectUuid, '11111111-1111-1111-1111-111111111111'), -- HSADMIN context (superuserAlexSubjectUuid, '22222222-2222-2222-2222-222222222222'), -- SSH context diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml index eb7f53ca..1e2ea71e 100644 --- a/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/src/main/resources/db/changelog/db.changelog-master.yaml @@ -103,7 +103,7 @@ databaseChangeLog: file: db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data.sql context: "!without-test-data" - include: - file: db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data-for-credentials.sql + file: db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data-for-accounts.sql context: "!without-test-data" - include: file: db/changelog/5-hs-office/503-relation/5030-hs-office-relation.sql @@ -218,16 +218,16 @@ databaseChangeLog: context: "!only-prod-schema" - include: - file: db/changelog/9-hs-global/950-credentials/9500-hs-credentials-schema.sql + file: db/changelog/9-hs-global/950-accounts/9500-hs-accounts-schema.sql context: "!only-prod-schema" - include: - file: db/changelog/9-hs-global/950-credentials/9510-hs-credentials.sql + file: db/changelog/9-hs-global/950-accounts/9510-hs-accounts.sql context: "!only-prod-schema" # TODO_impl: RBAC rules for _rv do not yet work properly # - include: - # file: db/changelog/9-hs-global/950-credentials/9513-hs-credentials-rbac.sql + # file: db/changelog/9-hs-global/950-accounts/9513-hs-accounts-context-rbac.sql - include: - file: db/changelog/9-hs-global/950-credentials/9519-hs-credentials-test-data.sql + file: db/changelog/9-hs-global/950-accounts/9519-hs-accounts-test-data.sql context: "!only-prod-schema and !without-test-data" - include: diff --git a/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java b/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java index cd226a9d..c6b73278 100644 --- a/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java +++ b/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java @@ -49,8 +49,8 @@ public class ArchitectureTest { "..test.pac", "..test.dom", "..context", - "..credentials", - "..credentials.scenarios", + "..accounts", + "..accounts.scenarios", "..hash", "..lambda", "..journal", @@ -176,7 +176,7 @@ public class ArchitectureTest { "..hs.office.(*)..", "..hs.booking.(*)..", "..hs.hosting.(*)..", - "..credentials..", + "..hs.accounts..", "..hs.scenarios", "..hs.migration", "..rbacgrant" // TODO.test: just because of RbacGrantsDiagramServiceIntegrationTest diff --git a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRbacEntityUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRbacEntityUnitTest.java similarity index 91% rename from src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRbacEntityUnitTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRbacEntityUnitTest.java index de87bc42..b0f727e9 100644 --- a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRbacEntityUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRbacEntityUnitTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import org.junit.jupiter.api.Test; diff --git a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRbacRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRbacRepositoryIntegrationTest.java similarity index 97% rename from src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRbacRepositoryIntegrationTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRbacRepositoryIntegrationTest.java index 2927c6e0..428a71e7 100644 --- a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRbacRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRbacRepositoryIntegrationTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.rbac.context.ContextBasedTest; @@ -162,6 +162,6 @@ class HsCredentialsContextRbacRepositoryIntegrationTest extends ContextBasedTest assertThat(exception) .isInstanceOf(PersistenceException.class) .hasCauseInstanceOf(PSQLException.class) - .hasMessageContaining("ERROR: Updates to hs_credentials.context are not allowed."); + .hasMessageContaining("ERROR: Updates to hs_accounts.context are not allowed."); } } diff --git a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRealEntityUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRealEntityUnitTest.java similarity index 91% rename from src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRealEntityUnitTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRealEntityUnitTest.java index a25e6476..e7a87f10 100644 --- a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRealEntityUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRealEntityUnitTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import org.junit.jupiter.api.Test; diff --git a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRealRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRealRepositoryIntegrationTest.java similarity index 92% rename from src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRealRepositoryIntegrationTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRealRepositoryIntegrationTest.java index b363e795..a5b266b7 100644 --- a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextRealRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextRealRepositoryIntegrationTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.rbac.context.ContextBasedTest; @@ -44,7 +44,7 @@ class HsCredentialsContextRealRepositoryIntegrationTest extends ContextBasedTest @Test public void historizationIsAvailable() { // given - final String nativeQuerySql = "select * from hs_credentials.context_hv"; + final String nativeQuerySql = "select * from hs_accounts.context_hv"; // when historicalContext(Timestamp.from(ZonedDateTime.now().minusDays(1).toInstant())); @@ -52,7 +52,7 @@ class HsCredentialsContextRealRepositoryIntegrationTest extends ContextBasedTest final var rowsBefore = query.getResultList(); // then - assertThat(rowsBefore).as("hs_credentials.context_hv only contain no rows for a timestamp before test data creation").hasSize(0); + assertThat(rowsBefore).as("hs_accounts.context_hv only contain no rows for a timestamp before test data creation").hasSize(0); // and when historicalContext(Timestamp.from(ZonedDateTime.now().toInstant())); @@ -60,7 +60,7 @@ class HsCredentialsContextRealRepositoryIntegrationTest extends ContextBasedTest final var rowsAfter = query.getResultList(); // then - assertThat(rowsAfter).as("hs_credentials.context_hv should now contain the test-data rows for the current timestamp").hasSize(3); + assertThat(rowsAfter).as("hs_accounts.context_hv should now contain the test-data rows for the current timestamp").hasSize(3); } @Test @@ -172,6 +172,6 @@ class HsCredentialsContextRealRepositoryIntegrationTest extends ContextBasedTest assertThat(exception) .isInstanceOf(PersistenceException.class) .hasCauseInstanceOf(PSQLException.class) - .hasMessageContaining("ERROR: Updates to hs_credentials.context are not allowed."); + .hasMessageContaining("ERROR: Updates to hs_accounts.context are not allowed."); } } diff --git a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextsControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextsControllerRestTest.java similarity index 97% rename from src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextsControllerRestTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextsControllerRestTest.java index a558f7c3..64bfbf29 100644 --- a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsContextsControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsContextsControllerRestTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import static net.hostsharing.hsadminng.test.JsonMatcher.lenientlyEquals; import static org.mockito.ArgumentMatchers.any; @@ -97,7 +97,7 @@ class HsCredentialsContextsControllerRestTest { // when mockMvc.perform(MockMvcRequestBuilders - .get("/api/hs/credentials/contexts") + .get("/api/hs/accounts/contexts") .header("Authorization", "Bearer superuser-alex@hostsharing.net") .accept(MediaType.APPLICATION_JSON)) .andDo(print()) diff --git a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsControllerRestTest.java similarity index 97% rename from src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsControllerRestTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsControllerRestTest.java index c8e20d2d..14db063e 100644 --- a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsControllerRestTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import net.hostsharing.hsadminng.config.DisableSecurityConfig; import net.hostsharing.hsadminng.config.JsonObjectMapperConfiguration; @@ -97,7 +97,7 @@ class HsCredentialsControllerRestTest { // when mockMvc.perform(MockMvcRequestBuilders - .post("/api/hs/credentials/credentials/%{credentialsUuid}/used" + .post("/api/hs/accounts/credentials/%{credentialsUuid}/used" .replace("%{credentialsUuid}", givenCredentialsUuid.toString())) .header("Authorization", "Bearer superuser-alex@hostsharing.net") .accept(MediaType.APPLICATION_JSON)) diff --git a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsEntityPatcherUnitTest.java similarity index 96% rename from src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsEntityPatcherUnitTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsEntityPatcherUnitTest.java index dbf9f2e7..04697cd5 100644 --- a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsEntityPatcherUnitTest.java @@ -1,8 +1,8 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import net.hostsharing.hsadminng.config.MessageTranslator; -import net.hostsharing.hsadminng.credentials.generated.api.v1.model.ContextResource; -import net.hostsharing.hsadminng.credentials.generated.api.v1.model.CredentialsPatchResource; +import net.hostsharing.hsadminng.accounts.generated.api.v1.model.ContextResource; +import net.hostsharing.hsadminng.accounts.generated.api.v1.model.CredentialsPatchResource; import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInstance; diff --git a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsRepositoryIntegrationTest.java similarity index 95% rename from src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsRepositoryIntegrationTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsRepositoryIntegrationTest.java index 88f88f63..770fe658 100644 --- a/src/test/java/net/hostsharing/hsadminng/credentials/HsCredentialsRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/accounts/HsCredentialsRepositoryIntegrationTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials; +package net.hostsharing.hsadminng.hs.accounts; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRbacEntity; @@ -66,7 +66,7 @@ class HsCredentialsRepositoryIntegrationTest extends ContextBasedTest { @Test public void historizationIsAvailable() { // given - final String nativeQuerySql = "select * from hs_credentials.credentials_hv"; + final String nativeQuerySql = "select * from hs_accounts.credentials_hv"; // when historicalContext(Timestamp.from(ZonedDateTime.now().minusDays(1).toInstant())); @@ -74,7 +74,7 @@ class HsCredentialsRepositoryIntegrationTest extends ContextBasedTest { final var rowsBefore = query.getResultList(); // then - assertThat(rowsBefore).as("hs_credentials.credentials_hv only contain no rows for a timestamp before test data creation").hasSize(0); + assertThat(rowsBefore).as("hs_accounts.credentials_hv only contain no rows for a timestamp before test data creation").hasSize(0); // and when historicalContext(Timestamp.from(ZonedDateTime.now().toInstant())); @@ -82,7 +82,7 @@ class HsCredentialsRepositoryIntegrationTest extends ContextBasedTest { final var rowsAfter = query.getResultList(); // then - assertThat(rowsAfter).as("hs_credentials.credentials_hv should now contain the test-data rows for the current timestamp").hasSize(2); + assertThat(rowsAfter).as("hs_accounts.credentials_hv should now contain the test-data rows for the current timestamp").hasSize(2); } @Test diff --git a/src/test/java/net/hostsharing/hsadminng/credentials/scenarios/CreateCredentials.java b/src/test/java/net/hostsharing/hsadminng/hs/accounts/scenarios/CreateCredentials.java similarity index 87% rename from src/test/java/net/hostsharing/hsadminng/credentials/scenarios/CreateCredentials.java rename to src/test/java/net/hostsharing/hsadminng/hs/accounts/scenarios/CreateCredentials.java index 7886a4e7..d63be776 100644 --- a/src/test/java/net/hostsharing/hsadminng/credentials/scenarios/CreateCredentials.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/accounts/scenarios/CreateCredentials.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials.scenarios; +package net.hostsharing.hsadminng.hs.accounts.scenarios; import io.restassured.http.ContentType; import net.hostsharing.hsadminng.hs.scenarios.ScenarioTest; @@ -28,11 +28,11 @@ public class CreateCredentials extends UseCase { obtain("CredentialsContexts", () -> - httpGet("/api/hs/credentials/contexts").expecting(OK).expecting(JSON) + httpGet("/api/hs/accounts/contexts").expecting(OK).expecting(JSON) ); return obtain("newCredentials", () -> - httpPost("/api/hs/credentials/credentials", usingJsonBody(""" + httpPost("/api/hs/accounts/credentials", usingJsonBody(""" { "person.uuid": ${Person: %{personGivenName} %{personFamilyName}}, "nickname": ${nickname}, @@ -53,7 +53,7 @@ public class CreateCredentials extends UseCase { protected void verify(final UseCase.HttpResponse response) { verify( "Verify the New Credentials", - () -> httpGet("/api/hs/credentials/credentials/%{newCredentials}") + () -> httpGet("/api/hs/accounts/credentials/%{newCredentials}") .expecting(OK).expecting(JSON), path("uuid").contains("%{newCredentials}"), path("nickname").contains("%{nickname}"), diff --git a/src/test/java/net/hostsharing/hsadminng/credentials/scenarios/CredentialsScenarioTests.java b/src/test/java/net/hostsharing/hsadminng/hs/accounts/scenarios/CredentialsScenarioTests.java similarity index 98% rename from src/test/java/net/hostsharing/hsadminng/credentials/scenarios/CredentialsScenarioTests.java rename to src/test/java/net/hostsharing/hsadminng/hs/accounts/scenarios/CredentialsScenarioTests.java index 90d13866..6705e5eb 100644 --- a/src/test/java/net/hostsharing/hsadminng/credentials/scenarios/CredentialsScenarioTests.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/accounts/scenarios/CredentialsScenarioTests.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.credentials.scenarios; +package net.hostsharing.hsadminng.hs.accounts.scenarios; import lombok.SneakyThrows; import net.hostsharing.hsadminng.HsadminNgApplication; diff --git a/src/test/resources/db/released-prod-schema-with-test-data.sql b/src/test/resources/db/released-prod-schema-with-test-data.sql index 943c6772..80d1fbd4 100644 --- a/src/test/resources/db/released-prod-schema-with-test-data.sql +++ b/src/test/resources/db/released-prod-schema-with-test-data.sql @@ -12750,7 +12750,7 @@ INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, ordere INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('rbactest-domain-rbac-update-trigger', 'RolesGrantsAndPermissionsGenerator', 'db/changelog/2-rbactest/203-rbactest-domain/2033-rbactest-domain-rbac.sql', '2025-06-06 10:23:06.53273', 309, 'RERAN', '9:4d2cdd1bc08df6985622d0c5953bf4ba', 'sql', '', NULL, '4.29.2', '!without-test-data', NULL, '9198184942'); INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-contact-rbac-insert-trigger', 'RolesGrantsAndPermissionsGenerator', 'db/changelog/5-hs-office/501-contact/5013-hs-office-contact-rbac.sql', '2025-06-06 10:23:06.581665', 310, 'RERAN', '9:b29cf6087a2225d235637a187b5946c2', 'sql', '', NULL, '4.29.2', NULL, NULL, '9198184942'); INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-person-rbac-insert-trigger', 'RolesGrantsAndPermissionsGenerator', 'db/changelog/5-hs-office/502-person/5023-hs-office-person-rbac.sql', '2025-06-06 10:23:06.611557', 311, 'RERAN', '9:9adfbff372bce3de87410eb7582869f2', 'sql', '', NULL, '4.29.2', NULL, NULL, '9198184942'); -INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-person-TEST-DATA-GENERATION-FOR-CREDENTIALS', 'michael.hoennig', 'db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data-for-credentials.sql', '2025-06-06 10:23:06.727793', 312, 'EXECUTED', '9:cf05c4705d539d4ea7b0199921f8cc78', 'sql', '', NULL, '4.29.2', '!without-test-data AND !without-test-data', NULL, '9198184942'); +INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-person-TEST-DATA-GENERATION-FOR-CREDENTIALS', 'michael.hoennig', 'db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data-for-accounts.sql', '2025-06-06 10:23:06.727793', 312, 'EXECUTED', '9:cf05c4705d539d4ea7b0199921f8cc78', 'sql', '', NULL, '4.29.2', '!without-test-data AND !without-test-data', NULL, '9198184942'); INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-relation-debitor-anchor-CONSTRAINT-BY-TRIGGER', 'marc.sandlus', 'db/changelog/5-hs-office/503-relation/5030-hs-office-relation.sql', '2025-06-06 10:23:06.759158', 313, 'EXECUTED', '9:0623a018f7494b53f87b01d88bc3fa41', 'sql', '', NULL, '4.29.2', NULL, NULL, '9198184942'); INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-relation-rbac-insert-trigger', 'RolesGrantsAndPermissionsGenerator', 'db/changelog/5-hs-office/503-relation/5033-hs-office-relation-rbac.sql', '2025-06-06 10:23:06.7945', 314, 'RERAN', '9:6fc1a046dcd803edfb0ce77cd127b576', 'sql', '', NULL, '4.29.2', NULL, NULL, '9198184942'); INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-relation-rbac-update-trigger', 'RolesGrantsAndPermissionsGenerator', 'db/changelog/5-hs-office/503-relation/5033-hs-office-relation-rbac.sql', '2025-06-06 10:23:06.835025', 315, 'RERAN', '9:6737dfa739a4b9036f3e9e8224019276', 'sql', '', NULL, '4.29.2', NULL, NULL, '9198184942');