8
8
import org .springframework .boot .test .context .SpringBootTest ;
9
9
import org .springframework .boot .test .mock .mockito .MockBean ;
10
10
import org .springframework .boot .web .server .LocalServerPort ;
11
+ import org .springframework .test .context .DynamicPropertyRegistry ;
12
+ import org .springframework .test .context .DynamicPropertySource ;
11
13
import org .springframework .test .web .reactive .server .WebTestClient ;
12
14
import org .testcontainers .containers .DockerComposeContainer ;
13
15
import org .testcontainers .containers .wait .strategy .Wait ;
24
26
@ SpringBootTest (webEnvironment = SpringBootTest .WebEnvironment .RANDOM_PORT )
25
27
public class ResetE2ETest {
26
28
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 ;
29
31
30
32
@ LocalServerPort
31
33
private int port ;
@@ -42,10 +44,19 @@ public class ResetE2ETest {
42
44
@ Container
43
45
public static DockerComposeContainer environment =
44
46
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 ())
47
49
.waitingFor ("axonserver" , Wait .forLogMessage (".*Started AxonServer in .*" ,1 ));
50
+ @ DynamicPropertySource
51
+ public static void properties (DynamicPropertyRegistry registry ) {
48
52
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
+ }
49
60
@ Test
50
61
void testEventsAreCreated (){
51
62
prepareIntegrationTest ();
0 commit comments