persist relationships before partners to avoid transient reference
This commit is contained in:
parent
90e626eac0
commit
2d81d3f6fd
2
.aliases
2
.aliases
@ -46,7 +46,7 @@ postgresAutodoc () {
|
||||
alias postgres-autodoc=postgresAutodoc
|
||||
|
||||
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_PASSWORD=password
|
||||
export HSADMINNG_POSTGRES_RESTRICTED_USERNAME=restricted
|
||||
|
@ -163,7 +163,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
@Test
|
||||
@Order(1011)
|
||||
void verifyBusinessPartners() {
|
||||
assumeThat(postgresAdminUser).isEqualTo("admin");
|
||||
assumeThatWeAreImportingControlledTestData();
|
||||
|
||||
// no contacts yet => mostly null values
|
||||
assertThat(toFormattedString(partners)).isEqualToIgnoringWhitespace("""
|
||||
@ -204,7 +204,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
@Test
|
||||
@Order(1021)
|
||||
void verifyContacts() {
|
||||
assumeThat(postgresAdminUser).isEqualTo("admin");
|
||||
assumeThatWeAreImportingControlledTestData();
|
||||
|
||||
assertThat(toFormattedString(partners)).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
@ -280,7 +280,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
@Test
|
||||
@Order(1031)
|
||||
void verifySepaMandates() {
|
||||
assumeThat(postgresAdminUser).isEqualTo("admin");
|
||||
assumeThatWeAreImportingControlledTestData();
|
||||
|
||||
assertThat(toFormattedString(bankAccounts)).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
@ -312,7 +312,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
@Test
|
||||
@Order(1041)
|
||||
void verifyCoopShares() {
|
||||
assumeThat(postgresAdminUser).isEqualTo("admin");
|
||||
assumeThatWeAreImportingControlledTestData();
|
||||
|
||||
assertThat(toFormattedString(coopShares)).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
@ -339,7 +339,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
@Test
|
||||
@Order(1051)
|
||||
void verifyCoopAssets() {
|
||||
assumeThat(postgresAdminUser).isEqualTo("admin");
|
||||
assumeThatWeAreImportingControlledTestData();
|
||||
|
||||
assertThat(toFormattedString(coopAssets)).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
@ -377,6 +377,11 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
persons.forEach(this::persist);
|
||||
}).assertSuccessful();
|
||||
|
||||
jpaAttempt.transacted(() -> {
|
||||
context(rbacSuperuser);
|
||||
relationships.forEach(this::persist);
|
||||
}).assertSuccessful();
|
||||
|
||||
jpaAttempt.transacted(() -> {
|
||||
context(rbacSuperuser);
|
||||
partners.forEach(this::persist);
|
||||
@ -391,26 +396,17 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
jpaAttempt.transacted(() -> {
|
||||
context(rbacSuperuser);
|
||||
memberships.forEach(this::persist);
|
||||
|
||||
}).assertSuccessful();
|
||||
|
||||
jpaAttempt.transacted(() -> {
|
||||
context(rbacSuperuser);
|
||||
relationships.forEach(this::persist);
|
||||
|
||||
}).assertSuccessful();
|
||||
|
||||
jpaAttempt.transacted(() -> {
|
||||
context(rbacSuperuser);
|
||||
bankAccounts.forEach(this::persist);
|
||||
|
||||
}).assertSuccessful();
|
||||
|
||||
jpaAttempt.transacted(() -> {
|
||||
context(rbacSuperuser);
|
||||
sepaMandates.forEach(this::persist);
|
||||
updateLegacyIds(sepaMandates, "hs_office_sepamandate_legacy_id", "sepa_mandate_id");
|
||||
|
||||
}).assertSuccessful();
|
||||
|
||||
jpaAttempt.transacted(() -> {
|
||||
@ -441,6 +437,10 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
|
||||
}
|
||||
|
||||
private static void assumeThatWeAreImportingControlledTestData() {
|
||||
assumeThat(partners.size()).isLessThan(100);
|
||||
}
|
||||
|
||||
private void deleteTestDataFromHsOfficeTables() {
|
||||
jpaAttempt.transacted(() -> {
|
||||
context(rbacSuperuser);
|
||||
|
Loading…
Reference in New Issue
Block a user