fix import-office-data alias / gw importOfficeData

This commit is contained in:
Michael Hoennig 2024-01-18 15:49:01 +01:00
parent 007e1522b7
commit a0abec6a85
3 changed files with 11 additions and 12 deletions

View File

@ -1,6 +1,6 @@
# For using the alias import-office-tables, # copy these exports to .environment (ignored by git) # For using the alias import-office-tables, # copy these exports to .environment (ignored by git)
# and amend them according to your external DB: # and amend them according to your external DB:
export HSADMINNG_POSTGRES_JDBC_URL= 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= export HSADMINNG_POSTGRES_ADMIN_PASSWORD=
export HSADMINNG_POSTGRES_RESTRICTED_USERNAME=restricted export HSADMINNG_POSTGRES_RESTRICTED_USERNAME=restricted
@ -45,19 +45,20 @@ postgresAutodoc () {
} }
alias postgres-autodoc=postgresAutodoc alias postgres-autodoc=postgresAutodoc
function importOfficeTables() { function importOfficeData() {
export HSADMINNG_POSTGRES_JDBC=jdbc:postgresql://localhost:5432/postgres export HSADMINNG_POSTGRES_JDBC=jdbc:tc:postgresql:15.5-bookworm:///spring_boot_testcontainers
export HSADMINNG_POSTGRES_ADMIN_USERNAME=hsh99_admin export HSADMINNG_POSTGRES_ADMIN_USERNAME=admin
export HSADMINNG_POSTGRES_ADMIN_PASSWORD=password export HSADMINNG_POSTGRES_ADMIN_PASSWORD=password
export HSADMINNG_POSTGRES_RESTRICTED_USERNAME=hsh99_restricted export HSADMINNG_POSTGRES_RESTRICTED_USERNAME=restricted
export HSADMINNG_SUPERUSER=superuser-alex@hostsharing.net
if [ -f .environment ]; then if [ -f .environment ]; then
source .environment source .environment
fi fi
./gradlew test --tests ImportOfficeTables -x pitest ./gradlew importOfficeData
} }
alias import-office-tables=importOfficeTables alias import-office-data=importOfficeData
alias podman-start='systemctl --user enable --now podman.socket && systemctl --user status podman.socket && ls -la /run/user/$UID/podman/podman.sock' alias podman-start='systemctl --user enable --now podman.socket && systemctl --user status podman.socket && ls -la /run/user/$UID/podman/podman.sock'
alias podman-stop='systemctl --user disable --now podman.socket && systemctl --user status podman.socket && ls -la /run/user/$UID/podman/podman.sock' alias podman-stop='systemctl --user disable --now podman.socket && systemctl --user status podman.socket && ls -la /run/user/$UID/podman/podman.sock'

View File

@ -301,7 +301,7 @@ jacocoTestCoverageVerification {
} }
} }
tasks.register('importTest', Test) { tasks.register('importOfficeData', Test) {
useJUnitPlatform { useJUnitPlatform {
includeTags 'import' includeTags 'import'
} }
@ -309,7 +309,7 @@ tasks.register('importTest', Test) {
group 'verification' group 'verification'
description 'run the import jobs as tests' description 'run the import jobs as tests'
} }
test.dependsOn tasks.importTest test.dependsOn tasks.importOfficeData
// pitest mutation testing // pitest mutation testing

View File

@ -109,7 +109,7 @@ import static org.assertj.core.api.Fail.fail;
@Import({ Context.class, JpaAttempt.class }) @Import({ Context.class, JpaAttempt.class })
@TestMethodOrder(MethodOrderer.OrderAnnotation.class) @TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@ExtendWith(OrderedDependedTestsExtension.class) @ExtendWith(OrderedDependedTestsExtension.class)
public class ImportOfficeTables extends ContextBasedTest { public class ImportOfficeData extends ContextBasedTest {
@Value("${spring.datasource.username}") @Value("${spring.datasource.username}")
private String postgresAdminUser; private String postgresAdminUser;
@ -129,8 +129,6 @@ public class ImportOfficeTables extends ContextBasedTest {
private static NavigableMap<Integer, HsOfficeCoopSharesTransactionEntity> coopShares = new TreeMap<>(); private static NavigableMap<Integer, HsOfficeCoopSharesTransactionEntity> coopShares = new TreeMap<>();
private static NavigableMap<Integer, HsOfficeCoopAssetsTransactionEntity> coopAssets = new TreeMap<>(); private static NavigableMap<Integer, HsOfficeCoopAssetsTransactionEntity> coopAssets = new TreeMap<>();
private static int personId = 900000;
@PersistenceContext @PersistenceContext
EntityManager em; EntityManager em;