Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Commit 6b118b2

Browse files
committed
fix: random port added for management url
1 parent 44b46ff commit 6b118b2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

miw/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@
2828
import org.springframework.context.ConfigurableApplicationContext;
2929
import org.testcontainers.containers.PostgreSQLContainer;
3030

31-
import javax.crypto.KeyGenerator;
32-
import javax.crypto.SecretKey;
3331
import java.net.ServerSocket;
3432
import java.util.Base64;
33+
import javax.crypto.KeyGenerator;
34+
import javax.crypto.SecretKey;
3535

3636
public class TestContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
3737

3838
private static final int port = findFreePort();
39+
private static final int MANAGEMENT_PORT = findFreePort();
3940
private static final KeycloakContainer KEYCLOAK_CONTAINER = new KeycloakContainer().withRealmImportFile("miw-test-realm.json");
4041
private static final PostgreSQLContainer<?> POSTGRE_SQL_CONTAINER = new PostgreSQLContainer<>("postgres:14.5")
4142
.withDatabaseName("integration-tests-db")
@@ -53,10 +54,11 @@ public void initialize(ConfigurableApplicationContext applicationContext) {
5354
SecretKey secretKey = keyGen.generateKey();
5455
TestPropertyValues.of(
5556
"server.port=" + port,
57+
"management.server.port=" + MANAGEMENT_PORT,
5658
"miw.host: localhost:${server.port}",
5759
"miw.enforceHttps=false",
5860
"miw.vcExpiryDate=1-1-2030",
59-
"miw.encryptionKey="+ Base64.getEncoder().encodeToString(secretKey.getEncoded()),
61+
"miw.encryptionKey=" + Base64.getEncoder().encodeToString(secretKey.getEncoded()),
6062
"miw.authorityWalletBpn: BPNL000000000000",
6163
"miw.authorityWalletName: Test-X",
6264
"miw.authorityWalletDid: did:web:localhost%3A${server.port}:BPNL000000000000",

0 commit comments

Comments
 (0)