From 5051198e00e35d373a42859ef118b5c2cfd6556d Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Mon, 8 Apr 2024 08:38:31 +0200 Subject: [PATCH] always generate dynacmi RBAC to doc/temp with explicit name --- .../rbac/rbacgrant/RbacGrantsDiagramService.java | 2 +- .../HsOfficeRelationRepositoryIntegrationTest.java | 3 --- .../hs/office/test/ContextBasedTestWithCleanup.java | 8 +++----- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantsDiagramService.java b/src/main/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantsDiagramService.java index 0cf30dca..f4dc2167 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantsDiagramService.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/rbacgrant/RbacGrantsDiagramService.java @@ -209,7 +209,7 @@ public class RbacGrantsDiagramService { } - class LimitedHashSet extends HashSet { + static class LimitedHashSet extends HashSet { @Override public boolean add(final T t) { 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 bc8bfd40..77342f0d 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 @@ -5,7 +5,6 @@ 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.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; @@ -295,8 +294,6 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea } private void assertThatRelationActuallyInDatabase(final HsOfficeRelationEntity saved) { - generateRbacDiagramForCurrentSubjects(RbacGrantsDiagramService.Include.ALL_NON_TEST_ENTITY_RELATED); - generateRbacDiagramForObjectPermission(saved.getUuid(), "SELECT", "relation-select"); final var found = relationRepo.findByUuid(saved.getUuid()); assertThat(found).isNotEmpty().get().isNotSameAs(saved).usingRecursiveComparison().isEqualTo(saved); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/test/ContextBasedTestWithCleanup.java b/src/test/java/net/hostsharing/hsadminng/hs/office/test/ContextBasedTestWithCleanup.java index fc0b81c3..64feda26 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/test/ContextBasedTestWithCleanup.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/test/ContextBasedTestWithCleanup.java @@ -17,7 +17,6 @@ import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; import jakarta.persistence.*; -import java.lang.reflect.Method; import java.util.*; import static java.lang.System.out; @@ -272,12 +271,11 @@ public abstract class ContextBasedTestWithCleanup extends ContextBasedTest { /** * Generates a diagram of the RBAC-Grants to the current subjects (user or assumed roles). */ - protected void generateRbacDiagramForCurrentSubjects(final EnumSet include) { - final var title = testInfo.getTestMethod().map(Method::getName).orElseThrow(); + protected void generateRbacDiagramForCurrentSubjects(final EnumSet include, final String name) { RbacGrantsDiagramService.writeToFile( - title, + name, diagramService.allGrantsToCurrentUser(include), - "doc/" + title + ".md" + "doc/temp/" + name + ".md" ); }