activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r391053 - in /incubator/activemq/trunk/activemq-core/src/test: java/org/apache/activemq/broker/store/ resources/org/apache/activemq/broker/ft/ resources/org/apache/activemq/broker/store/ resources/org/apache/activemq/perf/
Date Mon, 03 Apr 2006 14:15:20 GMT
Author: rajdavies
Date: Mon Apr  3 07:15:17 2006
New Revision: 391053

URL: http://svn.apache.org/viewcvs?rev=391053&view=rev
Log:
Add some basic testing of the Kaha persistence adaptor

Added:
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaLoadTester.java
  (with props)
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaRecoveryBrokerTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaXARecoveryBrokerTest.java
    incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/store/kahabroker.xml
  (with props)
Modified:
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java
    incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/ft/master.xml
    incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/ft/slave.xml
    incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/perf/kahaBroker.xml

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaLoadTester.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaLoadTester.java?rev=391053&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaLoadTester.java
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaLoadTester.java
Mon Apr  3 07:15:17 2006
@@ -0,0 +1,67 @@
+/**
+ *
+ * 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.broker.store;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.jms.BytesMessage;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+import junit.framework.Test;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.JmsTestSupport;
+import org.apache.activemq.broker.BrokerFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.ProgressPrinter;
+import org.apache.activemq.broker.TransportConnector;
+import org.apache.activemq.command.ActiveMQDestination;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.xbean.BrokerFactoryBean;
+import org.springframework.core.io.ClassPathResource;
+
+/**
+ * 
+ * @version $Revision$
+ */
+public class KahaLoadTester extends LoadTester  {
+
+    protected BrokerService createBroker() throws Exception {
+        BrokerFactoryBean brokerFactory=new BrokerFactoryBean(new ClassPathResource("org/apache/activemq/broker/store/kahabroker.xml"));
+        brokerFactory.afterPropertiesSet();
+        BrokerService broker =  brokerFactory.getBroker();
+        broker.setDeleteAllMessagesOnStartup(true);
+        return broker;
+    }
+    
+        
+    
+    public static Test suite() {
+        return suite(KahaLoadTester.class);
+    }
+    
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+}

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaLoadTester.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaRecoveryBrokerTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaRecoveryBrokerTest.java?rev=391053&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaRecoveryBrokerTest.java
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaRecoveryBrokerTest.java
Mon Apr  3 07:15:17 2006
@@ -0,0 +1,59 @@
+/**
+ *
+ * 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.broker.store;
+
+import java.io.File;
+import junit.framework.Test;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.RecoveryBrokerTest;
+import org.apache.activemq.store.kahadaptor.KahaPersistentAdaptor;
+import org.apache.activemq.xbean.BrokerFactoryBean;
+import org.springframework.core.io.ClassPathResource;
+
+/**
+ * Used to verify that recovery works correctly against 
+ * 
+ * @version $Revision$
+ */
+public class KahaRecoveryBrokerTest extends RecoveryBrokerTest {
+   
+    protected BrokerService createBroker() throws Exception {
+        BrokerService broker = createRestartedBroker();
+        broker.setDeleteAllMessagesOnStartup(true);
+        return broker;
+    }
+    
+    protected BrokerService createRestartedBroker() throws Exception {
+        BrokerService broker = new BrokerService();
+       
+        KahaPersistentAdaptor adaptor = new KahaPersistentAdaptor(new File("activemq-data/storetest"));
+        broker.setPersistenceAdapter(adaptor);
+        broker.addConnector("tcp://localhost:0");
+        return broker;
+    }
+
+    public static Test suite() {
+        return suite(KahaRecoveryBrokerTest.class);
+    }
+
+    
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+}

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaXARecoveryBrokerTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaXARecoveryBrokerTest.java?rev=391053&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaXARecoveryBrokerTest.java
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaXARecoveryBrokerTest.java
Mon Apr  3 07:15:17 2006
@@ -0,0 +1,55 @@
+/**
+ *
+ * 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.broker.store;
+
+import junit.framework.Test;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.XARecoveryBrokerTest;
+import org.apache.activemq.xbean.BrokerFactoryBean;
+import org.springframework.core.io.ClassPathResource;
+
+/**
+ * Used to verify that recovery works correctly against 
+ * 
+ * @version $Revision$
+ */
+public class KahaXARecoveryBrokerTest extends XARecoveryBrokerTest {
+
+    public static Test suite() {
+        return suite(KahaXARecoveryBrokerTest.class);
+    }
+    
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    protected BrokerService createBroker() throws Exception {
+        BrokerFactoryBean brokerFactory=new BrokerFactoryBean(new ClassPathResource("org/apache/activemq/broker/store/kahabroker.xml"));
+        brokerFactory.afterPropertiesSet();
+        BrokerService broker =  brokerFactory.getBroker();
+        broker.setDeleteAllMessagesOnStartup(true);
+        return broker;
+    }
+    
+    protected BrokerService createRestartedBroker() throws Exception {
+        BrokerFactoryBean brokerFactory=new BrokerFactoryBean(new ClassPathResource("org/apache/activemq/broker/store/kahabroker.xml"));
+        brokerFactory.afterPropertiesSet();
+        return brokerFactory.getBroker();
+    }
+    
+}

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java?rev=391053&r1=391052&r2=391053&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java
Mon Apr  3 07:15:17 2006
@@ -86,7 +86,7 @@
         MessageConsumer consumer = session.createConsumer(destination);
         for( int i=0; i < PRODUCE_COUNT; i++) {
             printer.increment();
-            assertNotNull("Getting message: "+i,consumer.receive(5000));
+            assertNotNull("Getting message: "+i,consumer.receive(20000));
         }
         end1 = System.currentTimeMillis();
         System.out.println("Consumed messages/sec: "+ (PRODUCE_COUNT*1000.0/(end1-start)));

Modified: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/ft/master.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/ft/master.xml?rev=391053&r1=391052&r2=391053&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/ft/master.xml
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/ft/master.xml
Mon Apr  3 07:15:17 2006
@@ -17,13 +17,13 @@
 <beans xmlns="http://activemq.org/config/1.0">
   <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
 
-  <broker brokerName="master" persistent="false" useJmx="false">
+  <broker brokerName="master" persistent="false" useJmx="false" deleteAllMessagesOnStartup="true">
     <transportConnectors>
       <transportConnector uri="tcp://localhost:62001"/>
     </transportConnectors>
 
     <persistenceAdapter>
-      <memoryPersistenceAdapter/>
+      <kahaPersistentAdaptor dir = "activemq-data/master"/>
     </persistenceAdapter>
   </broker>
 

Modified: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/ft/slave.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/ft/slave.xml?rev=391053&r1=391052&r2=391053&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/ft/slave.xml
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/ft/slave.xml
Mon Apr  3 07:15:17 2006
@@ -17,7 +17,7 @@
 <beans xmlns="http://activemq.org/config/1.0">
   <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
 
-  <broker brokerName="slave" persistent="false" useJmx="false" masterConnectorURI="tcp://localhost:62001">
+  <broker brokerName="slave" persistent="false" useJmx="false" masterConnectorURI="tcp://localhost:62001"
deleteAllMessagesOnStartup="true">
     <transportConnectors>
       <transportConnector uri="tcp://localhost:62002"/>
     </transportConnectors>
@@ -25,7 +25,7 @@
     
 
     <persistenceAdapter>
-      <memoryPersistenceAdapter/>
+      <kahaPersistentAdaptor dir = "activemq-data/slave"/>
     </persistenceAdapter>
   </broker>
 

Added: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/store/kahabroker.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/store/kahabroker.xml?rev=391053&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/store/kahabroker.xml
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/store/kahabroker.xml
Mon Apr  3 07:15:17 2006
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://activemq.org/config/1.0">
+  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+  <broker brokerName="broker" persistent="false" useJmx="false">
+     <transportConnectors>
+      <transportConnector uri="tcp://localhost:0"/>
+    </transportConnectors>
+
+    <persistenceAdapter>
+      <kahaPersistentAdaptor dir = "activemq-data/storetest"/>
+    </persistenceAdapter>
+  </broker>
+
+</beans>

Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/broker/store/kahabroker.xml
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/perf/kahaBroker.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/perf/kahaBroker.xml?rev=391053&r1=391052&r2=391053&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/perf/kahaBroker.xml
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/perf/kahaBroker.xml
Mon Apr  3 07:15:17 2006
@@ -17,7 +17,7 @@
 <beans xmlns="http://activemq.org/config/1.0">
   <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
 
-  <broker brokerName="broker" persistent="true" useShutdownHook="false">
+  <broker brokerName="broker" persistent="true" useShutdownHook="false" deleteAllMessagesOnStartup="true">
     <transportConnectors>
       <transportConnector uri="tcp://localhost:61616"/>
     </transportConnectors>



Mime
View raw message