diff --git a/edc-extensions/migrations/postgresql-migration-lib/build.gradle.kts b/edc-extensions/migrations/postgresql-migration-lib/build.gradle.kts index 1a4b8e044..e993eec8b 100644 --- a/edc-extensions/migrations/postgresql-migration-lib/build.gradle.kts +++ b/edc-extensions/migrations/postgresql-migration-lib/build.gradle.kts @@ -36,6 +36,4 @@ dependencies { // so we need to add PG support explicitly // https://documentation.red-gate.com/flyway/release-notes-and-older-versions/release-notes-for-flyway-engine runtimeOnly(libs.flyway.database.postgres) - - testImplementation(testFixtures(libs.edc.sql.core)) } diff --git a/edc-tests/edc-controlplane/fixtures/build.gradle.kts b/edc-tests/edc-controlplane/fixtures/build.gradle.kts index 36972578b..b40ec289a 100644 --- a/edc-tests/edc-controlplane/fixtures/build.gradle.kts +++ b/edc-tests/edc-controlplane/fixtures/build.gradle.kts @@ -47,15 +47,14 @@ dependencies { testFixturesImplementation(libs.edc.identity.trust.sts.embedded) testFixturesImplementation(libs.edc.core.token) testFixturesImplementation(libs.edc.spi.identity.did) - testFixturesImplementation(testFixtures(libs.edc.sql.core)) + testFixturesImplementation(libs.postgres) testFixturesImplementation(libs.testcontainers.postgres) - - testCompileOnly(project(":edc-tests:runtime:runtime-memory")) - testFixturesImplementation(libs.assertj) testFixturesImplementation(libs.junit.jupiter.api) testFixturesImplementation(project(":edc-extensions:bpn-validation:bpn-validation-spi")) + testCompileOnly(project(":edc-tests:runtime:runtime-memory")) + testCompileOnly(project(":edc-tests:runtime:runtime-postgresql")) } // do not publish diff --git a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/runtimes/PgRuntimeExtension.java b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/runtimes/PgRuntimeExtension.java index 6472aebee..fb0ac80be 100644 --- a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/runtimes/PgRuntimeExtension.java +++ b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/runtimes/PgRuntimeExtension.java @@ -19,11 +19,12 @@ package org.eclipse.tractusx.edc.tests.runtimes; -import org.eclipse.edc.sql.testfixtures.PostgresqlLocalInstance; import org.junit.jupiter.api.extension.ExtensionContext; import org.testcontainers.containers.PostgreSQLContainer; import org.testcontainers.containers.wait.strategy.Wait; +import java.sql.DriverManager; +import java.sql.SQLException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -62,8 +63,7 @@ public void beforeAll(ExtensionContext context) { postgreSqlContainer.waitingFor(Wait.forHealthcheck()); var config = postgresqlConfiguration(dbName); config.forEach(System::setProperty); - PostgresqlLocalInstance helper = new PostgresqlLocalInstance(postgreSqlContainer.getUsername(), postgreSqlContainer.getPassword(), baseJdbcUrl(), postgreSqlContainer.getDatabaseName()); - helper.createDatabase(); + createDatabase(); super.beforeAll(context); } @@ -95,6 +95,14 @@ public String jdbcUrl(String name) { return baseJdbcUrl() + name + "?currentSchema=" + DB_SCHEMA_NAME; } + private void createDatabase() { + try (var connection = DriverManager.getConnection(baseJdbcUrl() + "postgres", postgreSqlContainer.getUsername(), postgreSqlContainer.getPassword())) { + connection.createStatement().execute(String.format("create database %s;", postgreSqlContainer.getDatabaseName())); + } catch (SQLException ignored) { + + } + } + public String baseJdbcUrl() { return format("jdbc:postgresql://%s:%s/", postgreSqlContainer.getHost(), postgreSqlContainer.getFirstMappedPort()); } diff --git a/edc-tests/runtime/runtime-postgresql/build.gradle.kts b/edc-tests/runtime/runtime-postgresql/build.gradle.kts index f05dad383..b4071b82d 100644 --- a/edc-tests/runtime/runtime-postgresql/build.gradle.kts +++ b/edc-tests/runtime/runtime-postgresql/build.gradle.kts @@ -49,6 +49,7 @@ dependencies { implementation(libs.edc.core.controlplane) // for the controller implementation(libs.jakarta.rsApi) + runtimeOnly(libs.edc.transaction.local) } application {