[ 
https://issues.apache.org/jira/browse/ARTEMIS-4532?focusedWorklogId=902286&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-902286
 ]

ASF GitHub Bot logged work on ARTEMIS-4532:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Jan/24 11:59
            Start Date: 29/Jan/24 11:59
    Worklog Time Spent: 10m 
      Work Description: gemmellr commented on code in PR #4710:
URL: https://github.com/apache/activemq-artemis/pull/4710#discussion_r1469480482


##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5Test.java:
##########
@@ -83,6 +83,29 @@ public void messageArrived(String topic, MqttMessage 
message) {
       assertTrue(latch.await(500, TimeUnit.MILLISECONDS));
    }
 
+   @Test(timeout = DEFAULT_TIMEOUT)
+   public void testTopicNameEscape() throws Exception {
+      final String topic = "foo1.0/bar/baz";
+
+      CountDownLatch latch = new CountDownLatch(1);
+      MqttClient subscriber = createPahoClient("subscriber");
+      subscriber.connect();
+      subscriber.setCallback(new DefaultMqttCallback() {
+         @Override
+         public void messageArrived(String t, MqttMessage message) {
+            logger.info("Message received from topic {}, message={}", topic, 
message);
+            assertEquals(topic, t);

Review Comment:
   Would be better to remember the value here and then assert outside the 
callback after the latch trips. That way the test will fail quicker and in a 
more helpful manner if the value isnt as expected, having the assertion 
directly cause it rather than e.g just timing out after 500ms on the latch 
(because it wasnt tripped) and requiring someone go look at logs and hope that 
there is a stack logged that might very obviously explain it (or then figuring 
out from the info log if there isnt). It would also just be clearer what is 
really being tested, took me a bit to even notice what the test really cared 
about while doing the send+receive.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 902286)
    Time Spent: 4h 20m  (was: 4h 10m)

> MQTT-to-core wildcard conversion is broken
> ------------------------------------------
>
>                 Key: ARTEMIS-4532
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4532
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>          Time Spent: 4h 20m
>  Remaining Estimate: 0h
>
> Currently when an MQTT topic filter contains characters from the configured 
> [wildcard 
> syntax|https://activemq.apache.org/components/artemis/documentation/latest/wildcard-syntax.html#wildcard-syntax]
>  the conversion to/from this syntax breaks.
> For example, when using the default wildcard syntax if an MQTT topic filter 
> contains a {{.}} the conversion from the MQTT wildcard syntax to the core 
> wildcard syntax and back will result in the {{.}} being replaced with a {{/}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to