diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaLoadTester.java b/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaLoadTester.java new file mode 100755 index 0000000000..5ecbe03b94 --- /dev/null +++ b/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaLoadTester.java @@ -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()); + } + +} diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaRecoveryBrokerTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaRecoveryBrokerTest.java new file mode 100644 index 0000000000..01c8bce8aa --- /dev/null +++ b/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaRecoveryBrokerTest.java @@ -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()); + } + +} diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaXARecoveryBrokerTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaXARecoveryBrokerTest.java new file mode 100644 index 0000000000..bd6b22f086 --- /dev/null +++ b/activemq-core/src/test/java/org/apache/activemq/broker/store/KahaXARecoveryBrokerTest.java @@ -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(); + } + +} diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java b/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java index c02d7adafc..78300d003e 100755 --- a/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/store/LoadTester.java @@ -86,7 +86,7 @@ public class LoadTester extends JmsTestSupport { 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))); diff --git a/activemq-core/src/test/resources/org/apache/activemq/broker/ft/master.xml b/activemq-core/src/test/resources/org/apache/activemq/broker/ft/master.xml index 24bac5c901..12888486ae 100755 --- a/activemq-core/src/test/resources/org/apache/activemq/broker/ft/master.xml +++ b/activemq-core/src/test/resources/org/apache/activemq/broker/ft/master.xml @@ -17,13 +17,13 @@ - + - + diff --git a/activemq-core/src/test/resources/org/apache/activemq/broker/ft/slave.xml b/activemq-core/src/test/resources/org/apache/activemq/broker/ft/slave.xml index 71d55e5190..a593b67312 100755 --- a/activemq-core/src/test/resources/org/apache/activemq/broker/ft/slave.xml +++ b/activemq-core/src/test/resources/org/apache/activemq/broker/ft/slave.xml @@ -17,7 +17,7 @@ - + @@ -25,7 +25,7 @@ - + diff --git a/activemq-core/src/test/resources/org/apache/activemq/broker/store/kahabroker.xml b/activemq-core/src/test/resources/org/apache/activemq/broker/store/kahabroker.xml new file mode 100755 index 0000000000..47a1516c30 --- /dev/null +++ b/activemq-core/src/test/resources/org/apache/activemq/broker/store/kahabroker.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + diff --git a/activemq-core/src/test/resources/org/apache/activemq/perf/kahaBroker.xml b/activemq-core/src/test/resources/org/apache/activemq/perf/kahaBroker.xml index 6cb85c6731..88229d0393 100644 --- a/activemq-core/src/test/resources/org/apache/activemq/perf/kahaBroker.xml +++ b/activemq-core/src/test/resources/org/apache/activemq/perf/kahaBroker.xml @@ -17,7 +17,7 @@ - +