From commits-return-11627-apmail-activemq-commits-archive=activemq.apache.org@activemq.apache.org Wed Sep 02 08:48:54 2009 Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 83296 invoked from network); 2 Sep 2009 08:48:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Sep 2009 08:48:54 -0000 Received: (qmail 58147 invoked by uid 500); 2 Sep 2009 08:48:54 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 58090 invoked by uid 500); 2 Sep 2009 08:48:54 -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 58081 invoked by uid 99); 2 Sep 2009 08:48:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Sep 2009 08:48:53 +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, 02 Sep 2009 08:48:45 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 572D52388896; Wed, 2 Sep 2009 08:48:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r810417 - in /activemq/trunk/activemq-core/src/test/java/org/apache/activemq: ./ advisory/ perf/ test/retroactive/ Date: Wed, 02 Sep 2009 08:48:25 -0000 To: commits@activemq.apache.org From: rajdavies@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090902084825.572D52388896@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rajdavies Date: Wed Sep 2 08:48:24 2009 New Revision: 810417 URL: http://svn.apache.org/viewvc?rev=810417&view=rev Log: updated how retroactive tests get destination name - so will actually test the SubscriptionPolicy Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/NumberOfDestinationsTest.java (with props) Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithLastImagePolicyWithWildcardTest.java Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java?rev=810417&r1=810416&r2=810417&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java Wed Sep 2 08:48:24 2009 @@ -16,16 +16,14 @@ */ package org.apache.activemq; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; - -import junit.framework.TestCase; - import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.command.ActiveMQTopic; import org.springframework.jms.core.JmsTemplate; +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.Destination; /** * A useful base class which creates and closes an embedded broker @@ -39,7 +37,7 @@ protected String bindAddress = "vm://localhost"; protected ConnectionFactory connectionFactory; protected boolean useTopic; - protected Destination destination; + protected ActiveMQDestination destination; protected JmsTemplate template; protected void setUp() throws Exception { @@ -78,7 +76,7 @@ * * @return newly created Destinaiton */ - protected Destination createDestination() { + protected ActiveMQDestination createDestination() { return createDestination(getDestinationString()); } @@ -86,7 +84,7 @@ * Factory method to create the destination in either the queue or topic * space based on the value of the {@link #useTopic} field */ - protected Destination createDestination(String subject) { + protected ActiveMQDestination createDestination(String subject) { if (useTopic) { return new ActiveMQTopic(subject); } else { Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java?rev=810417&r1=810416&r2=810417&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java Wed Sep 2 08:48:24 2009 @@ -16,8 +16,11 @@ */ package org.apache.activemq.advisory; +import org.apache.activemq.EmbeddedBrokerTestSupport; +import org.apache.activemq.broker.region.RegionBroker; +import org.apache.activemq.command.ActiveMQDestination; +import org.apache.activemq.command.ActiveMQQueue; import java.util.Vector; - import javax.jms.Connection; import javax.jms.Destination; import javax.jms.JMSException; @@ -27,9 +30,6 @@ import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TemporaryQueue; -import org.apache.activemq.EmbeddedBrokerTestSupport; -import org.apache.activemq.broker.region.RegionBroker; -import org.apache.activemq.command.ActiveMQQueue; /** * @version $Revision: 397249 $ @@ -166,7 +166,7 @@ messagesToSend = 2000; } - protected Destination createDestination() { + protected ActiveMQDestination createDestination() { return new ActiveMQQueue(getClass().getName()); } Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/NumberOfDestinationsTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/NumberOfDestinationsTest.java?rev=810417&view=auto ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/NumberOfDestinationsTest.java (added) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/NumberOfDestinationsTest.java Wed Sep 2 08:48:24 2009 @@ -0,0 +1,127 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.perf; + +/** + * A NumberOfDestinationsTest + * + */ +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.store.kahadb.KahaDBStore; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import java.io.File; +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.jms.TemporaryQueue; +import javax.jms.TemporaryTopic; +import junit.framework.TestCase; +/** + * @version $Revision: 1.3 $ + */ +public class NumberOfDestinationsTest extends TestCase { + protected static final int MESSAGE_COUNT = 1; + protected static final int NUMBER_OF_DESTINATIONS = 100000; + private static final Log LOG = LogFactory.getLog(NumberOfDestinationsTest.class); + protected BrokerService broker; + protected String bindAddress = "vm://localhost"; + protected int destinationCount; + + public void testDestinations() throws Exception { + ConnectionFactory factory = createConnectionFactory(); + Connection connection = factory.createConnection(); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + MessageProducer mp = session.createProducer(null); + for (int j = 0; j < NUMBER_OF_DESTINATIONS; j++) { + Destination dest = getDestination(session); + + for (int i = 0; i < MESSAGE_COUNT; i++) { + Message msg = session.createTextMessage("test" + i); + mp.send(dest, msg); + + } + if (j % 500 == 0) { + LOG.info("Iterator " + j); + } + } + + connection.close(); + } + + protected Destination getDestination(Session session) throws JMSException { + String topicName = getClass().getName() + "." + destinationCount++; + return session.createTopic(topicName); + } + + protected void setUp() throws Exception { + if (broker == null) { + broker = createBroker(); + } + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + if (broker != null) { + broker.stop(); + } + } + + protected ActiveMQConnectionFactory createConnectionFactory() throws Exception { + ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(bindAddress); + return cf; + } + + protected BrokerService createBroker() throws Exception { + BrokerService answer = new BrokerService(); + configureBroker(answer); + answer.start(); + return answer; + } + + protected void configureBroker(BrokerService answer) throws Exception { + File dataFileDir = new File("target/test-amq-data/perfTest/kahadb"); + + KahaDBStore kaha = new KahaDBStore(); + kaha.setDirectory(dataFileDir); + //answer.setUseJmx(false); + + // The setEnableJournalDiskSyncs(false) setting is a little dangerous right now, as I have not verified + // what happens if the index is updated but a journal update is lost. + // Index is going to be in consistent, but can it be repaired? + //kaha.setEnableJournalDiskSyncs(false); + // Using a bigger journal file size makes he take fewer spikes as it is not switching files as often. + //kaha.setJournalMaxFileLength(1024*100); + + // small batch means more frequent and smaller writes + //kaha.setIndexWriteBatchSize(100); + // do the index write in a separate thread + //kaha.setEnableIndexWriteAsync(true); + + answer.setPersistenceAdapter(kaha); + answer.setAdvisorySupport(false); + answer.setEnableStatistics(false); + answer.addConnector(bindAddress); + answer.setDeleteAllMessagesOnStartup(true); + } +} Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/NumberOfDestinationsTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/NumberOfDestinationsTest.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithLastImagePolicyWithWildcardTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithLastImagePolicyWithWildcardTest.java?rev=810417&r1=810416&r2=810417&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithLastImagePolicyWithWildcardTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithLastImagePolicyWithWildcardTest.java Wed Sep 2 08:48:24 2009 @@ -30,8 +30,7 @@ private int counter = 1; protected void sendMessage(MessageProducer producer, TextMessage message) throws JMSException { - ActiveMQTopic topic = new ActiveMQTopic(destination.toString() + "." + (counter++)); - // System.out.println("Sending to destination: " + topic); + ActiveMQTopic topic = new ActiveMQTopic(destination.getPhysicalName() + "." + (counter++)); producer.send(topic, message); } @@ -40,7 +39,7 @@ } protected MessageConsumer createConsumer() throws JMSException { - return session.createConsumer(new ActiveMQTopic(destination.toString() + ".>")); + return session.createConsumer(new ActiveMQTopic(destination.getPhysicalName() + ".>")); } protected String getBrokerXml() {