From 26aeb46493f6c621b481d3888bb3d4994055ebca Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Wed, 5 Mar 2008 09:32:45 +0000 Subject: [PATCH] Added non persistent queue network test git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@633799 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/perf/SimpleNetworkTest.java | 3 +- .../SimpleNonPersistentQueueNetworkTest.java | 51 +++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 activemq-core/src/test/java/org/apache/activemq/perf/SimpleNonPersistentQueueNetworkTest.java diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/SimpleNetworkTest.java b/activemq-core/src/test/java/org/apache/activemq/perf/SimpleNetworkTest.java index 3ccad236e1..e98fc382a6 100644 --- a/activemq-core/src/test/java/org/apache/activemq/perf/SimpleNetworkTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/perf/SimpleNetworkTest.java @@ -25,8 +25,6 @@ import org.apache.activemq.network.NetworkConnector; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import junit.framework.TestCase; - public class SimpleNetworkTest extends SimpleTopicTest { @@ -114,6 +112,7 @@ public class SimpleNetworkTest extends SimpleTopicTest { protected void configureProducerBroker(BrokerService answer,String uri) throws Exception { answer.setBrokerName(PRODUCER_BROKER_NAME); + answer.setPersistent(false); answer.setDeleteAllMessagesOnStartup(true); NetworkConnector connector = answer.addNetworkConnector("static://"+consumerBindAddress); connector.setDuplex(true); diff --git a/activemq-core/src/test/java/org/apache/activemq/perf/SimpleNonPersistentQueueNetworkTest.java b/activemq-core/src/test/java/org/apache/activemq/perf/SimpleNonPersistentQueueNetworkTest.java new file mode 100644 index 0000000000..37de574093 --- /dev/null +++ b/activemq-core/src/test/java/org/apache/activemq/perf/SimpleNonPersistentQueueNetworkTest.java @@ -0,0 +1,51 @@ +/** + * 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; + +import javax.jms.ConnectionFactory; +import javax.jms.DeliveryMode; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Session; + +public class SimpleNonPersistentQueueNetworkTest extends SimpleNetworkTest { + + protected void setUp() throws Exception { + numberOfConsumers = 10; + numberofProducers = 10; + super.setUp(); + } + protected PerfProducer createProducer(ConnectionFactory fac, Destination dest, int number, byte[] payload) throws JMSException { + PerfProducer pp = new PerfProducer(fac, dest, payload); + pp.setDeliveryMode(DeliveryMode.NON_PERSISTENT); + pp.setTimeToLive(1000); + return pp; + } + + protected PerfConsumer createConsumer(ConnectionFactory fac, Destination dest, int number) throws JMSException { + PerfConsumer consumer = new PerfConsumer(fac, dest); + boolean enableAudit = numberOfConsumers <= 1; + System.out.println("Enable Audit = " + enableAudit); + consumer.setEnableAudit(enableAudit); + return consumer; + } + + protected Destination createDestination(Session s, String destinationName) throws JMSException { + return s.createQueue(destinationName); + } +}