88import org .slf4j .event .Level ;
99import org .testcontainers .containers .ContainerLaunchException ;
1010import org .testcontainers .containers .GenericContainer ;
11- import org .testcontainers .containers .wait .strategy .MultiLogMessageWaitStrategy ;
11+ import org .testcontainers .containers .wait .strategy .LogMessageWaitStrategy ;
12+ import org .testcontainers .containers .wait .strategy .WaitAllStrategy ;
1213import org .testcontainers .utility .DockerImageName ;
1314import org .testcontainers .utility .MountableFile ;
1415
@@ -48,7 +49,7 @@ public class HiveMQContainer extends GenericContainer<HiveMQContainer> {
4849 private final @ NotNull Set <String > prepackagedExtensionsToRemove = new HashSet <>();
4950 private boolean removeAllPrepackagedExtensions = false ;
5051
51- private final @ NotNull MultiLogMessageWaitStrategy waitStrategy = new MultiLogMessageWaitStrategy ();
52+ private final @ NotNull WaitAllStrategy waitStrategy = new WaitAllStrategy ();
5253
5354 public HiveMQContainer (final @ NotNull DockerImageName dockerImageName ) {
5455 super (dockerImageName );
@@ -57,7 +58,7 @@ public HiveMQContainer(final @NotNull DockerImageName dockerImageName) {
5758
5859 addExposedPort (MQTT_PORT );
5960
60- waitStrategy .withRegEx ("(.*)Started HiveMQ in(.*)" );
61+ waitStrategy .withStrategy ( new LogMessageWaitStrategy (). withRegEx ("(.*)Started HiveMQ in(.*)" ) );
6162 waitingFor (waitStrategy );
6263
6364 withLogConsumer (outputFrame -> {
@@ -121,7 +122,7 @@ protected void containerIsStarted(final @NotNull InspectContainerResponse contai
121122 */
122123 public @ NotNull HiveMQContainer waitForExtension (final @ NotNull String extensionName ) {
123124 final String regEX = "(.*)Extension \" " + extensionName + "\" version (.*) started successfully(.*)" ;
124- waitStrategy .withRegEx (regEX );
125+ waitStrategy .withStrategy ( new LogMessageWaitStrategy (). withRegEx (regEX ) );
125126 return self ();
126127 }
127128
@@ -562,11 +563,6 @@ public int getMqttPort() {
562563 return this .getMappedPort (MQTT_PORT );
563564 }
564565
565- @ Override
566- protected void containerIsStopping (final @ NotNull InspectContainerResponse containerInfo ) {
567- waitStrategy .reset ();
568- }
569-
570566 private @ NotNull MountableFile cloneWithFileMode (final @ NotNull MountableFile mountableFile ) {
571567 return MountableFile .forHostPath (mountableFile .getResolvedPath (), HiveMQContainer .MODE );
572568 }
0 commit comments