You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2006/07/04 20:04:51 UTC
svn commit: r419058 - in /incubator/activemq/trunk/activemq-core: ./
src/test/java/org/apache/activemq/network/jms/
src/test/resources/org/apache/activemq/network/jms/
Author: jstrachan
Date: Tue Jul 4 11:04:50 2006
New Revision: 419058
URL: http://svn.apache.org/viewvc?rev=419058&view=rev
Log:
added an example and test case of configuring the JMS to JMS bridge using the XBean format rather than the pure Spring version thats currently on the wiki - see http://incubator.apache.org/activemq/jms-to-jms-bridge.html
Added:
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeXBeanTest.java (with props)
incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/jms/queue-xbean.xml (with props)
Modified:
incubator/activemq/trunk/activemq-core/pom.xml
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java
Modified: incubator/activemq/trunk/activemq-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/pom.xml?rev=419058&r1=419057&r2=419058&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/pom.xml (original)
+++ incubator/activemq/trunk/activemq-core/pom.xml Tue Jul 4 11:04:50 2006
@@ -257,7 +257,6 @@
<!-- this one is a little flaky and can fail on some platforms randomly -->
<exclude>**/QuickJournalRecoveryBrokerTest.*</exclude>
<exclude>**/RendezvousDiscoverTransportTest.*</exclude>
- <exclude>**/QueueBridgeXBeanTest.*</exclude>
<!-- UDP related tests someimes fail on some platforms -->
<exclude>**/UdpTransportTest.*</exclude>
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java?rev=419058&r1=419057&r2=419058&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java Tue Jul 4 11:04:50 2006
@@ -51,23 +51,35 @@
protected MessageProducer requestServerProducer;
protected void setUp() throws Exception {
-
super.setUp();
- context = new ClassPathXmlApplicationContext("org/apache/activemq/network/jms/queue-config.xml");
- ActiveMQConnectionFactory fac = (ActiveMQConnectionFactory) context.getBean("localFactory");
- localConnection = fac.createQueueConnection();
- localConnection.start();
+ context = createApplicationContext();
+
+ createConnections();
+
requestServerSession = localConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
Queue theQueue = requestServerSession.createQueue(getClass().getName());
requestServerConsumer = requestServerSession.createConsumer(theQueue);
requestServerConsumer.setMessageListener(this);
requestServerProducer = requestServerSession.createProducer(null);
+ QueueSession session = remoteConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
+ requestor = new QueueRequestor(session,theQueue);
+ }
+
+
+ protected void createConnections() throws JMSException {
+ ActiveMQConnectionFactory fac = (ActiveMQConnectionFactory) context.getBean("localFactory");
+ localConnection = fac.createQueueConnection();
+ localConnection.start();
+
fac = (ActiveMQConnectionFactory) context.getBean("remoteFactory");
remoteConnection = fac.createQueueConnection();
remoteConnection.start();
- QueueSession session = remoteConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
- requestor = new QueueRequestor(session,theQueue);
+ }
+
+
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/activemq/network/jms/queue-config.xml");
}
Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeXBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeXBeanTest.java?rev=419058&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeXBeanTest.java (added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeXBeanTest.java Tue Jul 4 11:04:50 2006
@@ -0,0 +1,48 @@
+/**
+ *
+ * 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.network.jms;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractApplicationContext;
+
+import javax.jms.JMSException;
+
+
+/**
+ *
+ * @version $Revision$
+ */
+public class QueueBridgeXBeanTest extends QueueBridgeTest {
+
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/activemq/network/jms/queue-xbean.xml");
+ }
+
+ /*
+ protected void createConnections() throws JMSException {
+ ActiveMQConnectionFactory fac = (ActiveMQConnectionFactory) context.getBean("localFactory");
+ localConnection = fac.createQueueConnection();
+ localConnection.start();
+
+ fac = (ActiveMQConnectionFactory) context.getBean("remoteFactory");
+ remoteConnection = fac.createQueueConnection();
+ remoteConnection.start();
+ }
+ */
+
+}
Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeXBeanTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeXBeanTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeXBeanTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/jms/queue-xbean.xml
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/jms/queue-xbean.xml?rev=419058&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/jms/queue-xbean.xml (added)
+++ incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/jms/queue-xbean.xml Tue Jul 4 11:04:50 2006
@@ -0,0 +1,66 @@
+<?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>
+ <bean
+ class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
+
+ <!-- remote broker -->
+
+ <broker xmlns="http://activemq.org/config/1.0" id="remotebroker"
+ brokerName="remotebroker" persistent="false">
+ <transportConnectors>
+ <transportConnector uri="tcp://localhost:61666" />
+ </transportConnectors>
+ </broker>
+
+ <!-- local broker with embedded Jms to Jms bridge (ok - it's contrived) -->
+
+ <!-- START SNIPPET: example -->
+ <broker xmlns="http://activemq.org/config/1.0" id="localbroker"
+ brokerName="localBroker" persistent="false">
+ <transportConnectors>
+ <transportConnector uri="tcp://localhost:61234" />
+ </transportConnectors>
+
+ <jmsBridgeConnectors>
+ <jmsQueueConnector
+ outboundQueueConnectionFactory="#remoteFactory">
+ <inboundQueueBridges>
+ <inboundQueueBridge
+ inboundQueueName="org.apache.activemq.network.jms.QueueBridgeXBeanTest" />
+ </inboundQueueBridges>
+ </jmsQueueConnector>
+ </jmsBridgeConnectors>
+ </broker>
+
+ <!-- JMS ConnectionFactory to use remote -->
+ <bean id="remoteFactory"
+ class="org.apache.activemq.ActiveMQConnectionFactory">
+ <property name="brokerURL" value="tcp://localhost:61666" />
+ </bean>
+ <!-- END SNIPPET: example -->
+
+ <!-- JMS ConnectionFactory to use local broker (the one with the bridge) -->
+ <bean id="localFactory"
+ class="org.apache.activemq.ActiveMQConnectionFactory">
+ <property name="brokerURL" value="tcp://localhost:61234" />
+ </bean>
+
+</beans>
+
+
+
Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/jms/queue-xbean.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/jms/queue-xbean.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/jms/queue-xbean.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml