Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adapt to new version
Browse files Browse the repository at this point in the history
ndr-brt committed Jul 9, 2024

Verified

This commit was signed with the committer’s verified signature.
watson Thomas Watson
1 parent 4f15803 commit 14fc7d3
Showing 6 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -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))
}
3 changes: 3 additions & 0 deletions edc-tests/edc-controlplane/catalog-tests/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -29,6 +29,9 @@ dependencies {
testImplementation(libs.edc.junit)
testImplementation(libs.restAssured)
testImplementation(libs.awaitility)

testCompileOnly(project(":edc-tests:runtime:runtime-memory"))
testCompileOnly(project(":edc-tests:runtime:runtime-postgresql"))
}

// do not publish
7 changes: 3 additions & 4 deletions edc-tests/edc-controlplane/fixtures/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@

package org.eclipse.tractusx.edc.tests.runtimes;

import org.eclipse.edc.junit.extensions.EmbeddedRuntime;
import org.eclipse.edc.junit.extensions.RuntimePerClassExtension;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
@@ -40,10 +39,6 @@ public ParticipantRuntimeExtension(String moduleName, String runtimeName, String
}
}

public ParticipantRuntimeExtension(EmbeddedRuntime embeddedRuntime) {
super(embeddedRuntime);
}

@Override
public void afterEach(ExtensionContext extensionContext) {
((ParticipantRuntime) runtime).getWiper().clearPersistence();
Original file line number Diff line number Diff line change
@@ -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;
@@ -45,7 +46,7 @@ public class PgRuntimeExtension extends ParticipantRuntimeExtension {
private final String dbName;

public PgRuntimeExtension(String moduleName, String runtimeName, String bpn, Map<String, String> properties) {
super(new ParticipantRuntime(moduleName, runtimeName, bpn, properties));
super(moduleName, runtimeName, bpn, properties, null);
this.dbName = runtimeName.toLowerCase();
postgreSqlContainer = new PostgreSQLContainer<>(POSTGRES_IMAGE_NAME)
.withLabel("runtime", dbName)
@@ -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());
}
1 change: 1 addition & 0 deletions edc-tests/runtime/runtime-postgresql/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@ dependencies {
implementation(libs.edc.core.controlplane)
// for the controller
implementation(libs.jakarta.rsApi)
runtimeOnly(libs.edc.transaction.local)
}

application {

0 comments on commit 14fc7d3

Please sign in to comment.