diff --git a/assembly/src/test/org/activemq/usecases/TwoBrokerQueueSendReceiveTest.java b/assembly/src/test/org/activemq/usecases/TwoBrokerQueueSendReceiveTest.java new file mode 100644 index 0000000000..9b899a2f29 --- /dev/null +++ b/assembly/src/test/org/activemq/usecases/TwoBrokerQueueSendReceiveTest.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2004 Protique Ltd + * + * 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.activemq.usecases; + +import org.activemq.ActiveMQConnectionFactory; + +/** + * @version $Revision: 1.1.1.1 $ + */ +public class TwoBrokerQueueSendReceiveTest extends TwoBrokerTopicSendReceiveTest { + + protected ActiveMQConnectionFactory sendFactory; + protected ActiveMQConnectionFactory receiveFactory; + + protected void setUp() throws Exception { + topic = false; + super.setUp(); + } + + +} diff --git a/assembly/src/test/org/activemq/usecases/TwoBrokerTopicSendReceiveTest.java b/assembly/src/test/org/activemq/usecases/TwoBrokerTopicSendReceiveTest.java new file mode 100644 index 0000000000..76c899af6d --- /dev/null +++ b/assembly/src/test/org/activemq/usecases/TwoBrokerTopicSendReceiveTest.java @@ -0,0 +1,79 @@ +/** + * + * Copyright 2004 Protique Ltd + * + * 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.activemq.usecases; + +import javax.jms.Connection; +import javax.jms.JMSException; + +import org.activemq.ActiveMQConnectionFactory; +import org.activemq.broker.TransportConnector; +import org.activemq.broker.BrokerService; +import org.activemq.xbean.BrokerFactoryBean; +import org.activemq.test.JmsTopicSendReceiveWithTwoConnectionsTest; +import org.springframework.core.io.ClassPathResource; + +/** + * @version $Revision: 1.1.1.1 $ + */ +public class TwoBrokerTopicSendReceiveTest extends JmsTopicSendReceiveWithTwoConnectionsTest { + + protected ActiveMQConnectionFactory sendFactory; + protected ActiveMQConnectionFactory receiveFactory; + + protected void setUp() throws Exception { + sendFactory = createSenderConnectionFactory(); + receiveFactory = createReceiverConnectionFactory(); + super.setUp(); + } + + protected ActiveMQConnectionFactory createReceiverConnectionFactory() throws JMSException { + return createConnectionFactory("org/activemq/usecases/receiver.xml", "receiver", "vm://receiver"); + } + + protected ActiveMQConnectionFactory createSenderConnectionFactory() throws JMSException { + return createConnectionFactory("org/activemq/usecases/sender.xml", "sender", "vm://sender"); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + protected Connection createReceiveConnection() throws JMSException { + return receiveFactory.createConnection(); + } + + protected Connection createSendConnection() throws JMSException { + return sendFactory.createConnection(); + } + + protected ActiveMQConnectionFactory createConnectionFactory(String config, String brokerName, String connectUrl) throws JMSException { + try { + BrokerFactoryBean brokerFactory = new BrokerFactoryBean(new ClassPathResource(config)); + brokerFactory.afterPropertiesSet(); + + BrokerService broker = brokerFactory.getBroker(); + ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(((TransportConnector)broker.getTransportConnectors().get(0)).getConnectUri()); + + return factory; + + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/assembly/src/test/org/activemq/usecases/TwoBrokerTopicSendReceiveUsingHttpTest.java b/assembly/src/test/org/activemq/usecases/TwoBrokerTopicSendReceiveUsingHttpTest.java new file mode 100644 index 0000000000..4debedb48d --- /dev/null +++ b/assembly/src/test/org/activemq/usecases/TwoBrokerTopicSendReceiveUsingHttpTest.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2004 Protique Ltd + * + * 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.activemq.usecases; + +import org.activemq.ActiveMQConnectionFactory; + +import javax.jms.JMSException; + +/** + * @version $Revision: 1.1.1.1 $ + */ +public class TwoBrokerTopicSendReceiveUsingHttpTest extends TwoBrokerTopicSendReceiveTest { + + protected ActiveMQConnectionFactory createReceiverConnectionFactory() throws JMSException { + return createConnectionFactory("org/activemq/usecases/receiver-http.xml", "receiver", "vm://receiver"); + } + + protected ActiveMQConnectionFactory createSenderConnectionFactory() throws JMSException { + return createConnectionFactory("org/activemq/usecases/sender-http.xml", "sender", "vm://sender"); + } +} diff --git a/assembly/src/test/org/activemq/usecases/TwoBrokerTopicSendReceiveUsingJavaConfigurationTest.java b/assembly/src/test/org/activemq/usecases/TwoBrokerTopicSendReceiveUsingJavaConfigurationTest.java new file mode 100644 index 0000000000..0022d5e3b6 --- /dev/null +++ b/assembly/src/test/org/activemq/usecases/TwoBrokerTopicSendReceiveUsingJavaConfigurationTest.java @@ -0,0 +1,75 @@ +/** + * + * Copyright 2004 Protique Ltd + * + * 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.activemq.usecases; + +import org.activemq.ActiveMQConnectionFactory; +import org.activemq.store.memory.MemoryPersistenceAdapter; +import org.activemq.broker.BrokerService; + +import javax.jms.JMSException; + +/** + * @version $Revision: 1.1.1.1 $ + */ +public class TwoBrokerTopicSendReceiveUsingJavaConfigurationTest extends TwoBrokerTopicSendReceiveTest { + BrokerService receiveBroker; + BrokerService sendBroker; + + protected ActiveMQConnectionFactory createReceiverConnectionFactory() throws JMSException { + try { + receiveBroker = new BrokerService(); + receiveBroker.setPersistent(false); + receiveBroker.addConnector("tcp://localhost:62002"); + receiveBroker.addNetworkConnector("static:failover:tcp://localhost:62001"); + receiveBroker.start(); + + ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:62002"); + return factory; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + protected ActiveMQConnectionFactory createSenderConnectionFactory() throws JMSException { + try { + sendBroker = new BrokerService(); + sendBroker.setPersistent(false); + sendBroker.addConnector("tcp://localhost:62001"); + sendBroker.addNetworkConnector("static:failover:tcp://localhost:62002"); + sendBroker.start(); + + ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:62001"); + return factory; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + protected void tearDown() throws Exception { + super.tearDown(); + if (sendBroker != null) { + sendBroker.stop(); + } + if (receiveBroker != null) { + receiveBroker.stop(); + } + } + +} diff --git a/assembly/src/test/org/activemq/usecases/TwoMulticastDiscoveryBrokerTopicSendReceiveTest.java b/assembly/src/test/org/activemq/usecases/TwoMulticastDiscoveryBrokerTopicSendReceiveTest.java new file mode 100644 index 0000000000..ae3bd7811f --- /dev/null +++ b/assembly/src/test/org/activemq/usecases/TwoMulticastDiscoveryBrokerTopicSendReceiveTest.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2004 Protique Ltd + * + * 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.activemq.usecases; + +import org.activemq.ActiveMQConnectionFactory; + +import javax.jms.JMSException; + +/** + * @version $Revision: 1.1.1.1 $ + */ +public class TwoMulticastDiscoveryBrokerTopicSendReceiveTest extends TwoBrokerTopicSendReceiveTest { + + protected ActiveMQConnectionFactory createReceiverConnectionFactory() throws JMSException { + return createConnectionFactory("org/activemq/usecases/receiver-discovery.xml", "receiver", "vm://receiver"); + } + + protected ActiveMQConnectionFactory createSenderConnectionFactory() throws JMSException { + return createConnectionFactory("org/activemq/usecases/sender-discovery.xml", "sender", "vm://sender"); + } +} diff --git a/assembly/src/test/org/activemq/usecases/receiver-discovery.xml b/assembly/src/test/org/activemq/usecases/receiver-discovery.xml index 330f42bb58..6f99c76bc5 100644 --- a/assembly/src/test/org/activemq/usecases/receiver-discovery.xml +++ b/assembly/src/test/org/activemq/usecases/receiver-discovery.xml @@ -1,22 +1,19 @@ - - - + - - - - - - - + + + + - + + + - - - + + + diff --git a/assembly/src/test/org/activemq/usecases/receiver-http.xml b/assembly/src/test/org/activemq/usecases/receiver-http.xml index d1cc778349..63d0cb9ffc 100644 --- a/assembly/src/test/org/activemq/usecases/receiver-http.xml +++ b/assembly/src/test/org/activemq/usecases/receiver-http.xml @@ -1,19 +1,19 @@ - - - - - - + - - - + + + + - - - + + + + + + + diff --git a/assembly/src/test/org/activemq/usecases/receiver.xml b/assembly/src/test/org/activemq/usecases/receiver.xml index 784224f974..c7d720e74a 100755 --- a/assembly/src/test/org/activemq/usecases/receiver.xml +++ b/assembly/src/test/org/activemq/usecases/receiver.xml @@ -1,21 +1,18 @@ - - - + - - - - + + + + - - - + + + - - - + + + - diff --git a/assembly/src/test/org/activemq/usecases/sender-discovery.xml b/assembly/src/test/org/activemq/usecases/sender-discovery.xml index cf9fc8b1e2..a33a55dd93 100644 --- a/assembly/src/test/org/activemq/usecases/sender-discovery.xml +++ b/assembly/src/test/org/activemq/usecases/sender-discovery.xml @@ -1,21 +1,18 @@ - - + - - - - + + + + - - - + + + - - - - - + + + diff --git a/assembly/src/test/org/activemq/usecases/sender-http.xml b/assembly/src/test/org/activemq/usecases/sender-http.xml index 8998f34818..cbde6d5abc 100644 --- a/assembly/src/test/org/activemq/usecases/sender-http.xml +++ b/assembly/src/test/org/activemq/usecases/sender-http.xml @@ -1,19 +1,19 @@ - - - - - - + - - - + + + + - - - + + + + + + + diff --git a/assembly/src/test/org/activemq/usecases/sender.xml b/assembly/src/test/org/activemq/usecases/sender.xml index c0002093ce..fd5bd7788f 100755 --- a/assembly/src/test/org/activemq/usecases/sender.xml +++ b/assembly/src/test/org/activemq/usecases/sender.xml @@ -1,19 +1,19 @@ - - - - - - + - - - + + + + - - - + + + + + + +