From 6ddecbbfec18208e7cbd0ba435205921469f1a7a Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 9 Aug 2024 15:19:55 +0200 Subject: [PATCH] make sure that we don't delete thousands of records - rather start with a new db --- .../hsadminng/hs/migration/ImportOfficeData.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportOfficeData.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportOfficeData.java index 5bdacaab..a33d6be4 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportOfficeData.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportOfficeData.java @@ -134,6 +134,15 @@ public class ImportOfficeData extends CsvDataImport { static Map coopShares = new WriteOnceMap<>(); static Map coopAssets = new WriteOnceMap<>(); + @Test + @Order(1) + void verifyInitialDatabase() { + // SQL DELETE for thousands of records takes too long, so we make sure, we only start with initial or test data + final var contactCount = (Integer) em.createNativeQuery("select count(*) from hs_office_contact", Integer.class) + .getSingleResult(); + assertThat(contactCount).isLessThan(20); + } + @Test @Order(1010) void importBusinessPartners() {