org.apache.activemq.JMSConsumerTest.testMessageListenerUnackedWithPrefetch1StayInQueue
 fails for ackMode != dups_ok
-------------------------------------------------------------------------------------------------------------------

                 Key: AMQ-1725
                 URL: https://issues.apache.org/activemq/browse/AMQ-1725
             Project: ActiveMQ
          Issue Type: Test
          Components: Test Cases
    Affects Versions: 5.1.0
            Reporter: Gary Tully
            Priority: Minor


Variants of the activemq-core 
testMessageListenerUnackedWithPrefetch1StayInQueue test fail checking the 
ordering of messages and they should not for ackMode!=DUPS_OK_ACK

the test does not fail because the assertion kills the message dispatch task 
thread. The stack Trace is visible on the console.

junit.framework.ComparisonFailure: 
testMessageListenerUnackedWithPrefetch1StayInQueue {deliveryMode=2, ackMode=1, 
destinationType=1} verify ordering expected:<2> but was:<1>
        at junit.framework.Assert.assertEquals(Assert.java:81)
        at 
org.apache.activemq.JMSConsumerTest$5.onMessage(JMSConsumerTest.java:361)
        at 
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:967)
        at 
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:122)
        at 
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:192)
        at 
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
        at 
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)


applying the following diff helps identify the tests that fail:

Index: src/test/java/org/apache/activemq/JMSConsumerTest.java
===================================================================
--- src/test/java/org/apache/activemq/JMSConsumerTest.java      (revision 
655936)
+++ src/test/java/org/apache/activemq/JMSConsumerTest.java      (working copy)
@@ -290,6 +290,13 @@
         addCombinationValues("destinationType", new Object[] 
{Byte.valueOf(ActiveMQDestination.QUEUE_TYPE)});
     }

+    public void testA() throws Exception {
+        deliveryMode = Integer.valueOf(DeliveryMode.NON_PERSISTENT);
+        ackMode = Integer.valueOf(Session.AUTO_ACKNOWLEDGE);
+        destinationType = Byte.valueOf(ActiveMQDestination.QUEUE_TYPE);
+        testMessageListenerUnackedWithPrefetch1StayInQueue();
+    }
+
     public void testMessageListenerUnackedWithPrefetch1StayInQueue() throws 
Exception {

         final AtomicInteger counter = new AtomicInteger(0);
@@ -351,7 +358,7 @@
                 try {
                     TextMessage tm = (TextMessage)m;
                     LOG.info("Got in second listener: " + tm.getText());
-                    assertEquals("" + counter.get(), tm.getText());
+                    assertEquals(getName() + " verify ordering", "" + 
counter.get(), tm.getText());
                     counter.incrementAndGet();
                     if (counter.get() == 4) {
                         done2.countDown();




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to