28
28
import org .springframework .context .ConfigurableApplicationContext ;
29
29
import org .testcontainers .containers .PostgreSQLContainer ;
30
30
31
- import javax .crypto .KeyGenerator ;
32
- import javax .crypto .SecretKey ;
33
31
import java .net .ServerSocket ;
34
32
import java .util .Base64 ;
33
+ import javax .crypto .KeyGenerator ;
34
+ import javax .crypto .SecretKey ;
35
35
36
36
public class TestContextInitializer implements ApplicationContextInitializer <ConfigurableApplicationContext > {
37
37
38
38
private static final int port = findFreePort ();
39
+ private static final int MANAGEMENT_PORT = findFreePort ();
39
40
private static final KeycloakContainer KEYCLOAK_CONTAINER = new KeycloakContainer ().withRealmImportFile ("miw-test-realm.json" );
40
41
private static final PostgreSQLContainer <?> POSTGRE_SQL_CONTAINER = new PostgreSQLContainer <>("postgres:14.5" )
41
42
.withDatabaseName ("integration-tests-db" )
@@ -53,10 +54,11 @@ public void initialize(ConfigurableApplicationContext applicationContext) {
53
54
SecretKey secretKey = keyGen .generateKey ();
54
55
TestPropertyValues .of (
55
56
"server.port=" + port ,
57
+ "management.server.port=" + MANAGEMENT_PORT ,
56
58
"miw.host: localhost:${server.port}" ,
57
59
"miw.enforceHttps=false" ,
58
60
"miw.vcExpiryDate=1-1-2030" ,
59
- "miw.encryptionKey=" + Base64 .getEncoder ().encodeToString (secretKey .getEncoded ()),
61
+ "miw.encryptionKey=" + Base64 .getEncoder ().encodeToString (secretKey .getEncoded ()),
60
62
"miw.authorityWalletBpn: BPNL000000000000" ,
61
63
"miw.authorityWalletName: Test-X" ,
62
64
"miw.authorityWalletDid: did:web:localhost%3A${server.port}:BPNL000000000000" ,
0 commit comments