From 6b118b270ff77f93ee26be8de53706ddba9de277 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Tue, 18 Jun 2024 18:43:24 +0530 Subject: [PATCH] fix: random port added for management url --- .../config/TestContextInitializer.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java index 6c07d12f4..c27f5201e 100644 --- a/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java +++ b/miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java @@ -28,14 +28,15 @@ import org.springframework.context.ConfigurableApplicationContext; import org.testcontainers.containers.PostgreSQLContainer; -import javax.crypto.KeyGenerator; -import javax.crypto.SecretKey; import java.net.ServerSocket; import java.util.Base64; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; public class TestContextInitializer implements ApplicationContextInitializer { private static final int port = findFreePort(); + private static final int MANAGEMENT_PORT = findFreePort(); private static final KeycloakContainer KEYCLOAK_CONTAINER = new KeycloakContainer().withRealmImportFile("miw-test-realm.json"); private static final PostgreSQLContainer POSTGRE_SQL_CONTAINER = new PostgreSQLContainer<>("postgres:14.5") .withDatabaseName("integration-tests-db") @@ -53,10 +54,11 @@ public void initialize(ConfigurableApplicationContext applicationContext) { SecretKey secretKey = keyGen.generateKey(); TestPropertyValues.of( "server.port=" + port, + "management.server.port=" + MANAGEMENT_PORT, "miw.host: localhost:${server.port}", "miw.enforceHttps=false", "miw.vcExpiryDate=1-1-2030", - "miw.encryptionKey="+ Base64.getEncoder().encodeToString(secretKey.getEncoded()), + "miw.encryptionKey=" + Base64.getEncoder().encodeToString(secretKey.getEncoded()), "miw.authorityWalletBpn: BPNL000000000000", "miw.authorityWalletName: Test-X", "miw.authorityWalletDid: did:web:localhost%3A${server.port}:BPNL000000000000",