From 0c969848b0ed15a5d395bfe2c5326fbc750fc151 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 11 Apr 2024 14:30:27 +0200 Subject: [PATCH] fix ArchitectureTests and remove @Accept --- build.gradle | 2 +- .../errors/ReferenceNotFoundException.java | 4 +- .../hsadminng/rbac/rbacdef/RbacView.java | 51 +++++------- .../test/cust/TestCustomerController.java | 2 +- .../test/cust/TestCustomerEntity.java | 2 +- .../test/cust/TestCustomerRepository.java | 2 +- .../{ => rbac}/test/dom/TestDomainEntity.java | 4 +- .../test/pac/TestPackageController.java | 2 +- .../test/pac/TestPackageEntity.java | 4 +- .../test/pac/TestPackageRepository.java | 2 +- .../hsadminng/arch/ArchitectureTest.java | 80 ++++++++++++------- ...ceBankAccountControllerAcceptanceTest.java | 16 +--- ...eBankAccountRepositoryIntegrationTest.java | 8 +- ...OfficeContactControllerAcceptanceTest.java | 18 +---- .../HsOfficeContactEntityPatcherUnitTest.java | 2 +- ...fficeContactRepositoryIntegrationTest.java | 8 +- ...tsTransactionControllerAcceptanceTest.java | 14 +--- ...opAssetsTransactionControllerRestTest.java | 4 +- ...sTransactionRepositoryIntegrationTest.java | 8 +- ...esTransactionControllerAcceptanceTest.java | 14 +--- ...opSharesTransactionControllerRestTest.java | 4 +- ...sTransactionRepositoryIntegrationTest.java | 8 +- ...OfficeDebitorControllerAcceptanceTest.java | 17 +--- .../HsOfficeDebitorEntityPatcherUnitTest.java | 2 +- ...fficeDebitorRepositoryIntegrationTest.java | 10 +-- ...iceMembershipControllerAcceptanceTest.java | 18 +---- ...OfficeMembershipEntityPatcherUnitTest.java | 2 +- ...ceMembershipRepositoryIntegrationTest.java | 8 +- .../hs/office/migration/ImportOfficeData.java | 4 +- ...OfficePartnerControllerAcceptanceTest.java | 18 +---- ...cePartnerDetailsEntityPatcherUnitTest.java | 2 +- .../HsOfficePartnerEntityPatcherUnitTest.java | 2 +- ...fficePartnerRepositoryIntegrationTest.java | 8 +- ...sOfficePersonControllerAcceptanceTest.java | 18 +---- .../HsOfficePersonEntityPatcherUnitTest.java | 2 +- ...OfficePersonRepositoryIntegrationTest.java | 8 +- ...fficeRelationControllerAcceptanceTest.java | 18 +---- ...HsOfficeRelationEntityPatcherUnitTest.java | 2 +- ...ficeRelationRepositoryIntegrationTest.java | 8 +- ...ceSepaMandateControllerAcceptanceTest.java | 18 +---- ...fficeSepaMandateEntityPatcherUnitTest.java | 2 +- ...eSepaMandateRepositoryIntegrationTest.java | 10 +-- .../{ => rbac}/context/ContextBasedTest.java | 3 +- .../context/ContextIntegrationTests.java | 7 +- .../{ => rbac}/context/ContextUnitTest.java | 3 +- .../HttpServletRequestBodyCacheUnitTest.java | 3 +- .../RbacGrantControllerAcceptanceTest.java | 16 +--- .../RbacGrantRepositoryIntegrationTest.java | 10 +-- ...acGrantsDiagramServiceIntegrationTest.java | 4 +- .../RbacRoleControllerAcceptanceTest.java | 5 -- .../RbacRoleRepositoryIntegrationTest.java | 6 +- .../RbacUserControllerAcceptanceTest.java | 20 +---- .../rbacuser/RbacUserControllerRestTest.java | 2 +- .../RbacUserRepositoryIntegrationTest.java | 8 +- .../{ => hsadminng/rbac}/test/Array.java | 2 +- .../test/ContextBasedTestWithCleanup.java | 7 +- .../{hs/office => rbac}/test/EntityList.java | 2 +- .../rbac}/test/IsValidUuidMatcher.java | 2 +- .../{ => hsadminng/rbac}/test/JpaAttempt.java | 2 +- .../rbac}/test/JsonBuilder.java | 2 +- .../rbac}/test/JsonMatcher.java | 2 +- .../rbac}/test/LocaleUnitTest.java | 2 +- .../rbac}/test/MapperUnitTest.java | 2 +- .../rbac}/test/OptionalFromJsonUnitTest.java | 2 +- .../rbac}/test/PatchUnitTestBase.java | 2 +- .../rbac}/test/StringTemplater.java | 2 +- .../rbac}/test/StringifyUnitTest.java | 2 +- .../{ => rbac}/test/cust/TestCustomer.java | 3 +- .../TestCustomerControllerAcceptanceTest.java | 4 +- .../test/cust/TestCustomerEntityUnitTest.java | 2 +- ...TestCustomerRepositoryIntegrationTest.java | 8 +- .../{ => rbac}/test/pac/TestPackage.java | 6 +- .../TestPackageControllerAcceptanceTest.java | 2 +- .../test/pac/TestPackageEntityUnitTest.java | 2 +- .../TestPackageRepositoryIntegrationTest.java | 6 +- .../java/net/hostsharing/test/Accepts.java | 13 --- 76 files changed, 236 insertions(+), 364 deletions(-) rename src/main/java/net/hostsharing/hsadminng/{ => rbac}/test/cust/TestCustomerController.java (97%) rename src/main/java/net/hostsharing/hsadminng/{ => rbac}/test/cust/TestCustomerEntity.java (97%) rename src/main/java/net/hostsharing/hsadminng/{ => rbac}/test/cust/TestCustomerRepository.java (92%) rename src/main/java/net/hostsharing/hsadminng/{ => rbac}/test/dom/TestDomainEntity.java (95%) rename src/main/java/net/hostsharing/hsadminng/{ => rbac}/test/pac/TestPackageController.java (97%) rename src/main/java/net/hostsharing/hsadminng/{ => rbac}/test/pac/TestPackageEntity.java (95%) rename src/main/java/net/hostsharing/hsadminng/{ => rbac}/test/pac/TestPackageRepository.java (91%) rename src/test/java/net/hostsharing/hsadminng/{ => rbac}/context/ContextBasedTest.java (94%) rename src/test/java/net/hostsharing/hsadminng/{ => rbac}/context/ContextIntegrationTests.java (94%) rename src/test/java/net/hostsharing/hsadminng/{ => rbac}/context/ContextUnitTest.java (98%) rename src/test/java/net/hostsharing/hsadminng/{ => rbac}/context/HttpServletRequestBodyCacheUnitTest.java (96%) rename src/test/java/net/hostsharing/{ => hsadminng/rbac}/test/Array.java (96%) rename src/test/java/net/hostsharing/hsadminng/{hs/office => rbac}/test/ContextBasedTestWithCleanup.java (98%) rename src/test/java/net/hostsharing/hsadminng/{hs/office => rbac}/test/EntityList.java (87%) rename src/test/java/net/hostsharing/{ => hsadminng/rbac}/test/IsValidUuidMatcher.java (97%) rename src/test/java/net/hostsharing/{ => hsadminng/rbac}/test/JpaAttempt.java (99%) rename src/test/java/net/hostsharing/{ => hsadminng/rbac}/test/JsonBuilder.java (97%) rename src/test/java/net/hostsharing/{ => hsadminng/rbac}/test/JsonMatcher.java (97%) rename src/test/java/net/hostsharing/{ => hsadminng/rbac}/test/LocaleUnitTest.java (89%) rename src/test/java/net/hostsharing/{ => hsadminng/rbac}/test/MapperUnitTest.java (99%) rename src/test/java/net/hostsharing/{ => hsadminng/rbac}/test/OptionalFromJsonUnitTest.java (97%) rename src/test/java/net/hostsharing/{ => hsadminng/rbac}/test/PatchUnitTestBase.java (99%) rename src/test/java/net/hostsharing/{ => hsadminng/rbac}/test/StringTemplater.java (94%) rename src/test/java/net/hostsharing/{ => hsadminng/rbac}/test/StringifyUnitTest.java (98%) rename src/test/java/net/hostsharing/hsadminng/{ => rbac}/test/cust/TestCustomer.java (89%) rename src/test/java/net/hostsharing/hsadminng/{ => rbac}/test/cust/TestCustomerControllerAcceptanceTest.java (98%) rename src/test/java/net/hostsharing/hsadminng/{ => rbac}/test/cust/TestCustomerEntityUnitTest.java (97%) rename src/test/java/net/hostsharing/hsadminng/{ => rbac}/test/cust/TestCustomerRepositoryIntegrationTest.java (96%) rename src/test/java/net/hostsharing/hsadminng/{ => rbac}/test/pac/TestPackage.java (75%) rename src/test/java/net/hostsharing/hsadminng/{ => rbac}/test/pac/TestPackageControllerAcceptanceTest.java (99%) rename src/test/java/net/hostsharing/hsadminng/{ => rbac}/test/pac/TestPackageEntityUnitTest.java (98%) rename src/test/java/net/hostsharing/hsadminng/{ => rbac}/test/pac/TestPackageRepositoryIntegrationTest.java (96%) delete mode 100644 src/test/java/net/hostsharing/test/Accepts.java diff --git a/build.gradle b/build.gradle index 88c59050..99c6dbd1 100644 --- a/build.gradle +++ b/build.gradle @@ -69,13 +69,13 @@ dependencies { implementation 'org.modelmapper:modelmapper:3.2.0' implementation 'org.iban4j:iban4j:3.2.7-RELEASE' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.4.0' + implementation 'org.reflections:reflections:0.9.12' compileOnly 'org.projectlombok:lombok' testCompileOnly 'org.projectlombok:lombok' developmentOnly 'org.springframework.boot:spring-boot-devtools' - annotationProcessor 'org.projectlombok:lombok' testAnnotationProcessor 'org.projectlombok:lombok' diff --git a/src/main/java/net/hostsharing/hsadminng/errors/ReferenceNotFoundException.java b/src/main/java/net/hostsharing/hsadminng/errors/ReferenceNotFoundException.java index deeae9f8..7d032d50 100644 --- a/src/main/java/net/hostsharing/hsadminng/errors/ReferenceNotFoundException.java +++ b/src/main/java/net/hostsharing/hsadminng/errors/ReferenceNotFoundException.java @@ -1,14 +1,12 @@ package net.hostsharing.hsadminng.errors; -import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; - import java.util.UUID; public class ReferenceNotFoundException extends RuntimeException { private final Class entityClass; private final UUID uuid; - public ReferenceNotFoundException(final Class entityClass, final UUID uuid, final Throwable exc) { + public ReferenceNotFoundException(final Class entityClass, final UUID uuid, final Throwable exc) { super(exc); this.entityClass = entityClass; this.uuid = uuid; diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/rbacdef/RbacView.java b/src/main/java/net/hostsharing/hsadminng/rbac/rbacdef/RbacView.java index 96843da0..4be78f1f 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/rbacdef/RbacView.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/rbacdef/RbacView.java @@ -2,22 +2,11 @@ package net.hostsharing.hsadminng.rbac.rbacdef; import lombok.EqualsAndHashCode; import lombok.Getter; -import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; -import net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionEntity; -import net.hostsharing.hsadminng.hs.office.coopshares.HsOfficeCoopSharesTransactionEntity; -import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorEntity; -import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity; -import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerDetailsEntity; -import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity; -import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity; -import net.hostsharing.hsadminng.hs.office.sepamandate.HsOfficeSepaMandateEntity; import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; -import net.hostsharing.hsadminng.test.cust.TestCustomerEntity; -import net.hostsharing.hsadminng.test.dom.TestDomainEntity; -import net.hostsharing.hsadminng.test.pac.TestPackageEntity; +import org.reflections.Reflections; +import org.reflections.scanners.TypeAnnotationsScanner; +import jakarta.persistence.Entity; import jakarta.persistence.Table; import jakarta.persistence.Version; import jakarta.validation.constraints.NotNull; @@ -27,7 +16,6 @@ import java.nio.file.Path; import java.util.*; import java.util.function.Consumer; import java.util.stream.Collectors; -import java.util.stream.Stream; import static java.lang.reflect.Modifier.isStatic; import static java.util.Arrays.stream; @@ -1187,25 +1175,24 @@ public class RbacView { } } + public static Set> findRbacEntityClasses(String packageName) { + final var reflections = new Reflections(packageName, TypeAnnotationsScanner.class); + return reflections.getTypesAnnotatedWith(Entity.class).stream() + .filter(c -> stream(c.getInterfaces()).anyMatch(i -> i==RbacObject.class)) + .map(RbacView::castToSubclassOfRbacObject) + .collect(Collectors.toSet()); + } + + @SuppressWarnings("unchecked") + private static Class castToSubclassOfRbacObject(final Class clazz) { + return (Class) clazz; + } + /** * This main method generates the RbacViews (PostgreSQL+diagram) for all given entity classes. */ - public static void main(String[] args) { - Stream.of( - TestCustomerEntity.class, - TestPackageEntity.class, - TestDomainEntity.class, - HsOfficePersonEntity.class, - HsOfficePartnerEntity.class, - HsOfficePartnerDetailsEntity.class, - HsOfficeBankAccountEntity.class, - HsOfficeDebitorEntity.class, - HsOfficeRelationEntity.class, - HsOfficeCoopAssetsTransactionEntity.class, - HsOfficeContactEntity.class, - HsOfficeSepaMandateEntity.class, - HsOfficeCoopSharesTransactionEntity.class, - HsOfficeMembershipEntity.class - ).forEach(RbacView::generateRbacView); + public static void main(String[] args) throws Exception { + findRbacEntityClasses("net.hostsharing.hsadminng") + .forEach(RbacView::generateRbacView); } } diff --git a/src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerController.java b/src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerController.java similarity index 97% rename from src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerController.java rename to src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerController.java index 67607c83..d0ab74bf 100644 --- a/src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerController.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerController.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.test.cust; +package net.hostsharing.hsadminng.rbac.test.cust; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.mapper.Mapper; diff --git a/src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerEntity.java b/src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerEntity.java similarity index 97% rename from src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerEntity.java rename to src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerEntity.java index b962ee79..5fe2aad4 100644 --- a/src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerEntity.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.test.cust; +package net.hostsharing.hsadminng.rbac.test.cust; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerRepository.java b/src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerRepository.java similarity index 92% rename from src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerRepository.java rename to src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerRepository.java index 2dc298ea..773e2acd 100644 --- a/src/main/java/net/hostsharing/hsadminng/test/cust/TestCustomerRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerRepository.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.test.cust; +package net.hostsharing.hsadminng.rbac.test.cust; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; diff --git a/src/main/java/net/hostsharing/hsadminng/test/dom/TestDomainEntity.java b/src/main/java/net/hostsharing/hsadminng/rbac/test/dom/TestDomainEntity.java similarity index 95% rename from src/main/java/net/hostsharing/hsadminng/test/dom/TestDomainEntity.java rename to src/main/java/net/hostsharing/hsadminng/rbac/test/dom/TestDomainEntity.java index b6d659c5..38610de3 100644 --- a/src/main/java/net/hostsharing/hsadminng/test/dom/TestDomainEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/test/dom/TestDomainEntity.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.test.dom; +package net.hostsharing.hsadminng.rbac.test.dom; import lombok.AllArgsConstructor; import lombok.Getter; @@ -7,7 +7,7 @@ import lombok.Setter; import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView.SQL; -import net.hostsharing.hsadminng.test.pac.TestPackageEntity; +import net.hostsharing.hsadminng.rbac.test.pac.TestPackageEntity; import jakarta.persistence.*; import java.io.IOException; diff --git a/src/main/java/net/hostsharing/hsadminng/test/pac/TestPackageController.java b/src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageController.java similarity index 97% rename from src/main/java/net/hostsharing/hsadminng/test/pac/TestPackageController.java rename to src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageController.java index aaa7a9fe..8bb94971 100644 --- a/src/main/java/net/hostsharing/hsadminng/test/pac/TestPackageController.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageController.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.test.pac; +package net.hostsharing.hsadminng.rbac.test.pac; import net.hostsharing.hsadminng.mapper.Mapper; import net.hostsharing.hsadminng.mapper.OptionalFromJson; diff --git a/src/main/java/net/hostsharing/hsadminng/test/pac/TestPackageEntity.java b/src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageEntity.java similarity index 95% rename from src/main/java/net/hostsharing/hsadminng/test/pac/TestPackageEntity.java rename to src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageEntity.java index e8430863..c338e38e 100644 --- a/src/main/java/net/hostsharing/hsadminng/test/pac/TestPackageEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageEntity.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.test.pac; +package net.hostsharing.hsadminng.rbac.test.pac; import lombok.AllArgsConstructor; import lombok.Getter; @@ -7,7 +7,7 @@ import lombok.Setter; import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView.SQL; -import net.hostsharing.hsadminng.test.cust.TestCustomerEntity; +import net.hostsharing.hsadminng.rbac.test.cust.TestCustomerEntity; import jakarta.persistence.*; import java.io.IOException; diff --git a/src/main/java/net/hostsharing/hsadminng/test/pac/TestPackageRepository.java b/src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageRepository.java similarity index 91% rename from src/main/java/net/hostsharing/hsadminng/test/pac/TestPackageRepository.java rename to src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageRepository.java index f8538465..5f4a13e5 100644 --- a/src/main/java/net/hostsharing/hsadminng/test/pac/TestPackageRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageRepository.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.test.pac; +package net.hostsharing.hsadminng.rbac.test.pac; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; diff --git a/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java b/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java index 497c60de..a1ee752a 100644 --- a/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java +++ b/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java @@ -1,17 +1,24 @@ package net.hostsharing.hsadminng.arch; +import com.tngtech.archunit.core.domain.JavaClass; import com.tngtech.archunit.junit.AnalyzeClasses; import com.tngtech.archunit.junit.ArchTest; +import com.tngtech.archunit.lang.ArchCondition; import com.tngtech.archunit.lang.ArchRule; +import com.tngtech.archunit.lang.ConditionEvents; +import com.tngtech.archunit.lang.SimpleConditionEvent; import net.hostsharing.hsadminng.HsadminNgApplication; -import net.hostsharing.test.Accepts; -import org.junit.jupiter.api.Test; -import org.springframework.data.jpa.repository.JpaRepository; +import net.hostsharing.hsadminng.rbac.context.ContextBasedTest; +import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; +import org.springframework.data.repository.Repository; import org.springframework.web.bind.annotation.RestController; +import jakarta.persistence.Table; + import static com.tngtech.archunit.core.domain.JavaModifier.ABSTRACT; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.*; import static com.tngtech.archunit.library.dependencies.SlicesRuleDefinition.slices; +import static java.lang.String.format; @AnalyzeClasses(packages = ArchitectureTest.NET_HOSTSHARING_HSADMINNG) public class ArchitectureTest { @@ -232,20 +239,6 @@ public class ArchitectureTest { .should().onlyBeAccessed().byClassesThat() .resideInAnyPackage("..hs.office.migration.."); - @ArchTest - @SuppressWarnings("unused") - public static final ArchRule acceptsAnnotationOnMethodsRule = methods() - .that().areAnnotatedWith(Accepts.class) - .should().beDeclaredInClassesThat().haveSimpleNameEndingWith("AcceptanceTest") - .orShould().beDeclaredInClassesThat().haveSimpleNameNotContaining("AcceptanceTest$"); - - @ArchTest - @SuppressWarnings("unused") - public static final ArchRule acceptsAnnotationOnClasesRule = classes() - .that().areAnnotatedWith(Accepts.class) - .should().haveSimpleNameEndingWith("AcceptanceTest") - .orShould().haveSimpleNameNotContaining("AcceptanceTest$"); - @ArchTest @SuppressWarnings("unused") public static final ArchRule doNotUseJakartaTransactionAnnotationAtClassLevel = noClasses() @@ -270,18 +263,51 @@ public class ArchitectureTest { org.junit.jupiter.api.Test.class.getName(), org.junit.Test.class.getName())); - @Test - public void everythingShouldBeFreeOfCycles() { - slices().matching("net.hostsharing.hsadminng.(*)..").should().beFreeOfCycles(); - } + @ArchTest + @SuppressWarnings("unused") + static final ArchRule everythingShouldBeFreeOfCycles = + slices().matching("net.hostsharing.hsadminng.(*)..") + .should().beFreeOfCycles() + .ignoreDependency( + ContextBasedTest.class, + net.hostsharing.hsadminng.rbac.rbacgrant.RbacGrantsDiagramService.class); - @Test - public void restControllerNaming() { + + @ArchTest + @SuppressWarnings("unused") + static final ArchRule restControllerNaming = classes().that().areAnnotatedWith(RestController.class).should().haveSimpleNameEndingWith("Controller"); - } - @Test - public void repositoryNaming() { - classes().that().implement(JpaRepository.class).should().haveSimpleNameEndingWith("Repository"); + @ArchTest + @SuppressWarnings("unused") + static final ArchRule repositoryNaming = + classes().that().areAssignableTo(Repository.class).should().haveSimpleNameEndingWith("Repository"); + + @ArchTest + @SuppressWarnings("unused") + static final ArchRule tableNamesOfRbacEntitiesShouldEndWith_rv = + classes() + .that().areAnnotatedWith(Table.class) + .and().areAssignableTo(RbacObject.class) + .should(haveTableNameEndingWith_rv()) + .because("it's required that the table names of RBAC entities end with '_rv'"); + + static ArchCondition haveTableNameEndingWith_rv() { + return new ArchCondition<>("RBAC table name end with _rv") { + + @Override + public void check(JavaClass javaClass, ConditionEvents events) { + final var table = javaClass.getAnnotationOfType(Table.class); + if (table == null) { + events.add(SimpleConditionEvent.violated(javaClass, + format("@Table annotation missing for RBAC entity %s", + javaClass.getName(), table.name()))); + } else if (!table.name().endsWith("_rv")) { + events.add(SimpleConditionEvent.violated(javaClass, + format("Table name of %s does not end with '_rv' for RBAC entity %s", + javaClass.getName(), table.name()))); + } + } + }; } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountControllerAcceptanceTest.java index 28f2a156..c24a88d3 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountControllerAcceptanceTest.java @@ -4,9 +4,8 @@ import io.restassured.RestAssured; import io.restassured.http.ContentType; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; -import net.hostsharing.test.Accepts; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.apache.commons.lang3.RandomStringUtils; import org.json.JSONException; import org.junit.jupiter.api.*; @@ -19,8 +18,8 @@ import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; import java.util.UUID; -import static net.hostsharing.test.IsValidUuidMatcher.isUuidValid; -import static net.hostsharing.test.JsonMatcher.lenientlyEquals; +import static net.hostsharing.hsadminng.rbac.test.IsValidUuidMatcher.isUuidValid; +import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.startsWith; @@ -48,7 +47,6 @@ class HsOfficeBankAccountControllerAcceptanceTest extends ContextBasedTestWithCl EntityManager em; @Nested - @Accepts({ "bankaccount:F(Find)" }) class ListBankAccounts { @Test @@ -113,7 +111,6 @@ class HsOfficeBankAccountControllerAcceptanceTest extends ContextBasedTestWithCl } @Nested - @Accepts({ "bankaccount:C(Create)" }) class CreateBankAccount { @Test @@ -153,7 +150,6 @@ class HsOfficeBankAccountControllerAcceptanceTest extends ContextBasedTestWithCl } @Nested - @Accepts({ "bankaccount:R(Read)" }) class GetBankAccount { @Test @@ -178,7 +174,6 @@ class HsOfficeBankAccountControllerAcceptanceTest extends ContextBasedTestWithCl } @Test - @Accepts({ "bankaccount:X(Access Control)" }) void normalUser_canNotGetUnrelatedBankAccount() { context.define("superuser-alex@hostsharing.net"); final var givenBankAccountUuid = bankAccountRepo.findByOptionalHolderLike("first").get(0).getUuid(); @@ -258,7 +253,6 @@ class HsOfficeBankAccountControllerAcceptanceTest extends ContextBasedTestWithCl } @Nested - @Accepts({ "bankaccount:D(Delete)" }) class DeleteBankAccount { @Test @@ -280,7 +274,6 @@ class HsOfficeBankAccountControllerAcceptanceTest extends ContextBasedTestWithCl } @Test - @Accepts({ "bankaccount:X(Access Control)" }) void bankaccountOwner_canDeleteRelatedBankAaccount() { final var givenBankAccount = givenSomeTemporaryBankAccountCreatedBy("selfregistered-test-user@hostsharing.org"); @@ -298,7 +291,6 @@ class HsOfficeBankAccountControllerAcceptanceTest extends ContextBasedTestWithCl } @Test - @Accepts({ "bankaccount:X(Access Control)" }) void normalUser_canNotDeleteUnrelatedBankAccount() { context.define("superuser-alex@hostsharing.net"); final var givenBankAccount = givenSomeTemporaryBankAccountCreatedBy("selfregistered-test-user@hostsharing.org"); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountRepositoryIntegrationTest.java index f0541813..a904ee9f 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountRepositoryIntegrationTest.java @@ -1,11 +1,11 @@ package net.hostsharing.hsadminng.hs.office.bankaccount; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository; import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository; -import net.hostsharing.test.Array; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.Array; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.apache.commons.lang3.RandomStringUtils; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -24,7 +24,7 @@ import java.util.function.Supplier; import static net.hostsharing.hsadminng.hs.office.bankaccount.TestHsOfficeBankAccount.hsOfficeBankAccount; import static net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantEntity.distinctGrantDisplaysOf; import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleEntity.distinctRoleNamesOf; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactControllerAcceptanceTest.java index a1ecda9c..c7833c9c 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactControllerAcceptanceTest.java @@ -4,9 +4,8 @@ import io.restassured.RestAssured; import io.restassured.http.ContentType; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; -import net.hostsharing.test.Accepts; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.apache.commons.lang3.RandomStringUtils; import org.json.JSONException; import org.junit.jupiter.api.AfterEach; @@ -22,8 +21,8 @@ import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; import java.util.UUID; -import static net.hostsharing.test.IsValidUuidMatcher.isUuidValid; -import static net.hostsharing.test.JsonMatcher.lenientlyEquals; +import static net.hostsharing.hsadminng.rbac.test.IsValidUuidMatcher.isUuidValid; +import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.startsWith; @@ -54,7 +53,6 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu EntityManager em; @Nested - @Accepts({ "Contact:F(Find)" }) class ListContacts { @Test @@ -91,7 +89,6 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Nested - @Accepts({ "Contact:C(Create)" }) class AddContact { @Test @@ -129,7 +126,6 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Nested - @Accepts({ "Contact:R(Read)" }) class GetContact { @Test @@ -154,7 +150,6 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Test - @Accepts({ "Contact:X(Access Control)" }) void normalUser_canNotGetUnrelatedContact() { context.define("superuser-alex@hostsharing.net"); final var givenContactUuid = contactRepo.findContactByOptionalLabelLike("first").get(0).getUuid(); @@ -170,7 +165,6 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Test - @Accepts({ "Contact:X(Access Control)" }) void contactAdminUser_canGetRelatedContact() { context.define("superuser-alex@hostsharing.net"); final var givenContactUuid = contactRepo.findContactByOptionalLabelLike("first").get(0).getUuid(); @@ -195,7 +189,6 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Nested - @Accepts({ "Contact:U(Update)" }) class PatchContact { @Test @@ -284,7 +277,6 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Nested - @Accepts({ "Contact:D(Delete)" }) class DeleteContact { @Test @@ -306,7 +298,6 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Test - @Accepts({ "Contact:X(Access Control)" }) void contactOwner_canDeleteRelatedContact() { final var givenContact = givenSomeTemporaryContactCreatedBy("selfregistered-test-user@hostsharing.org"); @@ -324,7 +315,6 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Test - @Accepts({ "Contact:X(Access Control)" }) void normalUser_canNotDeleteUnrelatedContact() { context.define("superuser-alex@hostsharing.net"); final var givenContact = givenSomeTemporaryContactCreatedBy("selfregistered-test-user@hostsharing.org"); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactEntityPatcherUnitTest.java index f8a45070..31a5ca02 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactEntityPatcherUnitTest.java @@ -1,6 +1,6 @@ package net.hostsharing.hsadminng.hs.office.contact; -import net.hostsharing.test.PatchUnitTestBase; +import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeContactPatchResource; import org.junit.jupiter.api.TestInstance; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRepositoryIntegrationTest.java index 3187a4f4..f7f1de38 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRepositoryIntegrationTest.java @@ -1,11 +1,11 @@ package net.hostsharing.hsadminng.hs.office.contact; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository; import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository; -import net.hostsharing.test.Array; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.Array; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.apache.commons.lang3.RandomStringUtils; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -24,7 +24,7 @@ import java.util.function.Supplier; import static net.hostsharing.hsadminng.hs.office.contact.TestHsOfficeContact.hsOfficeContact; import static net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantEntity.distinctGrantDisplaysOf; import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleEntity.distinctRoleNamesOf; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerAcceptanceTest.java index b3b0517d..1f2e4f03 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerAcceptanceTest.java @@ -5,9 +5,8 @@ import io.restassured.http.ContentType; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipRepository; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; -import net.hostsharing.test.Accepts; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; @@ -24,8 +23,8 @@ import java.time.LocalDate; import java.util.UUID; import static net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionType.DEPOSIT; -import static net.hostsharing.test.IsValidUuidMatcher.isUuidValid; -import static net.hostsharing.test.JsonMatcher.lenientlyEquals; +import static net.hostsharing.hsadminng.rbac.test.IsValidUuidMatcher.isUuidValid; +import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.startsWith; @@ -56,7 +55,6 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest extends ContextBased EntityManager em; @Nested - @Accepts({ "CoopAssetsTransaction:F(Find)" }) class ListCoopAssetsTransactions { @Test @@ -154,7 +152,6 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest extends ContextBased } @Nested - @Accepts({ "CoopAssetsTransaction:C(Create)" }) class AddCoopAssetsTransaction { @Test @@ -307,7 +304,6 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest extends ContextBased } @Nested - @Accepts({ "CoopAssetTransaction:R(Read)" }) class GetCoopAssetTransaction { @Test @@ -334,7 +330,6 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest extends ContextBased } @Test - @Accepts({ "CoopAssetTransaction:X(Access Control)" }) void normalUser_canNotGetUnrelatedCoopAssetTransaction() { context.define("superuser-alex@hostsharing.net"); final var givenCoopAssetTransactionUuid = coopAssetsTransactionRepo.findCoopAssetsTransactionByOptionalMembershipUuidAndDateRange( @@ -352,7 +347,6 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest extends ContextBased } @Test - @Accepts({ "CoopAssetTransaction:X(Access Control)" }) void partnerPersonUser_canGetRelatedCoopAssetTransaction() { context.define("superuser-alex@hostsharing.net"); final var givenCoopAssetTransactionUuid = coopAssetsTransactionRepo.findCoopAssetsTransactionByOptionalMembershipUuidAndDateRange( diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java index 043404dd..0d33bf85 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java @@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.office.coopassets; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.mapper.Mapper; -import net.hostsharing.test.JsonBuilder; +import net.hostsharing.hsadminng.rbac.test.JsonBuilder; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; import org.springframework.beans.factory.annotation.Autowired; @@ -15,7 +15,7 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import java.util.UUID; import java.util.function.Function; -import static net.hostsharing.test.JsonBuilder.jsonObject; +import static net.hostsharing.hsadminng.rbac.test.JsonBuilder.jsonObject; import static org.hamcrest.Matchers.is; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java index 44adc58b..590ee6dc 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java @@ -2,11 +2,11 @@ package net.hostsharing.hsadminng.hs.office.coopassets; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipRepository; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository; import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository; -import net.hostsharing.test.Array; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.Array; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; @@ -26,7 +26,7 @@ import java.util.List; import static net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantEntity.distinctGrantDisplaysOf; import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleEntity.distinctRoleNamesOf; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerAcceptanceTest.java index d6291512..24828233 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerAcceptanceTest.java @@ -5,9 +5,8 @@ import io.restassured.http.ContentType; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipRepository; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; -import net.hostsharing.test.Accepts; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; @@ -22,8 +21,8 @@ import jakarta.persistence.PersistenceContext; import java.time.LocalDate; import java.util.UUID; -import static net.hostsharing.test.IsValidUuidMatcher.isUuidValid; -import static net.hostsharing.test.JsonMatcher.lenientlyEquals; +import static net.hostsharing.hsadminng.rbac.test.IsValidUuidMatcher.isUuidValid; +import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.startsWith; @@ -62,7 +61,6 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest extends ContextBased } @Nested - @Accepts({"CoopSharesTransaction:F(Find)"}) class ListCoopSharesTransactions { @Test @@ -129,7 +127,6 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest extends ContextBased } @Nested - @Accepts({"CoopSharesTransaction:C(Create)"}) class AddCoopSharesTransaction { @Test @@ -190,7 +187,6 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest extends ContextBased } @Nested - @Accepts({"CoopShareTransaction:R(Read)"}) class GetCoopShareTransaction { @Test @@ -207,7 +203,6 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest extends ContextBased } @Test - @Accepts({"CoopShareTransaction:X(Access Control)"}) void normalUser_canNotGetUnrelatedCoopShareTransaction() { context.define("superuser-alex@hostsharing.net"); final var givenCoopShareTransactionUuid = coopSharesTransactionRepo.findCoopSharesTransactionByOptionalMembershipUuidAndDateRange(null, LocalDate.of(2010, 3, 15), LocalDate.of(2010, 3, 15)).get(0).getUuid(); @@ -217,7 +212,6 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest extends ContextBased } @Test - @Accepts({"CoopShareTransaction:X(Access Control)"}) void partnerPersonUser_canGetRelatedCoopShareTransaction() { context.define("superuser-alex@hostsharing.net"); final var givenCoopShareTransactionUuid = coopSharesTransactionRepo.findCoopSharesTransactionByOptionalMembershipUuidAndDateRange(null, LocalDate.of(2010, 3, 15), LocalDate.of(2010, 3, 15)).get(0).getUuid(); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerRestTest.java index c1b4307b..fec88cb0 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerRestTest.java @@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.office.coopshares; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.mapper.Mapper; -import net.hostsharing.test.JsonBuilder; +import net.hostsharing.hsadminng.rbac.test.JsonBuilder; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; import org.springframework.beans.factory.annotation.Autowired; @@ -15,7 +15,7 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import java.util.UUID; import java.util.function.Function; -import static net.hostsharing.test.JsonBuilder.jsonObject; +import static net.hostsharing.hsadminng.rbac.test.JsonBuilder.jsonObject; import static org.hamcrest.Matchers.is; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionRepositoryIntegrationTest.java index eff83079..546ef8ef 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionRepositoryIntegrationTest.java @@ -2,11 +2,11 @@ package net.hostsharing.hsadminng.hs.office.coopshares; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipRepository; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository; import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository; -import net.hostsharing.test.Array; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.Array; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; @@ -25,7 +25,7 @@ import java.util.List; import static net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantEntity.distinctGrantDisplaysOf; import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleEntity.distinctRoleNamesOf; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorControllerAcceptanceTest.java index 07ecb5f5..9b3638c4 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorControllerAcceptanceTest.java @@ -10,9 +10,8 @@ import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRepository; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRepository; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; -import net.hostsharing.test.Accepts; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.json.JSONException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -28,8 +27,8 @@ import jakarta.persistence.PersistenceContext; import java.util.UUID; import static net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType.DEBITOR; -import static net.hostsharing.test.IsValidUuidMatcher.isUuidValid; -import static net.hostsharing.test.JsonMatcher.lenientlyEquals; +import static net.hostsharing.hsadminng.rbac.test.IsValidUuidMatcher.isUuidValid; +import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.*; @@ -74,7 +73,6 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu EntityManager em; @Nested - @Accepts({ "Debitor:F(Find)" }) class ListDebitors { @Test @@ -434,7 +432,6 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Nested - @Accepts({ "Debitor:R(Read)" }) class GetDebitor { @Test @@ -499,7 +496,6 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Test - @Accepts({ "Debitor:X(Access Control)" }) void normalUser_canNotGetUnrelatedDebitor() { context.define("superuser-alex@hostsharing.net"); final var givenDebitorUuid = debitorRepo.findDebitorByOptionalNameLike("First").get(0).getUuid(); @@ -515,7 +511,6 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Test - @Accepts({ "Debitor:X(Access Control)" }) void contactAdminUser_canGetRelatedDebitorExceptRefundBankAccount() { context.define("superuser-alex@hostsharing.net"); final var givenDebitorUuid = debitorRepo.findDebitorByOptionalNameLike("first contact").get(0).getUuid(); @@ -541,7 +536,6 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Nested - @Accepts({ "Debitor:U(Update)" }) class PatchDebitor { @Test @@ -654,7 +648,6 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Nested - @Accepts({ "Debitor:D(Delete)" }) class DeleteDebitor { @Test @@ -676,7 +669,6 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Test - @Accepts({ "Debitor:X(Access Control)" }) void contactAdminUser_canNotDeleteRelatedDebitor() { context.define("superuser-alex@hostsharing.net"); final var givenDebitor = givenSomeTemporaryDebitor(); @@ -696,7 +688,6 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Test - @Accepts({ "Debitor:X(Access Control)" }) void normalUser_canNotDeleteUnrelatedDebitor() { context.define("superuser-alex@hostsharing.net"); final var givenDebitor = givenSomeTemporaryDebitor(); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityPatcherUnitTest.java index 4d826224..82e4d303 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityPatcherUnitTest.java @@ -3,7 +3,7 @@ package net.hostsharing.hsadminng.hs.office.debitor; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeDebitorPatchResource; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity; -import net.hostsharing.test.PatchUnitTestBase; +import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java index 3a4d4e16..5224d6e9 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java @@ -7,12 +7,12 @@ import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRepository; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository; import net.hostsharing.hsadminng.rbac.rbacgrant.RbacGrantsDiagramService; import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository; -import net.hostsharing.test.Array; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.Array; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.hibernate.Hibernate; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Nested; @@ -33,10 +33,10 @@ import jakarta.servlet.http.HttpServletRequest; import java.util.Arrays; import java.util.List; -import static net.hostsharing.hsadminng.hs.office.test.EntityList.one; +import static net.hostsharing.hsadminng.rbac.test.EntityList.one; import static net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantEntity.distinctGrantDisplaysOf; import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleEntity.distinctRoleNamesOf; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerAcceptanceTest.java index 083eb5e0..f0e108dc 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerAcceptanceTest.java @@ -6,9 +6,8 @@ import io.restassured.http.ContentType; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRepository; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; -import net.hostsharing.test.Accepts; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.json.JSONException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Nested; @@ -25,8 +24,8 @@ import java.util.UUID; import static net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipStatus.ACTIVE; import static net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipStatus.CANCELLED; -import static net.hostsharing.test.IsValidUuidMatcher.isUuidValid; -import static net.hostsharing.test.JsonMatcher.lenientlyEquals; +import static net.hostsharing.hsadminng.rbac.test.IsValidUuidMatcher.isUuidValid; +import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.*; @@ -61,7 +60,6 @@ class HsOfficeMembershipControllerAcceptanceTest extends ContextBasedTestWithCle EntityManager em; @Nested - @Accepts({ "Membership:F(Find)" }) class ListMemberships { @Test @@ -168,7 +166,6 @@ class HsOfficeMembershipControllerAcceptanceTest extends ContextBasedTestWithCle } @Nested - @Accepts({ "Membership:C(Create)" }) class AddMembership { @Test @@ -215,7 +212,6 @@ class HsOfficeMembershipControllerAcceptanceTest extends ContextBasedTestWithCle } @Nested - @Accepts({ "Membership:R(Read)" }) class GetMembership { @Test @@ -245,7 +241,6 @@ class HsOfficeMembershipControllerAcceptanceTest extends ContextBasedTestWithCle } @Test - @Accepts({ "Membership:X(Access Control)" }) void normalUser_canNotGetUnrelatedMembership() { context.define("superuser-alex@hostsharing.net"); final var givenMembershipUuid = membershipRepo.findMembershipByMemberNumber(1000101).getUuid(); @@ -261,7 +256,6 @@ class HsOfficeMembershipControllerAcceptanceTest extends ContextBasedTestWithCle } @Test - @Accepts({ "Membership:X(Access Control)" }) void parnerRelAgent_canGetRelatedMembership() { context.define("superuser-alex@hostsharing.net"); final var givenMembershipUuid = membershipRepo.findMembershipByMemberNumber(1000303).getUuid(); @@ -290,7 +284,6 @@ class HsOfficeMembershipControllerAcceptanceTest extends ContextBasedTestWithCle } @Nested - @Accepts({ "Membership:U(Update)" }) class PatchMembership { @Test @@ -371,7 +364,6 @@ class HsOfficeMembershipControllerAcceptanceTest extends ContextBasedTestWithCle } @Nested - @Accepts({ "Membership:D(Delete)" }) class DeleteMembership { @Test @@ -393,7 +385,6 @@ class HsOfficeMembershipControllerAcceptanceTest extends ContextBasedTestWithCle } @Test - @Accepts({ "Membership:X(Access Control)" }) void partnerAgentUser_canNotDeleteRelatedMembership() { context.define("superuser-alex@hostsharing.net"); final var givenMembership = givenSomeTemporaryMembershipBessler("First"); @@ -413,7 +404,6 @@ class HsOfficeMembershipControllerAcceptanceTest extends ContextBasedTestWithCle } @Test - @Accepts({ "Membership:X(Access Control)" }) void normalUser_canNotDeleteUnrelatedMembership() { context.define("superuser-alex@hostsharing.net"); final var givenMembership = givenSomeTemporaryMembershipBessler("First"); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcherUnitTest.java index 01bc770a..2e739e7f 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcherUnitTest.java @@ -5,7 +5,7 @@ import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorEntity; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipPatchResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipStatusResource; import net.hostsharing.hsadminng.mapper.Mapper; -import net.hostsharing.test.PatchUnitTestBase; +import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepositoryIntegrationTest.java index 77c2bdac..1cba78da 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepositoryIntegrationTest.java @@ -4,11 +4,11 @@ import io.hypersistence.utils.hibernate.type.range.Range; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorRepository; import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRepository; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository; import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository; -import net.hostsharing.test.Array; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.Array; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -26,7 +26,7 @@ import java.util.List; import static net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantEntity.distinctGrantDisplaysOf; import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleEntity.distinctRoleNamesOf; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeData.java b/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeData.java index 9c248839..1ee34a97 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeData.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeData.java @@ -4,7 +4,7 @@ import com.opencsv.CSVParserBuilder; import com.opencsv.CSVReader; import com.opencsv.CSVReaderBuilder; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.context.ContextBasedTest; +import net.hostsharing.hsadminng.rbac.context.ContextBasedTest; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionEntity; @@ -22,7 +22,7 @@ import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; import net.hostsharing.hsadminng.hs.office.sepamandate.HsOfficeSepaMandateEntity; import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.*; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerAcceptanceTest.java index cc18943e..9340db3a 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerAcceptanceTest.java @@ -10,9 +10,8 @@ import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRepository; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; -import net.hostsharing.test.Accepts; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -22,8 +21,8 @@ import org.springframework.transaction.annotation.Transactional; import java.util.UUID; import static net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType.EX_PARTNER; -import static net.hostsharing.test.IsValidUuidMatcher.isUuidValid; -import static net.hostsharing.test.JsonMatcher.lenientlyEquals; +import static net.hostsharing.hsadminng.rbac.test.IsValidUuidMatcher.isUuidValid; +import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.*; @@ -54,7 +53,6 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu JpaAttempt jpaAttempt; @Nested - @Accepts({ "Partner:F(Find)" }) @Transactional class ListPartners { @@ -84,7 +82,6 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Nested - @Accepts({ "Partner:C(Create)" }) @Transactional class AddPartner { @@ -226,7 +223,6 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Nested - @Accepts({ "Partner:R(Read)" }) @Transactional class GetPartner { @@ -264,7 +260,6 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Test - @Accepts({ "Partner:X(Access Control)" }) void normalUser_canNotGetUnrelatedPartner() { context.define("superuser-alex@hostsharing.net"); final var givenPartnerUuid = partnerRepo.findPartnerByOptionalNameLike("First").get(0).getUuid(); @@ -280,7 +275,6 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Test - @Accepts({ "Partner:X(Access Control)" }) void contactAdminUser_canGetRelatedPartner() { context.define("superuser-alex@hostsharing.net"); final var givenPartnerUuid = partnerRepo.findPartnerByOptionalNameLike("first contact").get(0).getUuid(); @@ -306,7 +300,6 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Nested - @Accepts({ "Partner:U(Update)" }) @Transactional class PatchPartner { @@ -462,7 +455,6 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Nested - @Accepts({ "Partner:D(Delete)" }) @Transactional class DeletePartner { @@ -486,7 +478,6 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Test - @Accepts({ "Partner:X(Access Control)" }) void contactAdminUser_canNotDeleteRelatedPartner() { context.define("superuser-alex@hostsharing.net"); final var givenPartner = givenSomeTemporaryPartnerBessler(20014); @@ -506,7 +497,6 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu } @Test - @Accepts({ "Partner:X(Access Control)" }) void normalUser_canNotDeleteUnrelatedPartner() { context.define("superuser-alex@hostsharing.net"); final var givenPartner = givenSomeTemporaryPartnerBessler(20015); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerDetailsEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerDetailsEntityPatcherUnitTest.java index 4f55d90b..10cb6016 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerDetailsEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerDetailsEntityPatcherUnitTest.java @@ -3,7 +3,7 @@ package net.hostsharing.hsadminng.hs.office.partner; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerDetailsPatchResource; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; -import net.hostsharing.test.PatchUnitTestBase; +import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityPatcherUnitTest.java index 7f350649..6cc072b3 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityPatcherUnitTest.java @@ -4,7 +4,7 @@ import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerPatchResource; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity; -import net.hostsharing.test.PatchUnitTestBase; +import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRepositoryIntegrationTest.java index c1d3fbc3..c436e34a 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRepositoryIntegrationTest.java @@ -6,11 +6,11 @@ import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRepository; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository; import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacObjectRepository; import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -30,8 +30,8 @@ import java.util.Objects; import static net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantEntity.distinctGrantDisplaysOf; import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacObjectEntity.objectDisplaysOf; import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleEntity.distinctRoleNamesOf; -import static net.hostsharing.test.Array.from; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.Array.from; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonControllerAcceptanceTest.java index 072df1a7..b193e97c 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonControllerAcceptanceTest.java @@ -4,9 +4,8 @@ import io.restassured.RestAssured; import io.restassured.http.ContentType; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; -import net.hostsharing.test.Accepts; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.apache.commons.lang3.RandomStringUtils; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Nested; @@ -20,8 +19,8 @@ import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; import java.util.UUID; -import static net.hostsharing.test.IsValidUuidMatcher.isUuidValid; -import static net.hostsharing.test.JsonMatcher.lenientlyEquals; +import static net.hostsharing.hsadminng.rbac.test.IsValidUuidMatcher.isUuidValid; +import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.*; @@ -50,7 +49,6 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup EntityManager em; @Nested - @Accepts({ "Person:F(Find)" }) class ListPersons { @Test @@ -71,7 +69,6 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup } @Nested - @Accepts({ "Person:C(Create)" }) class AddPerson { @Test @@ -109,7 +106,6 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup } @Nested - @Accepts({ "Person:R(Read)" }) @Transactional class GetPerson { @@ -135,7 +131,6 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup } @Test - @Accepts({ "Person:X(Access Control)" }) void normalUser_canNotGetUnrelatedPerson() { final var givenPersonUuid = jpaAttempt.transacted(() -> { context.define("superuser-alex@hostsharing.net"); @@ -153,7 +148,6 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup } @Test - @Accepts({ "Person:X(Access Control)" }) void personOwnerUser_canGetRelatedPerson() { final var givenPersonUuid = jpaAttempt.transacted(() -> { context.define("superuser-alex@hostsharing.net"); @@ -181,7 +175,6 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup } @Nested - @Accepts({ "Person:U(Update)" }) @Transactional class PatchPerson { @@ -269,7 +262,6 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup } @Nested - @Accepts({ "Person:D(Delete)" }) @Transactional class DeletePerson { @@ -293,7 +285,6 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup } @Test - @Accepts({ "Person:X(Access Control)" }) void personOwner_canDeleteRelatedPerson() { final var givenPerson = givenSomeTemporaryPersonCreatedBy("selfregistered-test-user@hostsharing.org"); @@ -311,7 +302,6 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup } @Test - @Accepts({ "Person:X(Access Control)" }) void normalUser_canNotDeleteUnrelatedPerson() { final var givenPerson = givenSomeTemporaryPersonCreatedBy("selfregistered-test-user@hostsharing.org"); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonEntityPatcherUnitTest.java index d1dced4d..39dabaa7 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonEntityPatcherUnitTest.java @@ -1,6 +1,6 @@ package net.hostsharing.hsadminng.hs.office.person; -import net.hostsharing.test.PatchUnitTestBase; +import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePersonPatchResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePersonTypeResource; import org.junit.jupiter.api.TestInstance; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonRepositoryIntegrationTest.java index ca4d82d4..1f6b68f2 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/person/HsOfficePersonRepositoryIntegrationTest.java @@ -1,11 +1,11 @@ package net.hostsharing.hsadminng.hs.office.person; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository; import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository; -import net.hostsharing.test.Array; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.Array; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.apache.commons.lang3.RandomStringUtils; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -24,7 +24,7 @@ import java.util.function.Supplier; import static net.hostsharing.hsadminng.hs.office.person.TestHsOfficePerson.hsOfficePerson; import static net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantEntity.distinctGrantDisplaysOf; import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleEntity.distinctRoleNamesOf; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationControllerAcceptanceTest.java index 54218b67..33d407d9 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationControllerAcceptanceTest.java @@ -2,14 +2,13 @@ package net.hostsharing.hsadminng.hs.office.relation; import io.restassured.RestAssured; import io.restassured.http.ContentType; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; -import net.hostsharing.test.Accepts; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRepository; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeRelationTypeResource; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.json.JSONException; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -20,8 +19,8 @@ import org.springframework.transaction.annotation.Transactional; import java.util.UUID; -import static net.hostsharing.test.IsValidUuidMatcher.isUuidValid; -import static net.hostsharing.test.JsonMatcher.lenientlyEquals; +import static net.hostsharing.hsadminng.rbac.test.IsValidUuidMatcher.isUuidValid; +import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.startsWith; @@ -56,7 +55,6 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean JpaAttempt jpaAttempt; @Nested - @Accepts({ "Relation:F(Find)" }) class ListRelations { @Test @@ -119,7 +117,6 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean } @Nested - @Accepts({ "Relation:C(Create)" }) class AddRelation { @Test @@ -269,7 +266,6 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean } @Nested - @Accepts({ "Relation:R(Read)" }) class GetRelation { @Test @@ -296,7 +292,6 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean } @Test - @Accepts({ "Relation:X(Access Control)" }) void normalUser_canNotGetUnrelatedRelation() { context.define("superuser-alex@hostsharing.net"); final UUID givenRelationUuid = findRelation("First", "Firby").getUuid(); @@ -312,7 +307,6 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean } @Test - @Accepts({ "Relation:X(Access Control)" }) void contactAdminUser_canGetRelatedRelation() { context.define("superuser-alex@hostsharing.net"); final var givenRelation = findRelation("First", "Firby"); @@ -351,7 +345,6 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean } @Nested - @Accepts({ "Relation:U(Update)" }) class PatchRelation { @Test @@ -398,7 +391,6 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean } @Nested - @Accepts({ "Relation:D(Delete)" }) class DeleteRelation { @Test @@ -420,7 +412,6 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean } @Test - @Accepts({ "Relation:X(Access Control)" }) void contactAdminUser_canNotDeleteRelatedRelation() { context.define("superuser-alex@hostsharing.net"); final var givenRelation = givenSomeTemporaryRelationBessler(); @@ -440,7 +431,6 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean } @Test - @Accepts({ "Relation:X(Access Control)" }) void normalUser_canNotDeleteUnrelatedRelation() { context.define("superuser-alex@hostsharing.net"); final var givenRelation = givenSomeTemporaryRelationBessler(); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationEntityPatcherUnitTest.java index 6aec1b25..823d1c61 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationEntityPatcherUnitTest.java @@ -3,7 +3,7 @@ package net.hostsharing.hsadminng.hs.office.relation; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeRelationPatchResource; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; -import net.hostsharing.test.PatchUnitTestBase; +import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRepositoryIntegrationTest.java index cb37536c..1c745bb8 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRepositoryIntegrationTest.java @@ -3,11 +3,11 @@ package net.hostsharing.hsadminng.hs.office.relation; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRepository; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository; import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository; -import net.hostsharing.test.Array; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.Array; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -26,7 +26,7 @@ import static net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType.NATU import static net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType.UNINCORPORATED_FIRM; import static net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantEntity.distinctGrantDisplaysOf; import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleEntity.distinctRoleNamesOf; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateControllerAcceptanceTest.java index 33a6810a..c0f68451 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateControllerAcceptanceTest.java @@ -6,9 +6,8 @@ import io.restassured.http.ContentType; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountRepository; import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorRepository; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; -import net.hostsharing.test.Accepts; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.json.JSONException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -25,8 +24,8 @@ import java.time.LocalDate; import java.util.UUID; import static java.util.Optional.ofNullable; -import static net.hostsharing.test.IsValidUuidMatcher.isUuidValid; -import static net.hostsharing.test.JsonMatcher.lenientlyEquals; +import static net.hostsharing.hsadminng.rbac.test.IsValidUuidMatcher.isUuidValid; +import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.*; @@ -56,7 +55,6 @@ class HsOfficeSepaMandateControllerAcceptanceTest extends ContextBasedTestWithCl EntityManager em; @Nested - @Accepts({ "SepaMandate:F(Find)" }) class ListSepaMandates { @Test @@ -102,7 +100,6 @@ class HsOfficeSepaMandateControllerAcceptanceTest extends ContextBasedTestWithCl } @Nested - @Accepts({ "SepaMandate:C(Create)" }) class AddSepaMandate { @Test @@ -234,7 +231,6 @@ class HsOfficeSepaMandateControllerAcceptanceTest extends ContextBasedTestWithCl } @Nested - @Accepts({ "SepaMandate:R(Read)" }) class GetSepaMandate { @Test @@ -268,7 +264,6 @@ class HsOfficeSepaMandateControllerAcceptanceTest extends ContextBasedTestWithCl } @Test - @Accepts({ "SepaMandate:X(Access Control)" }) void normalUser_canNotGetUnrelatedSepaMandate() { context.define("superuser-alex@hostsharing.net"); final var givenSepaMandateUuid = sepaMandateRepo.findSepaMandateByOptionalIban("DE02120300000000202051") @@ -286,7 +281,6 @@ class HsOfficeSepaMandateControllerAcceptanceTest extends ContextBasedTestWithCl } @Test - @Accepts({ "SepaMandate:X(Access Control)" }) void bankAccountAdminUser_canGetRelatedSepaMandate() { context.define("superuser-alex@hostsharing.net"); final var givenSepaMandateUuid = sepaMandateRepo.findSepaMandateByOptionalIban("DE02120300000000202051") @@ -318,7 +312,6 @@ class HsOfficeSepaMandateControllerAcceptanceTest extends ContextBasedTestWithCl } @Nested - @Accepts({ "SepaMandate:U(Update)" }) class PatchSepaMandate { @Test @@ -439,7 +432,6 @@ class HsOfficeSepaMandateControllerAcceptanceTest extends ContextBasedTestWithCl } @Nested - @Accepts({ "SepaMandate:D(Delete)" }) class DeleteSepaMandate { @Test @@ -461,7 +453,6 @@ class HsOfficeSepaMandateControllerAcceptanceTest extends ContextBasedTestWithCl } @Test - @Accepts({ "SepaMandate:X(Access Control)" }) void bankAccountAdminUser_canNotDeleteRelatedSepaMandate() { context.define("superuser-alex@hostsharing.net"); final var givenSepaMandate = givenSomeTemporarySepaMandateForDebitorNumber(1000111); @@ -480,7 +471,6 @@ class HsOfficeSepaMandateControllerAcceptanceTest extends ContextBasedTestWithCl } @Test - @Accepts({ "SepaMandate:X(Access Control)" }) void normalUser_canNotDeleteUnrelatedSepaMandate() { context.define("superuser-alex@hostsharing.net"); final var givenSepaMandate = givenSomeTemporarySepaMandateForDebitorNumber(1000111); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateEntityPatcherUnitTest.java index 04ba4fee..32b27caf 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateEntityPatcherUnitTest.java @@ -3,7 +3,7 @@ package net.hostsharing.hsadminng.hs.office.sepamandate; import io.hypersistence.utils.hibernate.type.range.Range; import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorEntity; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeSepaMandatePatchResource; -import net.hostsharing.test.PatchUnitTestBase; +import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateRepositoryIntegrationTest.java index 4f558db8..5544a3e3 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/sepamandate/HsOfficeSepaMandateRepositoryIntegrationTest.java @@ -4,11 +4,11 @@ import io.hypersistence.utils.hibernate.type.range.Range; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountRepository; import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorRepository; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository; import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository; -import net.hostsharing.test.Array; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.Array; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -26,8 +26,8 @@ import java.util.List; import static net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantEntity.distinctGrantDisplaysOf; import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleEntity.distinctRoleNamesOf; -import static net.hostsharing.test.Array.fromFormatted; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.Array.fromFormatted; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/hsadminng/context/ContextBasedTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/context/ContextBasedTest.java similarity index 94% rename from src/test/java/net/hostsharing/hsadminng/context/ContextBasedTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/context/ContextBasedTest.java index 7f08f044..2e14c267 100644 --- a/src/test/java/net/hostsharing/hsadminng/context/ContextBasedTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/context/ContextBasedTest.java @@ -1,5 +1,6 @@ -package net.hostsharing.hsadminng.context; +package net.hostsharing.hsadminng.rbac.context; +import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.rbac.rbacgrant.RbacGrantsDiagramService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInfo; diff --git a/src/test/java/net/hostsharing/hsadminng/context/ContextIntegrationTests.java b/src/test/java/net/hostsharing/hsadminng/rbac/context/ContextIntegrationTests.java similarity index 94% rename from src/test/java/net/hostsharing/hsadminng/context/ContextIntegrationTests.java rename to src/test/java/net/hostsharing/hsadminng/rbac/context/ContextIntegrationTests.java index 0daa0a15..774f5847 100644 --- a/src/test/java/net/hostsharing/hsadminng/context/ContextIntegrationTests.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/context/ContextIntegrationTests.java @@ -1,7 +1,8 @@ -package net.hostsharing.hsadminng.context; +package net.hostsharing.hsadminng.rbac.context; -import net.hostsharing.test.Array; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.context.Context; +import net.hostsharing.hsadminng.rbac.test.Array; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; diff --git a/src/test/java/net/hostsharing/hsadminng/context/ContextUnitTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/context/ContextUnitTest.java similarity index 98% rename from src/test/java/net/hostsharing/hsadminng/context/ContextUnitTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/context/ContextUnitTest.java index 2104f297..ae64d8c1 100644 --- a/src/test/java/net/hostsharing/hsadminng/context/ContextUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/context/ContextUnitTest.java @@ -1,5 +1,6 @@ -package net.hostsharing.hsadminng.context; +package net.hostsharing.hsadminng.rbac.context; +import net.hostsharing.hsadminng.context.Context; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; diff --git a/src/test/java/net/hostsharing/hsadminng/context/HttpServletRequestBodyCacheUnitTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/context/HttpServletRequestBodyCacheUnitTest.java similarity index 96% rename from src/test/java/net/hostsharing/hsadminng/context/HttpServletRequestBodyCacheUnitTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/context/HttpServletRequestBodyCacheUnitTest.java index 4903b594..598b9b8f 100644 --- a/src/test/java/net/hostsharing/hsadminng/context/HttpServletRequestBodyCacheUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/context/HttpServletRequestBodyCacheUnitTest.java @@ -1,5 +1,6 @@ -package net.hostsharing.hsadminng.context; +package net.hostsharing.hsadminng.rbac.context; +import net.hostsharing.hsadminng.context.HttpServletRequestBodyCache; import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantControllerAcceptanceTest.java index 15738504..aa2f0afb 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantControllerAcceptanceTest.java @@ -4,13 +4,12 @@ import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.response.ValidatableResponse; import net.hostsharing.hsadminng.HsadminNgApplication; -import net.hostsharing.hsadminng.context.ContextBasedTest; +import net.hostsharing.hsadminng.rbac.context.ContextBasedTest; import net.hostsharing.hsadminng.rbac.rbacrole.RbacRoleEntity; import net.hostsharing.hsadminng.rbac.rbacrole.RbacRoleRepository; import net.hostsharing.hsadminng.rbac.rbacuser.RbacUserEntity; import net.hostsharing.hsadminng.rbac.rbacuser.RbacUserRepository; -import net.hostsharing.test.Accepts; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.apache.commons.lang3.RandomStringUtils; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -34,7 +33,6 @@ import static org.hamcrest.Matchers.*; webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { HsadminNgApplication.class, JpaAttempt.class } ) -@Accepts({ "GRT:S(Schema)" }) @Transactional(readOnly = true, propagation = Propagation.NEVER) class RbacGrantControllerAcceptanceTest extends ContextBasedTest { @@ -60,7 +58,6 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { class ListGrants { @Test - @Accepts("GRT:L(List)") void globalAdmin_withoutAssumedRole_canViewAllGrants() { RestAssured // @formatter:off .given() @@ -113,7 +110,6 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { } @Test - @Accepts({ "GRT:L(List)", "GRT:X(Access Control)" }) void globalAdmin_withAssumedPackageAdminRole_canViewPacketRelatedGrants() { RestAssured // @formatter:off .given() @@ -137,7 +133,6 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { } @Test - @Accepts({ "GRT:L(List)", "GRT:X(Access Control)" }) void packageAdmin_withoutAssumedRole_canViewPacketRelatedGrants() { RestAssured // @formatter:off .given() @@ -166,7 +161,6 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { class GetGrantById { @Test - @Accepts({ "GRT:R(Read)" }) void customerAdmin_withAssumedPacketAdminRole_canReadPacketAdminsGrantById() { // given final var givenCurrentUserAsPackageAdmin = new Subject("customer-admin@xxx.example.com"); @@ -186,7 +180,6 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { } @Test - @Accepts({ "GRT:R(Read)" }) void packageAdmin_withoutAssumedRole_canReadItsOwnGrantById() { // given final var givenCurrentUserAsPackageAdmin = new Subject("pac-admin-xxx00@xxx.example.com"); @@ -206,7 +199,6 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { } @Test - @Accepts({ "GRT:R(Read)", "GRT:X(Access Control)" }) void packageAdmin_withAssumedPackageAdmin_canStillReadItsOwnGrantById() { // given final var givenCurrentUserAsPackageAdmin = new Subject( @@ -228,7 +220,6 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { } @Test - @Accepts({ "GRT:R(Read)", "GRT:X(Access Control)" }) void packageAdmin_withAssumedPackageTenantRole_canNotReadItsOwnGrantByIdAnymore() { // given @@ -250,7 +241,6 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { class GrantRoleToUser { @Test - @Accepts({ "GRT:C(Create)" }) void packageAdmin_canGrantOwnPackageAdminRole_toArbitraryUser() { // given @@ -280,7 +270,6 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { } @Test - @Accepts({ "GRT:C(Create)", "GRT:X(Access Control)" }) void packageAdmin_canNotGrantAlienPackageAdminRole_toArbitraryUser() { // given @@ -309,7 +298,6 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { class RevokeRoleFromUser { @Test - @Accepts({ "GRT:D(Delete)" }) @Transactional(propagation = Propagation.NEVER) void packageAdmin_canRevokePackageAdminRole_grantedByPackageAdmin_fromArbitraryUser() { diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantRepositoryIntegrationTest.java index 0ee1f297..804a564e 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantRepositoryIntegrationTest.java @@ -1,12 +1,11 @@ package net.hostsharing.hsadminng.rbac.rbacgrant; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.context.ContextBasedTest; +import net.hostsharing.hsadminng.rbac.context.ContextBasedTest; import net.hostsharing.hsadminng.rbac.rbacrole.RbacRoleRepository; import net.hostsharing.hsadminng.rbac.rbacuser.RbacUserEntity; import net.hostsharing.hsadminng.rbac.rbacuser.RbacUserRepository; -import net.hostsharing.test.Accepts; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -23,7 +22,7 @@ import jakarta.servlet.http.HttpServletRequest; import java.util.List; import java.util.UUID; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest @@ -58,7 +57,6 @@ class RbacGrantRepositoryIntegrationTest extends ContextBasedTest { class FindAllGrantsOfUser { @Test - @Accepts({ "GRT:L(List)" }) public void packageAdmin_canViewItsRbacGrants() { // given context("pac-admin-xxx00@xxx.example.com", null); @@ -73,7 +71,6 @@ class RbacGrantRepositoryIntegrationTest extends ContextBasedTest { } @Test - @Accepts({ "GRT:L(List)" }) public void customerAdmin_canViewItsRbacGrants() { // given context("customer-admin@xxx.example.com", null); @@ -91,7 +88,6 @@ class RbacGrantRepositoryIntegrationTest extends ContextBasedTest { } @Test - @Accepts({ "GRT:L(List)" }) public void customerAdmin_withAssumedRole_canOnlyViewRbacGrantsVisibleByAssumedRole() { // given: context("customer-admin@xxx.example.com", "test_package#xxx00:ADMIN"); diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantsDiagramServiceIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantsDiagramServiceIntegrationTest.java index 5d228314..7f183ba3 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantsDiagramServiceIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantsDiagramServiceIntegrationTest.java @@ -1,9 +1,9 @@ package net.hostsharing.hsadminng.rbac.rbacgrant; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.hs.office.test.ContextBasedTestWithCleanup; +import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RbacGrantsDiagramService.Include; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleControllerAcceptanceTest.java index d318cc04..5f20b0ab 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleControllerAcceptanceTest.java @@ -4,7 +4,6 @@ import io.restassured.RestAssured; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.rbac.rbacuser.RbacUserRepository; -import net.hostsharing.test.Accepts; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -16,7 +15,6 @@ import static org.hamcrest.Matchers.*; webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = HsadminNgApplication.class ) -@Accepts({ "ROL:*:S:Schema" }) class RbacRoleControllerAcceptanceTest { @LocalServerPort @@ -32,7 +30,6 @@ class RbacRoleControllerAcceptanceTest { RbacRoleRepository rbacRoleRepository; @Test - @Accepts({ "ROL:L(List)" }) void globalAdmin_withoutAssumedRole_canViewAllRoles() { // @formatter:off @@ -58,7 +55,6 @@ class RbacRoleControllerAcceptanceTest { } @Test - @Accepts({ "ROL:L(List)", "ROL:X(Access Control)" }) void globalAdmin_withAssumedPackageAdminRole_canViewPackageAdminRoles() { // @formatter:off @@ -92,7 +88,6 @@ class RbacRoleControllerAcceptanceTest { } @Test - @Accepts({ "ROL:L(List)", "ROL:X(Access Control)" }) void packageAdmin_withoutAssumedRole_canViewPackageAdminRoles() { // @formatter:off diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRepositoryIntegrationTest.java index 4d873fa6..536d748c 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/rbacrole/RbacRoleRepositoryIntegrationTest.java @@ -1,8 +1,8 @@ package net.hostsharing.hsadminng.rbac.rbacrole; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.test.Array; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.Array; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -15,7 +15,7 @@ import jakarta.persistence.EntityManager; import jakarta.servlet.http.HttpServletRequest; import java.util.List; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/rbacuser/RbacUserControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/rbacuser/RbacUserControllerAcceptanceTest.java index 6faa28ff..601fadad 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/rbacuser/RbacUserControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/rbacuser/RbacUserControllerAcceptanceTest.java @@ -4,8 +4,7 @@ import io.restassured.RestAssured; import io.restassured.http.ContentType; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.test.Accepts; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -41,7 +40,6 @@ class RbacUserControllerAcceptanceTest { class CreateRbacUser { @Test - @Accepts({ "USR:C(Create)", "USR:X(Access Control)" }) void anybody_canCreateANewUser() { // @formatter:off @@ -77,7 +75,6 @@ class RbacUserControllerAcceptanceTest { class GetRbacUser { @Test - @Accepts({ "USR:R(Read)" }) void globalAdmin_withoutAssumedRole_canGetArbitraryUser() { final var givenUser = findRbacUserByName("pac-admin-xxx00@xxx.example.com"); @@ -96,7 +93,6 @@ class RbacUserControllerAcceptanceTest { } @Test - @Accepts({ "USR:R(Read)", "USR:X(Access Control)" }) void globalAdmin_withAssumedCustomerAdminRole_canGetUserWithinInItsRealm() { final var givenUser = findRbacUserByName("pac-admin-yyy00@yyy.example.com"); @@ -116,7 +112,6 @@ class RbacUserControllerAcceptanceTest { } @Test - @Accepts({ "USR:R(Read)", "USR:X(Access Control)" }) void customerAdmin_withoutAssumedRole_canGetUserWithinInItsRealm() { final var givenUser = findRbacUserByName("pac-admin-yyy00@yyy.example.com"); @@ -135,7 +130,6 @@ class RbacUserControllerAcceptanceTest { } @Test - @Accepts({ "USR:R(Read)", "USR:X(Access Control)" }) void customerAdmin_withoutAssumedRole_canNotGetUserOutsideOfItsRealm() { final var givenUser = findRbacUserByName("pac-admin-yyy00@yyy.example.com"); @@ -156,7 +150,6 @@ class RbacUserControllerAcceptanceTest { class ListRbacUsers { @Test - @Accepts({ "USR:L(List)" }) void globalAdmin_withoutAssumedRole_canViewAllUsers() { // @formatter:off @@ -182,7 +175,6 @@ class RbacUserControllerAcceptanceTest { } @Test - @Accepts({ "USR:F(Filter)" }) void globalAdmin_withoutAssumedRole_canViewAllUsersByName() { // @formatter:off @@ -203,7 +195,6 @@ class RbacUserControllerAcceptanceTest { } @Test - @Accepts({ "USR:L(List)", "USR:X(Access Control)" }) void globalAdmin_withAssumedCustomerAdminRole_canViewUsersInItsRealm() { // @formatter:off @@ -226,7 +217,6 @@ class RbacUserControllerAcceptanceTest { } @Test - @Accepts({ "USR:L(List)", "USR:X(Access Control)" }) void customerAdmin_withoutAssumedRole_canViewUsersInItsRealm() { // @formatter:off @@ -248,7 +238,6 @@ class RbacUserControllerAcceptanceTest { } @Test - @Accepts({ "USR:L(List)", "USR:X(Access Control)" }) void packetAdmin_withoutAssumedRole_canViewAllUsersOfItsPackage() { // @formatter:off @@ -271,7 +260,6 @@ class RbacUserControllerAcceptanceTest { class ListRbacUserPermissions { @Test - @Accepts({ "PRM:L(List)" }) void globalAdmin_withoutAssumedRole_canViewArbitraryUsersPermissions() { final var givenUser = findRbacUserByName("pac-admin-yyy00@yyy.example.com"); @@ -301,7 +289,6 @@ class RbacUserControllerAcceptanceTest { } @Test - @Accepts({ "PRM:L(List)" }) void globalAdmin_withAssumedCustomerAdminRole_canViewArbitraryUsersPermissions() { final var givenUser = findRbacUserByName("pac-admin-yyy00@yyy.example.com"); @@ -332,7 +319,6 @@ class RbacUserControllerAcceptanceTest { } @Test - @Accepts({ "PRM:L(List)" }) void packageAdmin_withoutAssumedRole_canViewPermissionsOfUsersInItsRealm() { final var givenUser = findRbacUserByName("pac-admin-yyy00@yyy.example.com"); @@ -362,7 +348,6 @@ class RbacUserControllerAcceptanceTest { } @Test - @Accepts({ "PRM:L(List)" }) void packageAdmin_canViewPermissionsOfUsersOutsideOfItsRealm() { final var givenUser = findRbacUserByName("pac-admin-xxx00@xxx.example.com"); @@ -385,7 +370,6 @@ class RbacUserControllerAcceptanceTest { class DeleteRbacUser { @Test - @Accepts({ "USR:D(Create)" }) void anybody_canDeleteTheirOwnUser() { // given @@ -407,7 +391,6 @@ class RbacUserControllerAcceptanceTest { } @Test - @Accepts({ "USR:D(Create)", "USR:X(Access Control)" }) void customerAdmin_canNotDeleteOtherUser() { // given @@ -430,7 +413,6 @@ class RbacUserControllerAcceptanceTest { } @Test - @Accepts({ "USR:D(Create)", "USR:X(Access Control)" }) void globalAdmin_canDeleteArbitraryUser() { // given diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/rbacuser/RbacUserControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/rbacuser/RbacUserControllerRestTest.java index 6beec689..6e59f38a 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/rbacuser/RbacUserControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/rbacuser/RbacUserControllerRestTest.java @@ -21,7 +21,7 @@ import jakarta.persistence.SynchronizationType; import java.util.Map; import java.util.UUID; -import static net.hostsharing.test.IsValidUuidMatcher.isUuidValid; +import static net.hostsharing.hsadminng.rbac.test.IsValidUuidMatcher.isUuidValid; import static org.hamcrest.Matchers.is; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.argThat; diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/rbacuser/RbacUserRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/rbacuser/RbacUserRepositoryIntegrationTest.java index 43c8bff1..f1e6fef5 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/rbacuser/RbacUserRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/rbacuser/RbacUserRepositoryIntegrationTest.java @@ -1,9 +1,9 @@ package net.hostsharing.hsadminng.rbac.rbacuser; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.context.ContextBasedTest; -import net.hostsharing.test.Array; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.context.ContextBasedTest; +import net.hostsharing.hsadminng.rbac.test.Array; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -21,7 +21,7 @@ import java.util.List; import java.util.UUID; import static java.util.Comparator.comparing; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/test/Array.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/Array.java similarity index 96% rename from src/test/java/net/hostsharing/test/Array.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/Array.java index 87fa92ff..c51a69bb 100644 --- a/src/test/java/net/hostsharing/test/Array.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/Array.java @@ -1,4 +1,4 @@ -package net.hostsharing.test; +package net.hostsharing.hsadminng.rbac.test; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/test/ContextBasedTestWithCleanup.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/ContextBasedTestWithCleanup.java similarity index 98% rename from src/test/java/net/hostsharing/hsadminng/hs/office/test/ContextBasedTestWithCleanup.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/ContextBasedTestWithCleanup.java index 0af79642..154dbb11 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/test/ContextBasedTestWithCleanup.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/ContextBasedTestWithCleanup.java @@ -1,13 +1,12 @@ -package net.hostsharing.hsadminng.hs.office.test; +package net.hostsharing.hsadminng.rbac.test; -import net.hostsharing.hsadminng.context.ContextBasedTest; +import net.hostsharing.hsadminng.rbac.context.ContextBasedTest; import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; import net.hostsharing.hsadminng.rbac.rbacgrant.RbacGrantEntity; import net.hostsharing.hsadminng.rbac.rbacgrant.RbacGrantRepository; import net.hostsharing.hsadminng.rbac.rbacgrant.RbacGrantsDiagramService; import net.hostsharing.hsadminng.rbac.rbacrole.RbacRoleEntity; import net.hostsharing.hsadminng.rbac.rbacrole.RbacRoleRepository; -import net.hostsharing.test.JpaAttempt; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -25,7 +24,7 @@ import static java.util.stream.Collectors.toSet; import static org.apache.commons.collections4.SetUtils.difference; import static org.assertj.core.api.Assertions.assertThat; -// TODO: cleanup the whole class +// TODO.impl: cleanup the whole class public abstract class ContextBasedTestWithCleanup extends ContextBasedTest { private static final boolean DETAILED_BUT_SLOW_CHECK = true; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/test/EntityList.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/EntityList.java similarity index 87% rename from src/test/java/net/hostsharing/hsadminng/hs/office/test/EntityList.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/EntityList.java index 2cc55e61..c504db61 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/test/EntityList.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/EntityList.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.hs.office.test; +package net.hostsharing.hsadminng.rbac.test; import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; diff --git a/src/test/java/net/hostsharing/test/IsValidUuidMatcher.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/IsValidUuidMatcher.java similarity index 97% rename from src/test/java/net/hostsharing/test/IsValidUuidMatcher.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/IsValidUuidMatcher.java index 37d523ce..531c89c4 100644 --- a/src/test/java/net/hostsharing/test/IsValidUuidMatcher.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/IsValidUuidMatcher.java @@ -1,4 +1,4 @@ -package net.hostsharing.test; +package net.hostsharing.hsadminng.rbac.test; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; diff --git a/src/test/java/net/hostsharing/test/JpaAttempt.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/JpaAttempt.java similarity index 99% rename from src/test/java/net/hostsharing/test/JpaAttempt.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/JpaAttempt.java index d0ddd040..50a928da 100644 --- a/src/test/java/net/hostsharing/test/JpaAttempt.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/JpaAttempt.java @@ -1,4 +1,4 @@ -package net.hostsharing.test; +package net.hostsharing.hsadminng.rbac.test; import org.assertj.core.api.ObjectAssert; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/test/java/net/hostsharing/test/JsonBuilder.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/JsonBuilder.java similarity index 97% rename from src/test/java/net/hostsharing/test/JsonBuilder.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/JsonBuilder.java index 7934cefa..35a29d90 100644 --- a/src/test/java/net/hostsharing/test/JsonBuilder.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/JsonBuilder.java @@ -1,4 +1,4 @@ -package net.hostsharing.test; +package net.hostsharing.hsadminng.rbac.test; import org.json.JSONException; import org.json.JSONObject; diff --git a/src/test/java/net/hostsharing/test/JsonMatcher.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/JsonMatcher.java similarity index 97% rename from src/test/java/net/hostsharing/test/JsonMatcher.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/JsonMatcher.java index 3f5457c2..54208e4c 100644 --- a/src/test/java/net/hostsharing/test/JsonMatcher.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/JsonMatcher.java @@ -1,4 +1,4 @@ -package net.hostsharing.test; +package net.hostsharing.hsadminng.rbac.test; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/src/test/java/net/hostsharing/test/LocaleUnitTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/LocaleUnitTest.java similarity index 89% rename from src/test/java/net/hostsharing/test/LocaleUnitTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/LocaleUnitTest.java index 6071c4ea..109a9eba 100644 --- a/src/test/java/net/hostsharing/test/LocaleUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/LocaleUnitTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.test; +package net.hostsharing.hsadminng.rbac.test; import org.junit.jupiter.api.Test; diff --git a/src/test/java/net/hostsharing/test/MapperUnitTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/MapperUnitTest.java similarity index 99% rename from src/test/java/net/hostsharing/test/MapperUnitTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/MapperUnitTest.java index b90bea08..f1bc0cc3 100644 --- a/src/test/java/net/hostsharing/test/MapperUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/MapperUnitTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.test; +package net.hostsharing.hsadminng.rbac.test; import lombok.*; import net.hostsharing.hsadminng.errors.DisplayName; diff --git a/src/test/java/net/hostsharing/test/OptionalFromJsonUnitTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/OptionalFromJsonUnitTest.java similarity index 97% rename from src/test/java/net/hostsharing/test/OptionalFromJsonUnitTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/OptionalFromJsonUnitTest.java index 52c22d0b..b2670887 100644 --- a/src/test/java/net/hostsharing/test/OptionalFromJsonUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/OptionalFromJsonUnitTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.test; +package net.hostsharing.hsadminng.rbac.test; import net.hostsharing.hsadminng.mapper.OptionalFromJson; import org.junit.jupiter.api.Test; diff --git a/src/test/java/net/hostsharing/test/PatchUnitTestBase.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/PatchUnitTestBase.java similarity index 99% rename from src/test/java/net/hostsharing/test/PatchUnitTestBase.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/PatchUnitTestBase.java index 56f97938..f2764386 100644 --- a/src/test/java/net/hostsharing/test/PatchUnitTestBase.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/PatchUnitTestBase.java @@ -1,4 +1,4 @@ -package net.hostsharing.test; +package net.hostsharing.hsadminng.rbac.test; import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; import net.hostsharing.hsadminng.mapper.EntityPatcher; diff --git a/src/test/java/net/hostsharing/test/StringTemplater.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/StringTemplater.java similarity index 94% rename from src/test/java/net/hostsharing/test/StringTemplater.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/StringTemplater.java index 38866f49..0435bf2c 100644 --- a/src/test/java/net/hostsharing/test/StringTemplater.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/StringTemplater.java @@ -1,4 +1,4 @@ -package net.hostsharing.test; +package net.hostsharing.hsadminng.rbac.test; import lombok.experimental.UtilityClass; diff --git a/src/test/java/net/hostsharing/test/StringifyUnitTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/StringifyUnitTest.java similarity index 98% rename from src/test/java/net/hostsharing/test/StringifyUnitTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/StringifyUnitTest.java index d8830335..f022e175 100644 --- a/src/test/java/net/hostsharing/test/StringifyUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/StringifyUnitTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.test; +package net.hostsharing.hsadminng.rbac.test; import lombok.*; import lombok.experimental.FieldNameConstants; diff --git a/src/test/java/net/hostsharing/hsadminng/test/cust/TestCustomer.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomer.java similarity index 89% rename from src/test/java/net/hostsharing/hsadminng/test/cust/TestCustomer.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomer.java index 7316ccb1..95462ec7 100644 --- a/src/test/java/net/hostsharing/hsadminng/test/cust/TestCustomer.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomer.java @@ -1,5 +1,4 @@ -package net.hostsharing.hsadminng.test.cust; - +package net.hostsharing.hsadminng.rbac.test.cust; public class TestCustomer { diff --git a/src/test/java/net/hostsharing/hsadminng/test/cust/TestCustomerControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerControllerAcceptanceTest.java similarity index 98% rename from src/test/java/net/hostsharing/hsadminng/test/cust/TestCustomerControllerAcceptanceTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerControllerAcceptanceTest.java index 1d7bf4e5..7d0d8e51 100644 --- a/src/test/java/net/hostsharing/hsadminng/test/cust/TestCustomerControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerControllerAcceptanceTest.java @@ -1,10 +1,10 @@ -package net.hostsharing.hsadminng.test.cust; +package net.hostsharing.hsadminng.rbac.test.cust; import io.restassured.RestAssured; import io.restassured.http.ContentType; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; diff --git a/src/test/java/net/hostsharing/hsadminng/test/cust/TestCustomerEntityUnitTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerEntityUnitTest.java similarity index 97% rename from src/test/java/net/hostsharing/hsadminng/test/cust/TestCustomerEntityUnitTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerEntityUnitTest.java index 962cef38..e7107909 100644 --- a/src/test/java/net/hostsharing/hsadminng/test/cust/TestCustomerEntityUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerEntityUnitTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.test.cust; +package net.hostsharing.hsadminng.rbac.test.cust; import net.hostsharing.hsadminng.rbac.rbacdef.RbacViewMermaidFlowchartGenerator; import org.junit.jupiter.api.Test; diff --git a/src/test/java/net/hostsharing/hsadminng/test/cust/TestCustomerRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerRepositoryIntegrationTest.java similarity index 96% rename from src/test/java/net/hostsharing/hsadminng/test/cust/TestCustomerRepositoryIntegrationTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerRepositoryIntegrationTest.java index b90628a8..ae878a61 100644 --- a/src/test/java/net/hostsharing/hsadminng/test/cust/TestCustomerRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/cust/TestCustomerRepositoryIntegrationTest.java @@ -1,8 +1,8 @@ -package net.hostsharing.hsadminng.test.cust; +package net.hostsharing.hsadminng.rbac.test.cust; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.context.ContextBasedTest; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.context.ContextBasedTest; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -15,7 +15,7 @@ import jakarta.servlet.http.HttpServletRequest; import java.util.List; import java.util.UUID; -import static net.hostsharing.test.JpaAttempt.attempt; +import static net.hostsharing.hsadminng.rbac.test.JpaAttempt.attempt; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest diff --git a/src/test/java/net/hostsharing/hsadminng/test/pac/TestPackage.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackage.java similarity index 75% rename from src/test/java/net/hostsharing/hsadminng/test/pac/TestPackage.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackage.java index b97daeaa..4c891478 100644 --- a/src/test/java/net/hostsharing/hsadminng/test/pac/TestPackage.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackage.java @@ -1,7 +1,7 @@ -package net.hostsharing.hsadminng.test.pac; +package net.hostsharing.hsadminng.rbac.test.pac; -import net.hostsharing.hsadminng.test.cust.TestCustomer; -import net.hostsharing.hsadminng.test.cust.TestCustomerEntity; +import net.hostsharing.hsadminng.rbac.test.cust.TestCustomer; +import net.hostsharing.hsadminng.rbac.test.cust.TestCustomerEntity; import static java.util.UUID.randomUUID; diff --git a/src/test/java/net/hostsharing/hsadminng/test/pac/TestPackageControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageControllerAcceptanceTest.java similarity index 99% rename from src/test/java/net/hostsharing/hsadminng/test/pac/TestPackageControllerAcceptanceTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageControllerAcceptanceTest.java index 0e52cc40..a5e89330 100644 --- a/src/test/java/net/hostsharing/hsadminng/test/pac/TestPackageControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageControllerAcceptanceTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.test.pac; +package net.hostsharing.hsadminng.rbac.test.pac; import io.restassured.RestAssured; import io.restassured.http.ContentType; diff --git a/src/test/java/net/hostsharing/hsadminng/test/pac/TestPackageEntityUnitTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageEntityUnitTest.java similarity index 98% rename from src/test/java/net/hostsharing/hsadminng/test/pac/TestPackageEntityUnitTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageEntityUnitTest.java index 79dcfec2..660ad955 100644 --- a/src/test/java/net/hostsharing/hsadminng/test/pac/TestPackageEntityUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageEntityUnitTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.test.pac; +package net.hostsharing.hsadminng.rbac.test.pac; import net.hostsharing.hsadminng.rbac.rbacdef.RbacViewMermaidFlowchartGenerator; import org.junit.jupiter.api.Test; diff --git a/src/test/java/net/hostsharing/hsadminng/test/pac/TestPackageRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageRepositoryIntegrationTest.java similarity index 96% rename from src/test/java/net/hostsharing/hsadminng/test/pac/TestPackageRepositoryIntegrationTest.java rename to src/test/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageRepositoryIntegrationTest.java index 49412b3b..a8fd8a50 100644 --- a/src/test/java/net/hostsharing/hsadminng/test/pac/TestPackageRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/test/pac/TestPackageRepositoryIntegrationTest.java @@ -1,8 +1,8 @@ -package net.hostsharing.hsadminng.test.pac; +package net.hostsharing.hsadminng.rbac.test.pac; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.context.ContextBasedTest; -import net.hostsharing.test.JpaAttempt; +import net.hostsharing.hsadminng.rbac.context.ContextBasedTest; +import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/test/java/net/hostsharing/test/Accepts.java b/src/test/java/net/hostsharing/test/Accepts.java deleted file mode 100644 index 505b5d2e..00000000 --- a/src/test/java/net/hostsharing/test/Accepts.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.hostsharing.test; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.TYPE, ElementType.METHOD }) -public @interface Accepts { - - String[] value(); -}