From c34ca185b2b7bc67a58ae00859ea92521e6c6aca Mon Sep 17 00:00:00 2001 From: Enrico Risa Date: Tue, 18 Jul 2023 17:27:13 +0200 Subject: [PATCH] add testcontainers pg for E2E tests --- DEPENDENCIES | 3 + .../edc/edr/core/manager/EdrManagerImpl.java | 4 +- edc-tests/e2e-tests/build.gradle.kts | 3 + .../helpers/TxPostgresqlLocalInstance.java | 82 +++++++++++++++++++ .../edc/lifecycle/PgParticipantRuntime.java | 77 ++++++++++++++++- .../lifecycle/TestRuntimeConfiguration.java | 48 ----------- .../tests/catalog/CatalogPostgresqlTest.java | 8 +- .../tests/edr/NegotiateEdrPostgresqlTest.java | 8 +- .../edc/tests/edr/RenewalEdrInMemoryTest.java | 4 +- .../tests/edr/RenewalEdrPostgresqlTest.java | 8 +- .../tractusx/edc/tests/edr/TestFunctions.java | 8 +- .../proxy/DataPlaneProxyPostgresqlTest.java | 10 +-- ...tpConsumerPullWithProxyPostgresqlTest.java | 8 +- gradle/libs.versions.toml | 1 + 14 files changed, 191 insertions(+), 81 deletions(-) create mode 100644 edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/TxPostgresqlLocalInstance.java diff --git a/DEPENDENCIES b/DEPENDENCIES index 2a314f3cf..baf5db93f 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -455,7 +455,10 @@ maven/mavencentral/org.slf4j/slf4j-api/1.7.36, MIT, approved, CQ13368 maven/mavencentral/org.slf4j/slf4j-api/1.7.7, MIT, approved, CQ9827 maven/mavencentral/org.slf4j/slf4j-api/2.0.5, MIT, approved, #5915 maven/mavencentral/org.slf4j/slf4j-api/2.0.7, MIT, approved, #5915 +maven/mavencentral/org.testcontainers/database-commons/1.18.3, MIT, approved, clearlydefined +maven/mavencentral/org.testcontainers/jdbc/1.18.3, MIT, approved, clearlydefined maven/mavencentral/org.testcontainers/junit-jupiter/1.18.3, MIT, approved, #7941 +maven/mavencentral/org.testcontainers/postgresql/1.18.3, MIT, approved, #9332 maven/mavencentral/org.testcontainers/testcontainers/1.18.3, MIT, approved, #7938 maven/mavencentral/org.testcontainers/vault/1.18.3, MIT, approved, #7927 maven/mavencentral/org.yaml/snakeyaml/1.33, Apache-2.0, approved, clearlydefined diff --git a/core/edr-core/src/main/java/org/eclipse/tractusx/edc/edr/core/manager/EdrManagerImpl.java b/core/edr-core/src/main/java/org/eclipse/tractusx/edc/edr/core/manager/EdrManagerImpl.java index 4186c364b..911006a69 100644 --- a/core/edr-core/src/main/java/org/eclipse/tractusx/edc/edr/core/manager/EdrManagerImpl.java +++ b/core/edr-core/src/main/java/org/eclipse/tractusx/edc/edr/core/manager/EdrManagerImpl.java @@ -184,7 +184,7 @@ private boolean processNegotiated(EndpointDataReferenceEntry edrEntry) { .execute("Start an EDR token renewal"); } else { breakLease(edrEntry); - return true; + return false; } } @@ -200,7 +200,7 @@ private boolean processExpired(EndpointDataReferenceEntry edrEntry) { .execute("Start an EDR token deletion"); } else { breakLease(edrEntry); - return true; + return false; } } diff --git a/edc-tests/e2e-tests/build.gradle.kts b/edc-tests/e2e-tests/build.gradle.kts index c9093b248..84d4f7b6a 100644 --- a/edc-tests/e2e-tests/build.gradle.kts +++ b/edc-tests/e2e-tests/build.gradle.kts @@ -45,6 +45,9 @@ dependencies { testCompileOnly(project(":edc-tests:runtime:runtime-memory-ssi")) testCompileOnly(project(":edc-tests:runtime:runtime-postgresql")) testImplementation(libs.edc.auth.oauth2.client) + testImplementation(libs.testcontainers.junit) + testImplementation(libs.testcontainers.postgres) + } // do not publish diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/TxPostgresqlLocalInstance.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/TxPostgresqlLocalInstance.java new file mode 100644 index 000000000..eaac4e0e2 --- /dev/null +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/TxPostgresqlLocalInstance.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2022 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + * + * Contributors: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + +package org.eclipse.tractusx.edc.helpers; + +import org.postgresql.ds.PGSimpleDataSource; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import javax.sql.DataSource; + +import static java.lang.String.format; + +@Deprecated(forRemoval = true) +public final class TxPostgresqlLocalInstance { + private final String password; + private final String jdbcUrlPrefix; + private final String username; + private final String databaseName; + + public TxPostgresqlLocalInstance(String user, String password, String jdbcUrlPrefix, String db) { + username = user; + this.password = password; + this.jdbcUrlPrefix = jdbcUrlPrefix; + databaseName = db; + } + + public void createDatabase() { + createDatabase(databaseName); + } + + public void createDatabase(String name) { + try (var connection = DriverManager.getConnection(jdbcUrlPrefix + username, username, password)) { + connection.createStatement().execute(format("create database %s;", name)); + } catch (SQLException e) { + e.printStackTrace(); + // database could already exist + } + } + + public Connection getTestConnection(String hostName, int port, String dbName) { + try { + return createTestDataSource(hostName, port, dbName).getConnection(); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + public Connection getConnection() { + try { + return DriverManager.getConnection(jdbcUrlPrefix, username, password); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + public String getJdbcUrlPrefix() { + return jdbcUrlPrefix; + } + + private DataSource createTestDataSource(String hostName, int port, String dbName) { + var dataSource = new PGSimpleDataSource(); + dataSource.setServerNames(new String[]{ hostName }); + dataSource.setPortNumbers(new int[]{ port }); + dataSource.setUser(username); + dataSource.setPassword(password); + dataSource.setDatabaseName(dbName); + return dataSource; + } +} diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/PgParticipantRuntime.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/PgParticipantRuntime.java index f66b01bf3..c16a1490c 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/PgParticipantRuntime.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/PgParticipantRuntime.java @@ -22,17 +22,33 @@ import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; import org.eclipse.edc.spi.system.injection.InjectionContainer; -import org.eclipse.edc.sql.testfixtures.PostgresqlLocalInstance; +import org.eclipse.tractusx.edc.helpers.TxPostgresqlLocalInstance; import org.eclipse.tractusx.edc.token.MockDapsService; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.testcontainers.containers.PostgreSQLContainer; +import java.util.HashMap; import java.util.List; import java.util.Map; +import static java.lang.String.format; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.DB_SCHEMA_NAME; import static org.mockito.Mockito.mock; public class PgParticipantRuntime extends ParticipantRuntime { + private static final String POSTGRES_IMAGE_NAME = "postgres:14.2"; + private static final String USER = "postgres"; + private static final String PASSWORD = "password"; + + private final String dbName; + public PostgreSQLContainer postgreSqlContainer = new PostgreSQLContainer<>(POSTGRES_IMAGE_NAME) + .withExposedPorts(5432) + .withUsername(USER) + .withPassword(PASSWORD) + .withDatabaseName("itest"); + private TxPostgresqlLocalInstance helper; public PgParticipantRuntime(String moduleName, String runtimeName, String bpn, Map properties) { super(moduleName, runtimeName, bpn, properties); @@ -41,12 +57,69 @@ public PgParticipantRuntime(String moduleName, String runtimeName, String bpn, M this.registerServiceMock(Vault.class, new InMemoryVaultOverride(mock(Monitor.class))); } + @Override + public void beforeAll(ExtensionContext context) throws Exception { + postgreSqlContainer.start(); + var config = postgresqlConfiguration(dbName); + config.forEach(System::setProperty); + super.beforeAll(context); + } + + @Override + public void afterAll(ExtensionContext context) throws Exception { + super.afterAll(context); + postgreSqlContainer.stop(); + postgreSqlContainer.close(); + } + @Override protected void bootExtensions(ServiceExtensionContext context, List> serviceExtensions) { - PostgresqlLocalInstance.createDatabase(dbName); + helper = new TxPostgresqlLocalInstance(postgreSqlContainer.getUsername(), postgreSqlContainer.getPassword(), baseJdbcUrl(), postgreSqlContainer.getDatabaseName()); + helper.createDatabase(dbName); super.bootExtensions(context, serviceExtensions); } + public Map postgresqlConfiguration(String name) { + var jdbcUrl = jdbcUrl(name); + return new HashMap<>() { + { + put("edc.datasource.asset.name", "asset"); + put("edc.datasource.asset.url", jdbcUrl); + put("edc.datasource.asset.user", USER); + put("edc.datasource.asset.password", PASSWORD); + put("edc.datasource.contractdefinition.name", "contractdefinition"); + put("edc.datasource.contractdefinition.url", jdbcUrl); + put("edc.datasource.contractdefinition.user", USER); + put("edc.datasource.contractdefinition.password", PASSWORD); + put("edc.datasource.contractnegotiation.name", "contractnegotiation"); + put("edc.datasource.contractnegotiation.url", jdbcUrl); + put("edc.datasource.contractnegotiation.user", USER); + put("edc.datasource.contractnegotiation.password", PASSWORD); + put("edc.datasource.policy.name", "policy"); + put("edc.datasource.policy.url", jdbcUrl); + put("edc.datasource.policy.user", USER); + put("edc.datasource.policy.password", PASSWORD); + put("edc.datasource.transferprocess.name", "transferprocess"); + put("edc.datasource.transferprocess.url", jdbcUrl); + put("edc.datasource.transferprocess.user", USER); + put("edc.datasource.transferprocess.password", PASSWORD); + put("edc.datasource.edr.name", "edr"); + put("edc.datasource.edr.url", jdbcUrl); + put("edc.datasource.edr.user", USER); + put("edc.datasource.edr.password", PASSWORD); + // use non-default schema name to test usage of non-default schema + put("org.eclipse.tractusx.edc.postgresql.migration.schema", DB_SCHEMA_NAME); + } + }; + } + + public String jdbcUrl(String name) { + return baseJdbcUrl() + name + "?currentSchema=" + DB_SCHEMA_NAME; + } + + public String baseJdbcUrl() { + return format("jdbc:postgresql://%s:%s/", postgreSqlContainer.getHost(), postgreSqlContainer.getFirstMappedPort()); + } private static class InMemoryVaultOverride extends InMemoryVault { diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java index 6823c4653..8e944b7aa 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java @@ -66,54 +66,6 @@ public class TestRuntimeConfiguration { static final String OAUTH_TOKEN_URL = "http://localhost:" + OAUTH_PORT; - public static Map sokratesPostgresqlConfiguration() { - var baseConfiguration = sokratesConfiguration(); - var postgresConfiguration = postgresqlConfiguration(SOKRATES_NAME.toLowerCase()); - baseConfiguration.putAll(postgresConfiguration); - return baseConfiguration; - } - - public static Map platoPostgresqlConfiguration() { - var baseConfiguration = platoConfiguration(); - var postgresConfiguration = postgresqlConfiguration(PLATO_NAME.toLowerCase()); - baseConfiguration.putAll(postgresConfiguration); - return baseConfiguration; - } - - public static Map postgresqlConfiguration(String name) { - var jdbcUrl = jdbcUrl(name); - return new HashMap<>() { - { - put("edc.datasource.asset.name", "asset"); - put("edc.datasource.asset.url", jdbcUrl); - put("edc.datasource.asset.user", PostgresqlLocalInstance.USER); - put("edc.datasource.asset.password", PostgresqlLocalInstance.PASSWORD); - put("edc.datasource.contractdefinition.name", "contractdefinition"); - put("edc.datasource.contractdefinition.url", jdbcUrl); - put("edc.datasource.contractdefinition.user", PostgresqlLocalInstance.USER); - put("edc.datasource.contractdefinition.password", PostgresqlLocalInstance.PASSWORD); - put("edc.datasource.contractnegotiation.name", "contractnegotiation"); - put("edc.datasource.contractnegotiation.url", jdbcUrl); - put("edc.datasource.contractnegotiation.user", PostgresqlLocalInstance.USER); - put("edc.datasource.contractnegotiation.password", PostgresqlLocalInstance.PASSWORD); - put("edc.datasource.policy.name", "policy"); - put("edc.datasource.policy.url", jdbcUrl); - put("edc.datasource.policy.user", PostgresqlLocalInstance.USER); - put("edc.datasource.policy.password", PostgresqlLocalInstance.PASSWORD); - put("edc.datasource.transferprocess.name", "transferprocess"); - put("edc.datasource.transferprocess.url", jdbcUrl); - put("edc.datasource.transferprocess.user", PostgresqlLocalInstance.USER); - put("edc.datasource.transferprocess.password", PostgresqlLocalInstance.PASSWORD); - put("edc.datasource.edr.name", "edr"); - put("edc.datasource.edr.url", jdbcUrl); - put("edc.datasource.edr.user", PostgresqlLocalInstance.USER); - put("edc.datasource.edr.password", PostgresqlLocalInstance.PASSWORD); - // use non-default schema name to test usage of non-default schema - put("org.eclipse.tractusx.edc.postgresql.migration.schema", DB_SCHEMA_NAME); - } - }; - } - public static Map sokratesSsiConfiguration() { var ssiConfiguration = new HashMap() { { diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/catalog/CatalogPostgresqlTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/catalog/CatalogPostgresqlTest.java index 5af78043d..4ded2fc29 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/catalog/CatalogPostgresqlTest.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/catalog/CatalogPostgresqlTest.java @@ -22,8 +22,8 @@ import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.PLATO_NAME; import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_BPN; import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_NAME; -import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.platoPostgresqlConfiguration; -import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.sokratesPostgresqlConfiguration; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.platoConfiguration; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.sokratesConfiguration; @PostgresqlDbIntegrationTest public class CatalogPostgresqlTest extends AbstractCatalogTest { @@ -33,13 +33,13 @@ public class CatalogPostgresqlTest extends AbstractCatalogTest { ":edc-tests:runtime:runtime-postgresql", SOKRATES_NAME, SOKRATES_BPN, - sokratesPostgresqlConfiguration() + sokratesConfiguration() ); @RegisterExtension protected static final PgParticipantRuntime PLATO_RUNTIME = new PgParticipantRuntime( ":edc-tests:runtime:runtime-postgresql", PLATO_NAME, PLATO_BPN, - platoPostgresqlConfiguration() + platoConfiguration() ); } diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/NegotiateEdrPostgresqlTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/NegotiateEdrPostgresqlTest.java index ec2ccf7bf..37f1e72f7 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/NegotiateEdrPostgresqlTest.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/NegotiateEdrPostgresqlTest.java @@ -22,8 +22,8 @@ import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.PLATO_NAME; import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_BPN; import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_NAME; -import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.platoPostgresqlConfiguration; -import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.sokratesPostgresqlConfiguration; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.platoConfiguration; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.sokratesConfiguration; @PostgresqlDbIntegrationTest public class NegotiateEdrPostgresqlTest extends AbstractNegotiateEdrTest { @@ -33,14 +33,14 @@ public class NegotiateEdrPostgresqlTest extends AbstractNegotiateEdrTest { ":edc-tests:runtime:runtime-postgresql", SOKRATES_NAME, SOKRATES_BPN, - sokratesPostgresqlConfiguration() + sokratesConfiguration() ); @RegisterExtension protected static final PgParticipantRuntime PLATO_RUNTIME = new PgParticipantRuntime( ":edc-tests:runtime:runtime-postgresql", PLATO_NAME, PLATO_BPN, - platoPostgresqlConfiguration() + platoConfiguration() ); } diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/RenewalEdrInMemoryTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/RenewalEdrInMemoryTest.java index d68bfc49a..da6f80ccb 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/RenewalEdrInMemoryTest.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/RenewalEdrInMemoryTest.java @@ -35,7 +35,7 @@ public class RenewalEdrInMemoryTest extends AbstractRenewalEdrTest { ":edc-tests:runtime:runtime-memory", SOKRATES_NAME, SOKRATES_BPN, - renewalConfiguration(sokratesConfiguration(), "60") + renewalConfiguration(sokratesConfiguration()) ); @RegisterExtension @@ -43,6 +43,6 @@ public class RenewalEdrInMemoryTest extends AbstractRenewalEdrTest { ":edc-tests:runtime:runtime-memory", PLATO_NAME, PLATO_BPN, - renewalConfiguration(platoConfiguration(), "60") + renewalConfiguration(platoConfiguration()) ); } diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/RenewalEdrPostgresqlTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/RenewalEdrPostgresqlTest.java index cd2c62e77..93cb8117e 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/RenewalEdrPostgresqlTest.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/RenewalEdrPostgresqlTest.java @@ -22,8 +22,8 @@ import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.PLATO_NAME; import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_BPN; import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_NAME; -import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.platoPostgresqlConfiguration; -import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.sokratesPostgresqlConfiguration; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.platoConfiguration; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.sokratesConfiguration; import static org.eclipse.tractusx.edc.tests.edr.TestFunctions.renewalConfiguration; @PostgresqlDbIntegrationTest @@ -34,14 +34,14 @@ public class RenewalEdrPostgresqlTest extends AbstractRenewalEdrTest { ":edc-tests:runtime:runtime-postgresql", SOKRATES_NAME, SOKRATES_BPN, - renewalConfiguration(sokratesPostgresqlConfiguration()) + renewalConfiguration(sokratesConfiguration()) ); @RegisterExtension protected static final PgParticipantRuntime PLATO_RUNTIME = new PgParticipantRuntime( ":edc-tests:runtime:runtime-postgresql", PLATO_NAME, PLATO_BPN, - renewalConfiguration(platoPostgresqlConfiguration()) + renewalConfiguration(platoConfiguration()) ); } diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/TestFunctions.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/TestFunctions.java index 529d6d3e6..9c6148144 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/TestFunctions.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/edr/TestFunctions.java @@ -27,11 +27,11 @@ public class TestFunctions { private static final ObjectMapper MAPPER = new ObjectMapper(); - public static Map renewalConfiguration(Map config, String retention) { + public static Map renewalConfiguration(Map config) { var ssiConfiguration = new HashMap() { { put("edc.edr.state-machine.expiring-duration", "4"); - put("edc.edr.state-machine.expired-retention", retention); + put("edc.edr.state-machine.expired-retention", "1"); put("edc.transfer.proxy.token.validity.seconds", "4"); } }; @@ -39,10 +39,6 @@ public static Map renewalConfiguration(Map confi return ssiConfiguration; } - public static Map renewalConfiguration(Map config) { - return renewalConfiguration(config, "1"); - } - public static ReceivedEvent waitForEvent(MockWebServer server, ReceivedEvent event) { try { var request = server.takeRequest(20, TimeUnit.SECONDS); diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/proxy/DataPlaneProxyPostgresqlTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/proxy/DataPlaneProxyPostgresqlTest.java index f2da5eba8..d6ce2d6bc 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/proxy/DataPlaneProxyPostgresqlTest.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/proxy/DataPlaneProxyPostgresqlTest.java @@ -22,24 +22,24 @@ import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.PLATO_NAME; import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_BPN; import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_NAME; -import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.platoPostgresqlConfiguration; -import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.sokratesPostgresqlConfiguration; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.platoConfiguration; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.sokratesConfiguration; @PostgresqlDbIntegrationTest public class DataPlaneProxyPostgresqlTest extends AbstractDataPlaneProxyTest { - + @RegisterExtension protected static final PgParticipantRuntime SOKRATES_RUNTIME = new PgParticipantRuntime( ":edc-tests:runtime:runtime-postgresql", SOKRATES_NAME, SOKRATES_BPN, - sokratesPostgresqlConfiguration() + sokratesConfiguration() ); @RegisterExtension protected static final PgParticipantRuntime PLATO_RUNTIME = new PgParticipantRuntime( ":edc-tests:runtime:runtime-postgresql", PLATO_NAME, PLATO_BPN, - platoPostgresqlConfiguration() + platoConfiguration() ); } diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/HttpConsumerPullWithProxyPostgresqlTest.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/HttpConsumerPullWithProxyPostgresqlTest.java index 887c7a307..61892beff 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/HttpConsumerPullWithProxyPostgresqlTest.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/HttpConsumerPullWithProxyPostgresqlTest.java @@ -22,8 +22,8 @@ import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.PLATO_NAME; import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_BPN; import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.SOKRATES_NAME; -import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.platoPostgresqlConfiguration; -import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.sokratesPostgresqlConfiguration; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.platoConfiguration; +import static org.eclipse.tractusx.edc.lifecycle.TestRuntimeConfiguration.sokratesConfiguration; @PostgresqlDbIntegrationTest public class HttpConsumerPullWithProxyPostgresqlTest extends AbstractHttpConsumerPullWithProxyTest { @@ -34,14 +34,14 @@ public class HttpConsumerPullWithProxyPostgresqlTest extends AbstractHttpConsume ":edc-tests:runtime:runtime-postgresql", SOKRATES_NAME, SOKRATES_BPN, - sokratesPostgresqlConfiguration() + sokratesConfiguration() ); @RegisterExtension protected static final PgParticipantRuntime PLATO_RUNTIME = new PgParticipantRuntime( ":edc-tests:runtime:runtime-postgresql", PLATO_NAME, PLATO_BPN, - platoPostgresqlConfiguration() + platoConfiguration() ); } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 136a11d1b..5eed1673e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -134,6 +134,7 @@ restAssured = { module = "io.rest-assured:rest-assured", version.ref = "restAssu apache-sshd-core = { module = "org.apache.sshd:sshd-core", version.ref = "apache-sshd" } apache-sshd-sftp = { module = "org.apache.sshd:sshd-sftp", version.ref = "apache-sshd" } testcontainers-junit = { module = "org.testcontainers:junit-jupiter", version.ref = "testcontainers" } +testcontainers-postgres = { module = "org.testcontainers:postgresql", version.ref = "testcontainers" } aws-s3 = { module = "software.amazon.awssdk:s3", version.ref = "aws" } jakarta-rsApi = { module = "jakarta.ws.rs:jakarta.ws.rs-api", version.ref = "rsApi" } jakartaJson = { module = "org.glassfish:jakarta.json", version.ref = "jakarta-json" }