88import org .springframework .boot .test .context .SpringBootTest ;
99import org .springframework .boot .test .mock .mockito .MockBean ;
1010import org .springframework .boot .web .server .LocalServerPort ;
11+ import org .springframework .test .context .DynamicPropertyRegistry ;
12+ import org .springframework .test .context .DynamicPropertySource ;
1113import org .springframework .test .web .reactive .server .WebTestClient ;
1214import org .testcontainers .containers .DockerComposeContainer ;
1315import org .testcontainers .containers .wait .strategy .Wait ;
2426@ SpringBootTest (webEnvironment = SpringBootTest .WebEnvironment .RANDOM_PORT )
2527public class ResetE2ETest {
2628
27- final static int PORT_A = 8024 ;
28- final static int PORT_B = 8124 ;
29+ private static final int HTTP_PORT = 8024 ;
30+ private static final int GRPC_PORT = 8124 ;
2931
3032 @ LocalServerPort
3133 private int port ;
@@ -42,10 +44,19 @@ public class ResetE2ETest {
4244 @ Container
4345 public static DockerComposeContainer environment =
4446 new DockerComposeContainer (new File ("src/test/resources/compose-test.yml" ))
45- .withExposedService ("axonserver" , PORT_A , Wait .forListeningPort ())
46- .withExposedService ("axonserver" , PORT_B , Wait .forListeningPort ())
47+ .withExposedService ("axonserver" , HTTP_PORT , Wait .forListeningPort ())
48+ .withExposedService ("axonserver" , GRPC_PORT , Wait .forListeningPort ())
4749 .waitingFor ("axonserver" , Wait .forLogMessage (".*Started AxonServer in .*" ,1 ));
50+ @ DynamicPropertySource
51+ public static void properties (DynamicPropertyRegistry registry ) {
4852
53+ int grpcPort = environment .getServicePort ("axonserver" , GRPC_PORT );
54+ int httpPort = environment .getServicePort ("axonserver" , HTTP_PORT );
55+
56+ registry .add ("axon.axonserver.servers" , () -> "localhost:" +grpcPort );
57+ registry .add ("axon.axonserver.http-url" , () -> "http://localhost:" +httpPort );
58+
59+ }
4960 @ Test
5061 void testEventsAreCreated (){
5162 prepareIntegrationTest ();
0 commit comments