Skip to content

Commit

Permalink
adapt to new version
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed Jul 9, 2024
1 parent 4f15803 commit a14e347
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
7 changes: 3 additions & 4 deletions edc-tests/edc-controlplane/fixtures/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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());
}
Expand Down
1 change: 1 addition & 0 deletions edc-tests/runtime/runtime-postgresql/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ dependencies {
implementation(libs.edc.core.controlplane)
// for the controller
implementation(libs.jakarta.rsApi)
runtimeOnly(libs.edc.transaction.local)
}

application {
Expand Down

0 comments on commit a14e347

Please sign in to comment.