clebertsuconic commented on code in PR #4556:
URL: https://github.com/apache/activemq-artemis/pull/4556#discussion_r1268134422
##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTInterceptorPropertiesTest.java:
##########
@@ -89,25 +83,25 @@ public void testCheckInterceptedMQTTMessageProperties()
throws Exception {
server.getRemotingService().addIncomingInterceptor(incomingInterceptor);
server.getRemotingService().addOutgoingInterceptor(outgoingInterceptor);
+ final MQTTClientProvider publishProvider = getMQTTClientProvider();
+ initializeConnection(publishProvider);
+ publishProvider.publish(addressQueue, msgText.getBytes(), AT_MOST_ONCE,
retained);
- Thread thread = new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- byte[] payload = subscribeProvider.receive(10000);
- assertNotNull("Should get a message", payload);
- latch.countDown();
- } catch (Exception e) {
- e.printStackTrace();
- }
+ final MQTTClientProvider subscribeProvider = getMQTTClientProvider();
+ initializeConnection(subscribeProvider);
+ subscribeProvider.subscribe(addressQueue, AT_MOST_ONCE);
+
+ Thread thread = new Thread(() -> {
+ try {
+ byte[] payload = subscribeProvider.receive(10000);
+ assertNotNull("Should get a message", payload);
+ latch.countDown();
+ } catch (Exception e) {
+ e.printStackTrace();
}
});
thread.start();
- final MQTTClientProvider publishProvider = getMQTTClientProvider();
- initializeConnection(publishProvider);
- publishProvider.publish(addressQueue, msgText.getBytes(), AT_MOST_ONCE,
retained);
-
latch.await(10, TimeUnit.SECONDS);
Review Comment:
I know it's not part of this change.. but you should
Assert.assertTrue(latch.await...) here.
otherwise a failure from the Thread wouldn't be translated as an assertion
on the main process.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]