Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 97480 invoked from network); 7 Nov 2008 12:52:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Nov 2008 12:52:54 -0000 Received: (qmail 72243 invoked by uid 500); 7 Nov 2008 12:53:01 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 72226 invoked by uid 500); 7 Nov 2008 12:53:01 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 72216 invoked by uid 99); 7 Nov 2008 12:53:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Nov 2008 04:53:01 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Nov 2008 12:51:51 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E55E42388975; Fri, 7 Nov 2008 04:52:03 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r712117 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java Date: Fri, 07 Nov 2008 12:51:58 -0000 To: commits@activemq.apache.org From: gtully@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081107125203.E55E42388975@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gtully Date: Fri Nov 7 04:51:54 2008 New Revision: 712117 URL: http://svn.apache.org/viewvc?rev=712117&view=rev Log: a test variant to validate AMQ-1957 Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java?rev=712117&r1=712116&r2=712117&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java Fri Nov 7 04:51:54 2008 @@ -623,4 +623,30 @@ consumer = session.createConsumer(destination); assertNull(consumer.receive(1000)); } + + public void testRedispatchOfUncommittedTx() throws Exception { + + connection.start(); + Session session = connection.createSession(true, Session.SESSION_TRANSACTED); + destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE); + + sendMessages(connection, destination, 1); + + MessageConsumer consumer = session.createConsumer(destination); + assertNotNull(consumer.receive(1000)); + + // install another consumer while message dispatch is unacked/uncommitted + Session redispatchSession = connection.createSession(true, Session.SESSION_TRANSACTED); + MessageConsumer redispatchConsumer = redispatchSession.createConsumer(destination); + + // no commit so will auto rollback and get redispatched to redisptachConsumer + session.close(); + + assertNotNull(redispatchConsumer.receive(1000)); + redispatchSession.commit(); + + assertNull(redispatchConsumer.receive(500)); + redispatchSession.close(); + } + }