From df493e40d7a996c72f2728b969570ee242c018d5 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 13 Oct 2022 08:03:48 +0200 Subject: [PATCH] add audit journal log for hs_office_bankaccount --- .../changelog/240-hs-office-bankaccount.sql | 8 ++++++++ ...eBankAccountRepositoryIntegrationTest.java | 20 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/main/resources/db/changelog/240-hs-office-bankaccount.sql b/src/main/resources/db/changelog/240-hs-office-bankaccount.sql index 2f7f96a9..bf3ed342 100644 --- a/src/main/resources/db/changelog/240-hs-office-bankaccount.sql +++ b/src/main/resources/db/changelog/240-hs-office-bankaccount.sql @@ -11,3 +11,11 @@ create table hs_office_bankaccount bic varchar(11) not null ); --// + + +-- ============================================================================ +--changeset hs-office-bankaccount-MAIN-TABLE-JOURNAL:1 endDelimiter:--// +-- ---------------------------------------------------------------------------- + +call create_journal('hs_office_bankaccount'); +--// 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 ca9804c5..b3680965 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 @@ -20,6 +20,7 @@ import org.testcontainers.junit.jupiter.Container; import javax.persistence.EntityManager; import javax.servlet.http.HttpServletRequest; +import java.util.Arrays; import java.util.List; import java.util.function.Supplier; @@ -292,6 +293,25 @@ class HsOfficeBankAccountRepositoryIntegrationTest extends ContextBasedTest { }).assertSuccessful().returnedValue(); } + + @Test + public void auditJournalLogIsAvailable() { + // given + final var query = em.createNativeQuery(""" + select c.currenttask, j.targettable, j.targetop + from tx_journal j + join tx_context c on j.txid = c.txid + where targettable = 'hs_office_bankaccount'; + """); + + // when + @SuppressWarnings("unchecked") final List customerLogEntries = query.getResultList(); + + // then + assertThat(customerLogEntries).map(Arrays::toString) + .contains("[creating RBAC test bankaccount First GmbH, hs_office_bankaccount, INSERT]"); + } + @BeforeEach @AfterEach void cleanup() {