[ 
https://issues.apache.org/jira/browse/CAMEL-7662?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14096754#comment-14096754
 ] 

Willem Jiang commented on CAMEL-7662:
-------------------------------------

Hi Tomohisa,

I managed to find out why the unit test cannot work, even it does the same work 
as the example does.
First the exception is java 
[assertion|http://docs.oracle.com/javase/7/docs/technotes/guides/language/assert.html]
 exception, it is thrown from 
{code}
Caused by: java.lang.AssertionError: Dispatch queue 'mqtt client' was not 
executing, (currently executing: '<not-dispatched>')
        at 
org.fusesource.hawtdispatch.internal.SerialDispatchQueue.assertExecuting(SerialDispatchQueue.java:145)
        at 
org.fusesource.mqtt.client.CallbackConnection.publish(CallbackConnection.java:585)
        at 
org.fusesource.mqtt.client.CallbackConnection.publish(CallbackConnection.java:581)
        at 
org.apache.camel.component.mqtt.MQTTEndpoint.publish(MQTTEndpoint.java:160)
        at 
org.apache.camel.component.mqtt.MQTTProducer.process(MQTTProducer.java:58)
        at 
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:120)
        ... 36 more
{code}
By default, JVM assertions are disabled at runtime, but Surefire enables JVM 
assertions for the execution of your test cases by default. That could explain 
why you can get the different result here in the unit test.
If you disable the assertion in the surefire configuration just like this, the 
test is passed.
{code}
          <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <forkMode>perTest</forkMode>
                    <enableAssertions>false</enableAssertions>
                </configuration>
            </plugin>
{code}

I will ping Hiram for the assertion in the hawtdispatch at the mean time.

> MQTTProducerTest fails once enables it
> --------------------------------------
>
>                 Key: CAMEL-7662
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7662
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mqtt
>    Affects Versions: 2.12.2, 2.14.0
>            Reporter: Tomohisa Igarashi
>            Assignee: Willem Jiang
>         Attachments: camel-example-mqtt.tar.gz
>
>
> MQTTProducerTest fails once you enable this testcase. This is disabled here:
> https://github.com/apache/camel/blob/master/components/camel-mqtt/pom.xml#L84
> Although this may be a known issue as it's explicitly disabled, I'm filing 
> this anyway since I couldn't find any corresponding JIRA.
> It fails with different error on 2.12.2 and current upstream master, but both 
> case show the producer can't send messages through the MQTT producer 
> correctly. I think there is an issue in camel-mqtt since I hit same issue in 
> our application (https://issues.jboss.org/browse/SWITCHYARD-2221), but even 
> if the problem is in the testcase, it still needs to be replaced with 
> appropriate testcase to verify MQTT producer works correctly.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to