ActiveMQ
  1. ActiveMQ
  2. AMQ-1725

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

    Details

    • Type: Test Test
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.1.0
    • Fix Version/s: NEEDS_REVIEW
    • Component/s: Test Cases
    • Labels:
      None

      Description

      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();
      
      
      

        Activity

        Hide
        Timothy Bish added a comment -

        This test case was removed.

        Show
        Timothy Bish added a comment - This test case was removed.
        Hide
        Gary Tully added a comment -

        stack trace is now in the log.

        Show
        Gary Tully added a comment - stack trace is now in the log.

          People

          • Assignee:
            Unassigned
            Reporter:
            Gary Tully
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development