Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1AD5EE448 for ; Wed, 2 Jan 2013 17:45:45 +0000 (UTC) Received: (qmail 33482 invoked by uid 500); 2 Jan 2013 17:45:45 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 33423 invoked by uid 500); 2 Jan 2013 17:45:45 -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 33416 invoked by uid 99); 2 Jan 2013 17:45:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Jan 2013 17:45:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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, 02 Jan 2013 17:45:41 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2266D23888FE; Wed, 2 Jan 2013 17:45:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1427878 - in /activemq/trunk/activemq-core/src/test/java/org/apache/activemq: broker/region/cursors/NegativeQueueTest.java bugs/AMQ2513Test.java usecases/ExpiredMessagesWithNoConsumerTest.java Date: Wed, 02 Jan 2013 17:45:19 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130102174520.2266D23888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tabish Date: Wed Jan 2 17:45:19 2013 New Revision: 1427878 URL: http://svn.apache.org/viewvc?rev=1427878&view=rev Log: fix test cases after changes in https://issues.apache.org/jira/browse/AMQ-4237 broker the tests queue MBean lookup Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2513Test.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesWithNoConsumerTest.java Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java?rev=1427878&r1=1427877&r2=1427878&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java Wed Jan 2 17:45:19 2013 @@ -55,102 +55,102 @@ import org.slf4j.LoggerFactory; /** * Modified CursorSupport Unit test to reproduce the negative queue issue. - * + * * Keys to reproducing: * 1) Consecutive queues with listener on first sending to second queue * 2) Push each queue to the memory limit * This seems to help reproduce the issue more consistently, but * we have seen times in our production environment where the * negative queue can occur without. Our memory limits are - * very high in production and it still happens in varying + * very high in production and it still happens in varying * frequency. * 3) Prefetch - * Lowering the prefetch down to 10 and below seems to help - * reduce occurrences. + * Lowering the prefetch down to 10 and below seems to help + * reduce occurrences. * 4) # of consumers per queue * The issue occurs less with fewer consumers - * + * * Things that do not affect reproduction: * 1) Spring - we use spring in our production applications, but this test case works * with or without it. * 2) transacted - * + * */ public class NegativeQueueTest extends AutoFailTestSupport { private static final Logger LOG = LoggerFactory.getLogger(NegativeQueueTest.class); - + public static SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd,hh:mm:ss:SSS"); - + private static final String QUEUE_1_NAME = "conn.test.queue.1"; private static final String QUEUE_2_NAME = "conn.test.queue.2"; - + private static final long QUEUE_MEMORY_LIMIT = 2097152; private static final long MEMORY_USAGE = 400000000; private static final long TEMP_USAGE = 200000000; private static final long STORE_USAGE = 1000000000; private static final int MESSAGE_COUNT = 1100; - + protected static final boolean TRANSACTED = true; protected static final boolean DEBUG = true; - protected static int NUM_CONSUMERS = 20; - protected static int PREFETCH_SIZE = 1000; - + protected static int NUM_CONSUMERS = 20; + protected static int PREFETCH_SIZE = 1000; + protected BrokerService broker; protected String bindAddress = "tcp://localhost:0"; - + public void testWithDefaultPrefetch() throws Exception{ PREFETCH_SIZE = 1000; NUM_CONSUMERS = 20; blastAndConsume(); } - + public void x_testWithDefaultPrefetchFiveConsumers() throws Exception{ PREFETCH_SIZE = 1000; NUM_CONSUMERS = 5; blastAndConsume(); } - + public void x_testWithDefaultPrefetchTwoConsumers() throws Exception{ PREFETCH_SIZE = 1000; NUM_CONSUMERS = 2; blastAndConsume(); } - + public void testWithDefaultPrefetchOneConsumer() throws Exception{ PREFETCH_SIZE = 1000; NUM_CONSUMERS = 1; blastAndConsume(); } - + public void testWithMediumPrefetch() throws Exception{ PREFETCH_SIZE = 50; NUM_CONSUMERS = 20; blastAndConsume(); - } - + } + public void x_testWithSmallPrefetch() throws Exception{ PREFETCH_SIZE = 10; NUM_CONSUMERS = 20; blastAndConsume(); } - + public void testWithNoPrefetch() throws Exception{ PREFETCH_SIZE = 1; NUM_CONSUMERS = 20; blastAndConsume(); } - + public void blastAndConsume() throws Exception { LOG.info(getName()); ConnectionFactory factory = createConnectionFactory(); - + //get proxy queues for statistics lookups Connection proxyConnection = factory.createConnection(); proxyConnection.start(); Session proxySession = proxyConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); - final QueueViewMBean proxyQueue1 = getProxyToQueueViewMBean((Queue)proxySession.createQueue(QUEUE_1_NAME)); - final QueueViewMBean proxyQueue2 = getProxyToQueueViewMBean((Queue)proxySession.createQueue(QUEUE_2_NAME)); - + final QueueViewMBean proxyQueue1 = getProxyToQueueViewMBean(proxySession.createQueue(QUEUE_1_NAME)); + final QueueViewMBean proxyQueue2 = getProxyToQueueViewMBean(proxySession.createQueue(QUEUE_2_NAME)); + // LOAD THE QUEUE Connection producerConnection = factory.createConnection(); producerConnection.start(); @@ -168,7 +168,7 @@ public class NegativeQueueTest extends A System.out.print(index-((index/10)*10)); } } - + //get access to the Queue info if(DEBUG){ System.out.println(""); @@ -176,16 +176,16 @@ public class NegativeQueueTest extends A System.out.println("Queue1 Memory % Used = "+proxyQueue1.getMemoryPercentUsage()); System.out.println("Queue1 Memory Available = "+proxyQueue1.getMemoryLimit()); } - + // FLUSH THE QUEUE final CountDownLatch latch1 = new CountDownLatch(1); - final CountDownLatch latch2 = new CountDownLatch(1); + final CountDownLatch latch2 = new CountDownLatch(1); Connection[] consumerConnections1 = new Connection[NUM_CONSUMERS]; List consumerList1 = new ArrayList(); Connection[] consumerConnections2 = new Connection[NUM_CONSUMERS]; Connection[] producerConnections2 = new Connection[NUM_CONSUMERS]; List consumerList2 = new ArrayList(); - + for(int ix=0; ix consumerList; - private CountDownLatch latch; - private Session consumerSession; + private final List consumerList; + private final CountDownLatch latch; + private final Session consumerSession; private Session producerSession; private MessageProducer producer; - + public SessionAwareMessageListener(Session consumerSession, CountDownLatch latch, List consumerList){ this(null, consumerSession, null, latch, consumerList); } - - public SessionAwareMessageListener(Connection producerConnection, Session consumerSession, String outQueueName, + + public SessionAwareMessageListener(Connection producerConnection, Session consumerSession, String outQueueName, CountDownLatch latch, List consumerList){ this.consumerList = consumerList; this.latch = latch; this.consumerSession = consumerSession; - + if(producerConnection != null){ try { producerSession = producerConnection.createSession(TRANSACTED, Session.AUTO_ACKNOWLEDGE); @@ -377,7 +381,8 @@ public class NegativeQueueTest extends A } } } - + + @Override public void onMessage(Message msg) { try { if(producer == null){ @@ -392,7 +397,7 @@ public class NegativeQueueTest extends A } catch (Exception e) { e.printStackTrace(); } - + synchronized(consumerList){ consumerList.add(msg); if(DEBUG && consumerList.size()%100 == 0) { @@ -411,5 +416,5 @@ public class NegativeQueueTest extends A } } } - } + } } Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2513Test.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2513Test.java?rev=1427878&r1=1427877&r2=1427878&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2513Test.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2513Test.java Wed Jan 2 17:45:19 2013 @@ -98,7 +98,8 @@ public class AMQ2513Test extends TestCas DestinationViewMBean createView() throws Exception { String domain = "org.apache.activemq"; - ObjectName name = new ObjectName(domain + ":BrokerName=localhost,Type=Queue,Destination=test"); + ObjectName name = new ObjectName(domain + ":type=Broker,brokerName=localhost," + + "destinationType=Queue,destinationName=test"); return (DestinationViewMBean) broker.getManagementContext().newProxyInstance(name, DestinationViewMBean.class, true); } Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesWithNoConsumerTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesWithNoConsumerTest.java?rev=1427878&r1=1427877&r2=1427878&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesWithNoConsumerTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesWithNoConsumerTest.java Wed Jan 2 17:45:19 2013 @@ -163,10 +163,6 @@ public class ExpiredMessagesWithNoConsum TimeUnit.SECONDS.sleep(5); - for (ObjectName name : broker.getAdminView().getQueues()) { - LOG.info("Broker Queue: {}", name); - } - final DestinationViewMBean view = createView(destination); Wait.waitFor(new Wait.Condition() { @Override @@ -581,8 +577,6 @@ public class ExpiredMessagesWithNoConsum name = new ObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=test"); } - LOG.info("Attempting to find Queue named: {}", name); - return (DestinationViewMBean) broker.getManagementContext().newProxyInstance(name, DestinationViewMBean.class, true); }