Return-Path: Delivered-To: apmail-geronimo-activemq-commits-archive@www.apache.org Received: (qmail 31250 invoked from network); 20 Apr 2006 14:21:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Apr 2006 14:21:47 -0000 Received: (qmail 13903 invoked by uid 500); 20 Apr 2006 14:21:37 -0000 Delivered-To: apmail-geronimo-activemq-commits-archive@geronimo.apache.org Received: (qmail 13863 invoked by uid 500); 20 Apr 2006 14:21:37 -0000 Mailing-List: contact activemq-commits-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-dev@geronimo.apache.org Delivered-To: mailing list activemq-commits@geronimo.apache.org Received: (qmail 13832 invoked by uid 99); 20 Apr 2006 14:21:37 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Apr 2006 07:21:37 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 20 Apr 2006 07:21:35 -0700 Received: (qmail 30975 invoked by uid 65534); 20 Apr 2006 14:21:14 -0000 Message-ID: <20060420142114.30972.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r395597 [3/3] - in /incubator/activemq/trunk/activemq-core/src: main/java/org/apache/activemq/kaha/ main/java/org/apache/activemq/kaha/impl/ main/java/org/apache/activemq/store/kahadaptor/ test/java/org/apache/activemq/kaha/ test/java/org/a... Date: Thu, 20 Apr 2006 14:15:38 -0000 To: activemq-commits@geronimo.apache.org From: rajdavies@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/impl/IndexLinkedListTest.java URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/impl/IndexLinkedListTest.java?rev=395597&view=auto ============================================================================== --- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/impl/IndexLinkedListTest.java (added) +++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/impl/IndexLinkedListTest.java Thu Apr 20 07:15:30 2006 @@ -0,0 +1,261 @@ +/** + * + * Copyright 2005-2006 The Apache Software Foundation + * + * Licensed 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.kaha.impl; + +import java.util.ArrayList; +import java.util.List; +import junit.framework.TestCase; + +/** +* @version $Revision: 1.2 $ +*/ +public class IndexLinkedListTest extends TestCase{ + static final int NUMBER = 10; + private IndexItem root; + private List testData = new ArrayList(); + private IndexLinkedList list; + protected void setUp() throws Exception{ + super.setUp(); + for (int i =0; i < NUMBER; i++){ + testData.add(new IndexItem()); + } + root = new IndexItem(); + list = new IndexLinkedList(root); + } + + protected void tearDown() throws Exception{ + super.tearDown(); + testData.clear(); + list = null; + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.getFirst()' + */ + public void testGetFirst(){ + for (int i =0; i < testData.size(); i++){ + list.add((IndexItem) testData.get(i)); + } + assertTrue(list.getFirst()==testData.get(0)); + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.getLast()' + */ + public void testGetLast(){ + for (int i =0; i < testData.size(); i++){ + list.add((IndexItem) testData.get(i)); + } + assertTrue(list.getLast()==testData.get(testData.size()-1)); + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.removeFirst()' + */ + public void testRemoveFirst(){ + for (int i =0; i < testData.size(); i++){ + list.add((IndexItem) testData.get(i)); + } + assertTrue(list.removeFirst()==testData.get(0)); + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.removeLast()' + */ + public void testRemoveLast(){ + for (int i =0; i < testData.size(); i++){ + list.add((IndexItem) testData.get(i)); + } + assertTrue(list.removeLast()==testData.get(testData.size()-1)); + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.addFirst(IndexItem)' + */ + public void testAddFirst(){ + for (int i =0; i < testData.size(); i++){ + list.addFirst((IndexItem) testData.get(i)); + } + int count = 0; + for (int i =testData.size()-1; i>=0; i--){ + assertTrue(testData.get(i)==list.get(count++)); + } + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.addLast(IndexItem)' + */ + public void testAddLast(){ + for (int i =0; i < testData.size(); i++){ + list.addLast((IndexItem) testData.get(i)); + } + for (int i =0; i < testData.size(); i++){ + assertTrue(testData.get(i)==list.get(i)); + } + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.size()' + */ + public void testSize(){ + for (int i =0; i < testData.size(); i++){ + list.addLast((IndexItem) testData.get(i)); + assertTrue(list.size()==i+1); + } + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.isEmpty()' + */ + public void testIsEmpty(){ + for (int i =0; i < testData.size(); i++){ + list.addLast((IndexItem) testData.get(i)); + assertTrue(list.size()==i+1); + } + list.clear(); + assertTrue(list.isEmpty()); + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.add(IndexItem)' + */ + public void testAddIndexItem(){ + for (int i =0; i < testData.size(); i++){ + list.add((IndexItem) testData.get(i)); + } + for (int i =0; i < testData.size(); i++){ + assertTrue(testData.get(i)==list.get(i)); + } + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.clear()' + */ + public void testClear(){ + for (int i =0; i < testData.size(); i++){ + list.addLast((IndexItem) testData.get(i)); + assertTrue(list.size()==i+1); + } + list.clear(); + assertTrue(list.isEmpty()); + } + + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.add(int, IndexItem)' + */ + public void testAddIntIndexItem(){ + for (int i =0; i < testData.size(); i++){ + list.add(i,(IndexItem) testData.get(i)); + } + for (int i =0; i < testData.size(); i++){ + assertTrue(testData.get(i)==list.get(i)); + } + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.remove(int)' + */ + public void testRemoveInt(){ + for (int i =0; i < testData.size(); i++){ + list.add(i,(IndexItem) testData.get(i)); + } + for (int i =0; i < testData.size(); i++){ + list.remove(0); + } + assertTrue(list.isEmpty()); + for (int i =0; i < testData.size(); i++){ + list.add(i,(IndexItem) testData.get(i)); + } + for (int i =0; i < testData.size(); i++){ + list.remove(list.size()-1); + } + assertTrue(list.isEmpty()); + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.indexOf(IndexItem)' + */ + public void testIndexOf(){ + for (int i =0; i < testData.size(); i++){ + list.add(i,(IndexItem) testData.get(i)); + } + for (int i =0; i < testData.size(); i++){ + assertTrue(list.indexOf((IndexItem) testData.get(i))==i); + } + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.getNextEntry(IndexItem)' + */ + public void testGetNextEntry(){ + for (int i =0; i < testData.size(); i++){ + list.add(i,(IndexItem) testData.get(i)); + } + IndexItem next = list.getFirst(); + int count = 0; + while (next != null){ + assertTrue(next==testData.get(count++)); + next = list.getNextEntry(next); + assertTrue(next != root); + } + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.getPrevEntry(IndexItem)' + */ + public void testGetPrevEntry(){ + for (int i =0; i < testData.size(); i++){ + list.add(i,(IndexItem) testData.get(i)); + } + IndexItem next = list.getLast(); + int count = testData.size()-1; + while (next != null){ + assertTrue(next==testData.get(count--)); + next = list.getPrevEntry(next); + assertTrue(next != root); + } + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.addBefore(IndexItem, IndexItem)' + */ + public void testAddBefore(){ + for (int i =0; i < testData.size(); i++){ + list.add(i,(IndexItem) testData.get(i)); + } + IndexItem test = new IndexItem(); + list.addBefore(test, list.getFirst()); + assertTrue(list.size()==testData.size()+1); + assertTrue(list.getFirst()==test); + } + + /* + * Test method for 'org.apache.activemq.kaha.impl.IndexLinkedList.remove(IndexItem)' + */ + public void testRemoveIndexItem(){ + for (int i =0; i < testData.size(); i++){ + list.add(i,(IndexItem) testData.get(i)); + } + for (int i =0; i < testData.size(); i++){ + list.remove((IndexItem)testData.get(i)); + assertTrue(list.size()==testData.size()-i-1); + } + } +} Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/KahaDurableTopicTest.java URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/KahaDurableTopicTest.java?rev=395597&r1=395596&r2=395597&view=diff ============================================================================== --- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/KahaDurableTopicTest.java (original) +++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/KahaDurableTopicTest.java Thu Apr 20 07:15:30 2006 @@ -16,21 +16,15 @@ */ package org.apache.activemq.perf; -import javax.jms.ConnectionFactory; -import javax.jms.DeliveryMode; -import javax.jms.Destination; -import javax.jms.JMSException; - -import org.apache.activemq.ActiveMQConnectionFactory; +import java.io.File; import org.apache.activemq.broker.BrokerService; -import org.apache.activemq.xbean.BrokerFactoryBean; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; +import org.apache.activemq.store.kahadaptor.KahaPersistentAdaptor; /** * @version $Revision: 1.3 $ */ public class KahaDurableTopicTest extends SimpleDurableTopicTest { + /* protected BrokerService createBroker() throws Exception{ Resource resource=new ClassPathResource( "org/apache/activemq/perf/kahaBroker.xml"); BrokerFactoryBean factory=new BrokerFactoryBean(resource); @@ -38,6 +32,14 @@ BrokerService result=factory.getBroker(); result.start(); return result; + } + */ + + protected void configureBroker(BrokerService answer) throws Exception{ + KahaPersistentAdaptor adaptor = new KahaPersistentAdaptor(new File("activemq-data/perfTest")); + answer.setPersistenceAdapter(adaptor); + answer.addConnector(bindAddress); + answer.setDeleteAllMessagesOnStartup(true); } Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/KahaQueueTest.java URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/KahaQueueTest.java?rev=395597&view=auto ============================================================================== --- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/KahaQueueTest.java (added) +++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/KahaQueueTest.java Thu Apr 20 07:15:30 2006 @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005-2006 The Apache Software Foundation + * + * Licensed 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 java.io.File; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Session; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.store.kahadaptor.KahaPersistentAdaptor; +/** + * @version $Revision: 1.3 $ + */ +public class KahaQueueTest extends SimpleQueueTest{ + + + protected void configureBroker(BrokerService answer) throws Exception{ + KahaPersistentAdaptor adaptor = new KahaPersistentAdaptor(new File("activemq-data/perfTest")); + answer.setPersistenceAdapter(adaptor); + answer.addConnector(bindAddress); + answer.setDeleteAllMessagesOnStartup(true); + } + +} \ No newline at end of file Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/MemoryAllocationTest.java URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/MemoryAllocationTest.java?rev=395597&view=auto ============================================================================== --- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/MemoryAllocationTest.java (added) +++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/MemoryAllocationTest.java Thu Apr 20 07:15:30 2006 @@ -0,0 +1,103 @@ +/** + * + * Copyright 2005-2006 The Apache Software Foundation + * + * Licensed 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.Connection; +import javax.jms.ConnectionFactory; +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.TemporaryQueue; +import javax.jms.TemporaryTopic; +import junit.framework.TestCase; +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.broker.BrokerService; +/** + * @version $Revision: 1.3 $ + */ +public class MemoryAllocationTest extends TestCase{ + protected static final int MESSAGE_COUNT=2000; + protected BrokerService broker; + protected String bindAddress="vm://localhost"; + protected int topicCount=0; + + public void testPerformance() throws Exception{ + ConnectionFactory factory=createConnectionFactory(); + Connection connection=factory.createConnection(); + for(int i=0;i