Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 3460 invoked from network); 8 Dec 2010 18:03:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Dec 2010 18:03:02 -0000 Received: (qmail 65541 invoked by uid 500); 8 Dec 2010 18:03:02 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 65474 invoked by uid 500); 8 Dec 2010 18:03: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 65467 invoked by uid 99); 8 Dec 2010 18:03:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Dec 2010 18:03:01 +0000 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; Wed, 08 Dec 2010 18:02:58 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5162F23888C2; Wed, 8 Dec 2010 18:02:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1043556 - in /activemq/trunk/activemq-optional/src/test: java/org/apache/activemq/bugs/AMQ2764Test.java resources/org/apache/activemq/bugs/amq2764/reconnect-broker2.xml Date: Wed, 08 Dec 2010 18:02:37 -0000 To: commits@activemq.apache.org From: dejanb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101208180237.5162F23888C2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dejanb Date: Wed Dec 8 18:02:36 2010 New Revision: 1043556 URL: http://svn.apache.org/viewvc?rev=1043556&view=rev Log: more testing of http inactivity monitor Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/bugs/AMQ2764Test.java activemq/trunk/activemq-optional/src/test/resources/org/apache/activemq/bugs/amq2764/reconnect-broker2.xml Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/bugs/AMQ2764Test.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/bugs/AMQ2764Test.java?rev=1043556&r1=1043555&r2=1043556&view=diff ============================================================================== --- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/bugs/AMQ2764Test.java (original) +++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/bugs/AMQ2764Test.java Wed Dec 8 18:02:36 2010 @@ -22,13 +22,7 @@ import java.util.Iterator; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import javax.jms.Connection; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Session; +import javax.jms.*; import junit.framework.TestCase; import org.apache.activemq.ActiveMQConnectionFactory; @@ -50,6 +44,48 @@ public class AMQ2764Test extends TestCas private Destination destination; private ArrayList connections = new ArrayList(); + public void testInactivityMonitor() throws Exception { + + startBrokerTwo(); + brokerTwo.waitUntilStarted(); + + startBrokerOne(); + brokerOne.waitUntilStarted(); + + Thread.sleep(2000); + + ActiveMQConnectionFactory secondProducerConnectionFactory = createBrokerTwoHttpConnectionFactory(); + ActiveMQConnectionFactory consumerConnectionFactory = createBrokerOneHttpConnectionFactory(); + + MessageConsumer consumer = createConsumer(consumerConnectionFactory); + AtomicInteger counter = createConsumerCounter(consumerConnectionFactory); + waitForConsumerToArrive(counter); + + Connection connection = secondProducerConnectionFactory.createConnection(); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + MessageProducer producer = session.createProducer(destination); + producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); + + + final int expectedMessagesReceived = 2000; + + for (int i = 0; i < expectedMessagesReceived; i++) { + Message message = session.createMessage(); + producer.send(message); + LOG.info("sent message " + i); + } + + for (int i = 0; i < expectedMessagesReceived; i++) { + Message message = consumer.receive(2000); + if (message == null) { + fail("Didn't receive a message"); + } + LOG.info("received message " + i); + } + + + } + public void testBrokerRestart() throws Exception { startBrokerTwo(); @@ -141,6 +177,14 @@ public class AMQ2764Test extends TestCas return new ActiveMQConnectionFactory("vm://broker2"); } + protected ActiveMQConnectionFactory createBrokerOneHttpConnectionFactory() { + return new ActiveMQConnectionFactory("http://localhost:61616"); + } + + protected ActiveMQConnectionFactory createBrokerTwoHttpConnectionFactory() { + return new ActiveMQConnectionFactory("http://localhost:61617"); + } + protected void setUp() throws Exception { LOG.info("==============================================================================="); Modified: activemq/trunk/activemq-optional/src/test/resources/org/apache/activemq/bugs/amq2764/reconnect-broker2.xml URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/resources/org/apache/activemq/bugs/amq2764/reconnect-broker2.xml?rev=1043556&r1=1043555&r2=1043556&view=diff ============================================================================== --- activemq/trunk/activemq-optional/src/test/resources/org/apache/activemq/bugs/amq2764/reconnect-broker2.xml (original) +++ activemq/trunk/activemq-optional/src/test/resources/org/apache/activemq/bugs/amq2764/reconnect-broker2.xml Wed Dec 8 18:02:36 2010 @@ -29,6 +29,7 @@ +