mirror of https://github.com/apache/activemq.git
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:
parent
d30a42cd34
commit
77cf351be1
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,22 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
|
<beans xmlns="http://activemq.org/config/1.0">
|
||||||
<!-- START SNIPPET: example -->
|
|
||||||
<beans>
|
|
||||||
|
|
||||||
<broker name="receiver">
|
|
||||||
<connector>
|
|
||||||
<tcpServerTransport uri="tcp://localhost:0"/>
|
|
||||||
</connector>
|
|
||||||
|
|
||||||
<discoveryAgent>
|
<broker name="receiver" persistent="false" useJmx="false">
|
||||||
<multicastDiscovery channelName="development" uri="multicast://228.8.9.10:2677"/>
|
<transportConnectors>
|
||||||
</discoveryAgent>
|
<transportConnector uri="tcp://localhost:0" discoveryUri="multicast://default"/>
|
||||||
|
</transportConnectors>
|
||||||
|
|
||||||
<discoveryNetworkConnector/>
|
<networkConnectors>
|
||||||
|
<networkConnector uri="static:discovery:(multicast://default)"/>
|
||||||
|
</networkConnectors>
|
||||||
|
|
||||||
<persistence>
|
<persistenceAdapter>
|
||||||
<vmPersistence/>
|
<memoryPersistenceAdapter/>
|
||||||
</persistence>
|
</persistenceAdapter>
|
||||||
</broker>
|
</broker>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
|
|
||||||
<beans>
|
|
||||||
|
|
||||||
<broker name="receiver">
|
<beans xmlns="http://activemq.org/config/1.0">
|
||||||
<connector>
|
|
||||||
<serverTransport uri="http://localhost:62302"/>
|
|
||||||
</connector>
|
|
||||||
|
|
||||||
<networkConnector>
|
<broker name="receiver" persistent="false">
|
||||||
<networkChannel uri="reliable:http://localhost:62301"/>
|
<transportConnectors>
|
||||||
</networkConnector>
|
<transportConnector uri="http://localhost:62302"/>
|
||||||
|
</transportConnectors>
|
||||||
|
|
||||||
<persistence>
|
<networkConnectors>
|
||||||
<vmPersistence/>
|
<networkConnector uri="static:(failover:http://localhost:62301)"/>
|
||||||
</persistence>
|
</networkConnectors>
|
||||||
|
|
||||||
|
<persistenceAdapter>
|
||||||
|
<memoryPersistenceAdapter/>
|
||||||
|
</persistenceAdapter>
|
||||||
</broker>
|
</broker>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
|
<beans xmlns="http://activemq.org/config/1.0">
|
||||||
<!-- START SNIPPET: example -->
|
|
||||||
<beans>
|
|
||||||
|
|
||||||
<broker name="receiver">
|
<broker brokerName="receiver" persistent="false" useJmx="false">
|
||||||
<connector>
|
<transportConnectors>
|
||||||
<tcpServerTransport uri="tcp://localhost:62002"/>
|
<transportConnector uri="tcp://localhost:62002"/>
|
||||||
</connector>
|
</transportConnectors>
|
||||||
|
|
||||||
<networkConnector>
|
<networkConnectors>
|
||||||
<networkChannel uri="reliable:tcp://localhost:62001"/>
|
<networkConnector uri="static:(failover:tcp://localhost:62001)"/>
|
||||||
</networkConnector>
|
</networkConnectors>
|
||||||
|
|
||||||
<persistence>
|
<persistenceAdapter>
|
||||||
<vmPersistence/>
|
<memoryPersistenceAdapter/>
|
||||||
</persistence>
|
</persistenceAdapter>
|
||||||
</broker>
|
</broker>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
<!-- END SNIPPET: example -->
|
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
|
<beans xmlns="http://activemq.org/config/1.0">
|
||||||
<beans>
|
|
||||||
|
|
||||||
<broker name="sender">
|
<broker name="sender" persistent="false" useJmx="false">
|
||||||
<connector>
|
<transportConnectors>
|
||||||
<tcpServerTransport uri="tcp://localhost:0"/>
|
<transportConnector uri="tcp://localhost:0" discoveryUri="multicast://default"/>
|
||||||
</connector>
|
</transportConnectors>
|
||||||
|
|
||||||
<discoveryAgent>
|
<networkConnectors>
|
||||||
<multicastDiscovery channelName="development" uri="multicast://228.8.9.10:2677"/>
|
<networkConnector uri="static:discovery:(multicast://default)"/>
|
||||||
</discoveryAgent>
|
</networkConnectors>
|
||||||
|
|
||||||
<discoveryNetworkConnector/>
|
<persistenceAdapter>
|
||||||
|
<memoryPersistenceAdapter/>
|
||||||
<persistence>
|
</persistenceAdapter>
|
||||||
<vmPersistence/>
|
|
||||||
</persistence>
|
|
||||||
</broker>
|
</broker>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
|
|
||||||
<beans>
|
|
||||||
|
|
||||||
<broker name="sender">
|
<beans xmlns="http://activemq.org/config/1.0">
|
||||||
<connector>
|
|
||||||
<serverTransport uri="http://localhost:62301"/>
|
|
||||||
</connector>
|
|
||||||
|
|
||||||
<networkConnector>
|
<broker name="sender" persistent="false">
|
||||||
<networkChannel uri="reliable:http://localhost:62302"/>
|
<transportConnectors>
|
||||||
</networkConnector>
|
<transportConnector uri="http://localhost:62301"/>
|
||||||
|
</transportConnectors>
|
||||||
|
|
||||||
<persistence>
|
<networkConnectors>
|
||||||
<vmPersistence/>
|
<networkConnector uri="static:(failover:http://localhost:62302)"/>
|
||||||
</persistence>
|
</networkConnectors>
|
||||||
|
|
||||||
|
<persistenceAdapter>
|
||||||
|
<memoryPersistenceAdapter/>
|
||||||
|
</persistenceAdapter>
|
||||||
</broker>
|
</broker>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE beans PUBLIC "-//ACTIVEMQ//DTD//EN" "http://activemq.org/dtd/activemq.dtd">
|
|
||||||
<beans>
|
|
||||||
|
|
||||||
<broker name="sender">
|
<beans xmlns="http://activemq.org/config/1.0">
|
||||||
<connector>
|
|
||||||
<tcpServerTransport uri="tcp://localhost:62001"/>
|
|
||||||
</connector>
|
|
||||||
|
|
||||||
<networkConnector>
|
<broker brokerName="sender" persistent="false" useJmx="false">
|
||||||
<networkChannel uri="reliable:tcp://localhost:62002"/>
|
<transportConnectors>
|
||||||
</networkConnector>
|
<transportConnector uri="tcp://localhost:62001"/>
|
||||||
|
</transportConnectors>
|
||||||
|
|
||||||
<persistence>
|
<networkConnectors>
|
||||||
<vmPersistence/>
|
<networkConnector uri="static:(failover:tcp://localhost:62002)"/>
|
||||||
</persistence>
|
</networkConnectors>
|
||||||
|
|
||||||
|
<persistenceAdapter>
|
||||||
|
<memoryPersistenceAdapter/>
|
||||||
|
</persistenceAdapter>
|
||||||
</broker>
|
</broker>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|
Loading…
Reference in New Issue