introduce-partner-business-role #16

Merged
hsh-michaelhoennig merged 33 commits from introduce-partner-business-role into master 2024-02-01 14:48:16 +01:00
2 changed files with 15 additions and 15 deletions
Showing only changes of commit 2d81d3f6fd - Show all commits

View File

@ -46,7 +46,7 @@ postgresAutodoc () {
alias postgres-autodoc=postgresAutodoc alias postgres-autodoc=postgresAutodoc
function importOfficeData() { function importOfficeData() {
export HSADMINNG_POSTGRES_JDBC=jdbc:tc:postgresql:15.5-bookworm:///spring_boot_testcontainers export HSADMINNG_POSTGRES_JDBC_URL=jdbc:tc:postgresql:15.5-bookworm:///spring_boot_testcontainers
export HSADMINNG_POSTGRES_ADMIN_USERNAME=admin export HSADMINNG_POSTGRES_ADMIN_USERNAME=admin
export HSADMINNG_POSTGRES_ADMIN_PASSWORD=password export HSADMINNG_POSTGRES_ADMIN_PASSWORD=password
export HSADMINNG_POSTGRES_RESTRICTED_USERNAME=restricted export HSADMINNG_POSTGRES_RESTRICTED_USERNAME=restricted

View File

@ -163,7 +163,7 @@ public class ImportOfficeData extends ContextBasedTest {
@Test @Test
@Order(1011) @Order(1011)
void verifyBusinessPartners() { void verifyBusinessPartners() {
assumeThat(postgresAdminUser).isEqualTo("admin"); assumeThatWeAreImportingControlledTestData();
// no contacts yet => mostly null values // no contacts yet => mostly null values
assertThat(toFormattedString(partners)).isEqualToIgnoringWhitespace(""" assertThat(toFormattedString(partners)).isEqualToIgnoringWhitespace("""
@ -204,7 +204,7 @@ public class ImportOfficeData extends ContextBasedTest {
@Test @Test
@Order(1021) @Order(1021)
void verifyContacts() { void verifyContacts() {
assumeThat(postgresAdminUser).isEqualTo("admin"); assumeThatWeAreImportingControlledTestData();
assertThat(toFormattedString(partners)).isEqualToIgnoringWhitespace(""" assertThat(toFormattedString(partners)).isEqualToIgnoringWhitespace("""
{ {
@ -280,7 +280,7 @@ public class ImportOfficeData extends ContextBasedTest {
@Test @Test
@Order(1031) @Order(1031)
void verifySepaMandates() { void verifySepaMandates() {
assumeThat(postgresAdminUser).isEqualTo("admin"); assumeThatWeAreImportingControlledTestData();
assertThat(toFormattedString(bankAccounts)).isEqualToIgnoringWhitespace(""" assertThat(toFormattedString(bankAccounts)).isEqualToIgnoringWhitespace("""
{ {
@ -312,7 +312,7 @@ public class ImportOfficeData extends ContextBasedTest {
@Test @Test
@Order(1041) @Order(1041)
void verifyCoopShares() { void verifyCoopShares() {
assumeThat(postgresAdminUser).isEqualTo("admin"); assumeThatWeAreImportingControlledTestData();
assertThat(toFormattedString(coopShares)).isEqualToIgnoringWhitespace(""" assertThat(toFormattedString(coopShares)).isEqualToIgnoringWhitespace("""
{ {
@ -339,7 +339,7 @@ public class ImportOfficeData extends ContextBasedTest {
@Test @Test
@Order(1051) @Order(1051)
void verifyCoopAssets() { void verifyCoopAssets() {
assumeThat(postgresAdminUser).isEqualTo("admin"); assumeThatWeAreImportingControlledTestData();
assertThat(toFormattedString(coopAssets)).isEqualToIgnoringWhitespace(""" assertThat(toFormattedString(coopAssets)).isEqualToIgnoringWhitespace("""
{ {
@ -377,6 +377,11 @@ public class ImportOfficeData extends ContextBasedTest {
persons.forEach(this::persist); persons.forEach(this::persist);
}).assertSuccessful(); }).assertSuccessful();
jpaAttempt.transacted(() -> {
context(rbacSuperuser);
relationships.forEach(this::persist);
}).assertSuccessful();
jpaAttempt.transacted(() -> { jpaAttempt.transacted(() -> {
context(rbacSuperuser); context(rbacSuperuser);
partners.forEach(this::persist); partners.forEach(this::persist);
@ -391,26 +396,17 @@ public class ImportOfficeData extends ContextBasedTest {
jpaAttempt.transacted(() -> { jpaAttempt.transacted(() -> {
context(rbacSuperuser); context(rbacSuperuser);
memberships.forEach(this::persist); memberships.forEach(this::persist);
}).assertSuccessful();
jpaAttempt.transacted(() -> {
context(rbacSuperuser);
relationships.forEach(this::persist);
}).assertSuccessful(); }).assertSuccessful();
jpaAttempt.transacted(() -> { jpaAttempt.transacted(() -> {
context(rbacSuperuser); context(rbacSuperuser);
bankAccounts.forEach(this::persist); bankAccounts.forEach(this::persist);
}).assertSuccessful(); }).assertSuccessful();
jpaAttempt.transacted(() -> { jpaAttempt.transacted(() -> {
context(rbacSuperuser); context(rbacSuperuser);
sepaMandates.forEach(this::persist); sepaMandates.forEach(this::persist);
updateLegacyIds(sepaMandates, "hs_office_sepamandate_legacy_id", "sepa_mandate_id"); updateLegacyIds(sepaMandates, "hs_office_sepamandate_legacy_id", "sepa_mandate_id");
}).assertSuccessful(); }).assertSuccessful();
jpaAttempt.transacted(() -> { jpaAttempt.transacted(() -> {
@ -441,6 +437,10 @@ public class ImportOfficeData extends ContextBasedTest {
} }
private static void assumeThatWeAreImportingControlledTestData() {
assumeThat(partners.size()).isLessThan(100);
}
private void deleteTestDataFromHsOfficeTables() { private void deleteTestDataFromHsOfficeTables() {
jpaAttempt.transacted(() -> { jpaAttempt.transacted(() -> {
context(rbacSuperuser); context(rbacSuperuser);