add audit journal log for hs_office_debitor

This commit is contained in:
Michael Hoennig 2022-10-13 09:02:09 +02:00
parent 64fbabf606
commit 2506acc531
2 changed files with 27 additions and 4 deletions

View File

@ -17,3 +17,11 @@ create table hs_office_debitor
-- TODO.impl: SEPA-mandate -- TODO.impl: SEPA-mandate
); );
--// --//
-- ============================================================================
--changeset hs-office-debitor-MAIN-TABLE-JOURNAL:1 endDelimiter:--//
-- ----------------------------------------------------------------------------
call create_journal('hs_office_debitor');
--//

View File

@ -24,10 +24,7 @@ import org.springframework.test.annotation.DirtiesContext;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.HashSet; import java.util.*;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import static net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantEntity.grantDisplaysOf; import static net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantEntity.grantDisplaysOf;
import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleEntity.roleNamesOf; import static net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleEntity.roleNamesOf;
@ -435,6 +432,24 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
} }
} }
@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_debitor';
""");
// when
@SuppressWarnings("unchecked") final List<Object[]> customerLogEntries = query.getResultList();
// then
assertThat(customerLogEntries).map(Arrays::toString)
.contains("[creating RBAC test debitor FirstGmbH-firstcontact, hs_office_debitor, INSERT]");
}
private HsOfficePartnerEntity rawReference(final HsOfficePartnerEntity givenPartner) { private HsOfficePartnerEntity rawReference(final HsOfficePartnerEntity givenPartner) {
return em.getReference(HsOfficePartnerEntity.class, givenPartner.getUuid()); return em.getReference(HsOfficePartnerEntity.class, givenPartner.getUuid());
} }