Skip to content

Commit 60f3273

Browse files
committed
Add diagnostics into StompServerIntegrationTests
Add `n` number for iteration to avoid infinity wait
1 parent a10e317 commit 60f3273

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.apache.activemq.broker.BrokerService;
2323
import org.junit.jupiter.api.AfterAll;
2424
import org.junit.jupiter.api.BeforeAll;
25-
import org.junit.jupiter.api.Disabled;
2625
import org.junit.jupiter.api.Test;
2726

2827
import org.springframework.context.ApplicationEvent;
@@ -46,6 +45,7 @@
4645
import org.springframework.integration.stomp.inbound.StompInboundChannelAdapter;
4746
import org.springframework.integration.stomp.outbound.StompMessageHandler;
4847
import org.springframework.integration.support.converter.PassThruMessageConverter;
48+
import org.springframework.integration.test.condition.LogLevels;
4949
import org.springframework.messaging.Message;
5050
import org.springframework.messaging.MessageChannel;
5151
import org.springframework.messaging.MessageDeliveryException;
@@ -63,7 +63,7 @@
6363
*
6464
* @since 4.2
6565
*/
66-
@Disabled("Until the fix in reactor-netty-core")
66+
@LogLevels(level = "trace", categories = { "reactor.netty.tcp", "io.netty" })
6767
public class StompServerIntegrationTests {
6868

6969
private static BrokerService activeMQBroker;
@@ -109,11 +109,12 @@ public void testStompAdapters() throws Exception {
109109
MessageChannel stompOutputChannel1 = context1.getBean("stompOutputChannel", MessageChannel.class);
110110
MessageChannel stompOutputChannel2 = context2.getBean("stompOutputChannel", MessageChannel.class);
111111

112+
int n = 0;
112113
Message<?> eventMessage;
113114
do {
114115
eventMessage = stompEvents1.receive(10000);
115116
}
116-
while (eventMessage != null && !(eventMessage.getPayload() instanceof StompSessionConnectedEvent));
117+
while (eventMessage != null && !(eventMessage.getPayload() instanceof StompSessionConnectedEvent) && n++ < 100);
117118

118119
assertThat(eventMessage).isNotNull();
119120

@@ -193,11 +194,12 @@ public void testStompAdapters() throws Exception {
193194

194195
activeMQBroker.stop();
195196

197+
n = 0;
196198
do {
197199
eventMessage = stompEvents1.receive(10000);
198200
assertThat(eventMessage).isNotNull();
199201
}
200-
while (!(eventMessage.getPayload() instanceof StompConnectionFailedEvent));
202+
while (!(eventMessage.getPayload() instanceof StompConnectionFailedEvent) && n++ < 100);
201203

202204

203205
assertThatExceptionOfType(MessageDeliveryException.class)
@@ -206,11 +208,12 @@ public void testStompAdapters() throws Exception {
206208

207209
activeMQBroker.start(false);
208210

211+
n = 0;
209212
do {
210213
eventMessage = stompEvents1.receive(20000);
211214
assertThat(eventMessage).isNotNull();
212215
}
213-
while (!(eventMessage.getPayload() instanceof StompReceiptEvent));
216+
while (!(eventMessage.getPayload() instanceof StompReceiptEvent) && n++ < 100);
214217

215218
do {
216219
eventMessage = stompEvents2.receive(10000);

0 commit comments

Comments
 (0)