42
42
import org .junit .Rule ;
43
43
import org .junit .Test ;
44
44
import org .junit .rules .TemporaryFolder ;
45
+ import org .slf4j .Logger ;
46
+ import org .slf4j .LoggerFactory ;
45
47
import org .testcontainers .containers .RabbitMQContainer ;
48
+ import org .testcontainers .containers .output .Slf4jLogConsumer ;
46
49
import org .testcontainers .containers .wait .strategy .Wait ;
47
50
import org .testcontainers .utility .DockerImageName ;
48
51
53
56
/** A class containing RabbitMQ source tests against a real RabbiMQ cluster. */
54
57
public class RMQSourceITCase {
55
58
59
+ private static final Logger LOG = LoggerFactory .getLogger (RMQSourceITCase .class );
60
+ private static final Slf4jLogConsumer LOG_CONSUMER = new Slf4jLogConsumer (LOG );
61
+
62
+ private static final int HANDSHAKE_TIMEOUT = 30000 ;
56
63
private static final int RABBITMQ_PORT = 5672 ;
57
64
private static final String QUEUE_NAME = "test-queue" ;
58
65
private static final JobID JOB_ID = new JobID ();
@@ -75,6 +82,7 @@ public class RMQSourceITCase {
75
82
new RabbitMQContainer (
76
83
DockerImageName .parse ("rabbitmq" ).withTag ("3.7.25-management-alpine" ))
77
84
.withExposedPorts (RABBITMQ_PORT )
85
+ .withLogConsumer (LOG_CONSUMER )
78
86
.waitingFor (Wait .forListeningPort ());
79
87
80
88
@ Before
@@ -127,6 +135,7 @@ private static Connection getRMQConnection() throws IOException, TimeoutExceptio
127
135
ConnectionFactory factory = new ConnectionFactory ();
128
136
factory .setUsername (RMQ_CONTAINER .getAdminUsername ());
129
137
factory .setPassword (RMQ_CONTAINER .getAdminPassword ());
138
+ factory .setHandshakeTimeout (HANDSHAKE_TIMEOUT );
130
139
factory .setVirtualHost ("/" );
131
140
factory .setHost (RMQ_CONTAINER .getHost ());
132
141
factory .setPort (RMQ_CONTAINER .getAmqpPort ());
0 commit comments