Ported some of the broker network config files to the new xml format. Added initial test cases to test the configurations.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@357304 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2005-12-17 05:49:15 +00:00
parent d30a42cd34
commit 77cf351be1
11 changed files with 331 additions and 78 deletions

View File

@ -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();
}
}

View File

@ -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;
}
}

View File

@ -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");
}
}

View File

@ -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();
}
}
}

View File

@ -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");
}
}

View File

@ -1,22 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
<!-- START SNIPPET: example -->
<beans>
<beans xmlns="http://activemq.org/config/1.0">
<broker name="receiver">
<connector>
<tcpServerTransport uri="tcp://localhost:0"/>
</connector>
<discoveryAgent>
<multicastDiscovery channelName="development" uri="multicast://228.8.9.10:2677"/>
</discoveryAgent>
<broker name="receiver" persistent="false" useJmx="false">
<transportConnectors>
<transportConnector uri="tcp://localhost:0" discoveryUri="multicast://default"/>
</transportConnectors>
<discoveryNetworkConnector/>
<networkConnectors>
<networkConnector uri="static:discovery:(multicast://default)"/>
</networkConnectors>
<persistence>
<vmPersistence/>
</persistence>
<persistenceAdapter>
<memoryPersistenceAdapter/>
</persistenceAdapter>
</broker>
</beans>

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
<beans>
<broker name="receiver">
<connector>
<serverTransport uri="http://localhost:62302"/>
</connector>
<beans xmlns="http://activemq.org/config/1.0">
<networkConnector>
<networkChannel uri="reliable:http://localhost:62301"/>
</networkConnector>
<broker name="receiver" persistent="false">
<transportConnectors>
<transportConnector uri="http://localhost:62302"/>
</transportConnectors>
<persistence>
<vmPersistence/>
</persistence>
<networkConnectors>
<networkConnector uri="static:(failover:http://localhost:62301)"/>
</networkConnectors>
<persistenceAdapter>
<memoryPersistenceAdapter/>
</persistenceAdapter>
</broker>
</beans>

View File

@ -1,21 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
<!-- START SNIPPET: example -->
<beans>
<beans xmlns="http://activemq.org/config/1.0">
<broker name="receiver">
<connector>
<tcpServerTransport uri="tcp://localhost:62002"/>
</connector>
<broker brokerName="receiver" persistent="false" useJmx="false">
<transportConnectors>
<transportConnector uri="tcp://localhost:62002"/>
</transportConnectors>
<networkConnector>
<networkChannel uri="reliable:tcp://localhost:62001"/>
</networkConnector>
<networkConnectors>
<networkConnector uri="static:(failover:tcp://localhost:62001)"/>
</networkConnectors>
<persistence>
<vmPersistence/>
</persistence>
<persistenceAdapter>
<memoryPersistenceAdapter/>
</persistenceAdapter>
</broker>
</beans>
<!-- END SNIPPET: example -->

View File

@ -1,21 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
<beans>
<beans xmlns="http://activemq.org/config/1.0">
<broker name="sender">
<connector>
<tcpServerTransport uri="tcp://localhost:0"/>
</connector>
<broker name="sender" persistent="false" useJmx="false">
<transportConnectors>
<transportConnector uri="tcp://localhost:0" discoveryUri="multicast://default"/>
</transportConnectors>
<discoveryAgent>
<multicastDiscovery channelName="development" uri="multicast://228.8.9.10:2677"/>
</discoveryAgent>
<networkConnectors>
<networkConnector uri="static:discovery:(multicast://default)"/>
</networkConnectors>
<discoveryNetworkConnector/>
<persistence>
<vmPersistence/>
</persistence>
<persistenceAdapter>
<memoryPersistenceAdapter/>
</persistenceAdapter>
</broker>
</beans>

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
<beans>
<broker name="sender">
<connector>
<serverTransport uri="http://localhost:62301"/>
</connector>
<beans xmlns="http://activemq.org/config/1.0">
<networkConnector>
<networkChannel uri="reliable:http://localhost:62302"/>
</networkConnector>
<broker name="sender" persistent="false">
<transportConnectors>
<transportConnector uri="http://localhost:62301"/>
</transportConnectors>
<persistence>
<vmPersistence/>
</persistence>
<networkConnectors>
<networkConnector uri="static:(failover:http://localhost:62302)"/>
</networkConnectors>
<persistenceAdapter>
<memoryPersistenceAdapter/>
</persistenceAdapter>
</broker>
</beans>

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
<beans>
<broker name="sender">
<connector>
<tcpServerTransport uri="tcp://localhost:62001"/>
</connector>
<beans xmlns="http://activemq.org/config/1.0">
<networkConnector>
<networkChannel uri="reliable:tcp://localhost:62002"/>
</networkConnector>
<broker brokerName="sender" persistent="false" useJmx="false">
<transportConnectors>
<transportConnector uri="tcp://localhost:62001"/>
</transportConnectors>
<persistence>
<vmPersistence/>
</persistence>
<networkConnectors>
<networkConnector uri="static:(failover:tcp://localhost:62002)"/>
</networkConnectors>
<persistenceAdapter>
<memoryPersistenceAdapter/>
</persistenceAdapter>
</broker>
</beans>