| Commit in servicemix on MAIN | |||
| .cvsignore | +1 | 1.1 -> 1.2 | |
| base/src/test/java/org/servicemix/components/jca/JmsOverJcaWithFullXATest.java | +40 | added 1.1 | |
| base/src/test/resources/org/servicemix/components/jca/xa-on-jca-flow.xml | +122 | added 1.1 | |
| +163 | |||
Added a full xa jms sample
servicemix
diff -u -r1.1 -r1.2 --- .cvsignore 1 Jun 2005 19:39:22 -0000 1.1 +++ .cvsignore 4 Oct 2005 16:11:27 -0000 1.2 @@ -1,2 +1,3 @@
.project .classpath
+build.properties
\ No newline at end of file
servicemix/base/src/test/java/org/servicemix/components/jca
JmsOverJcaWithFullXATest.java added at 1.1
diff -N JmsOverJcaWithFullXATest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ JmsOverJcaWithFullXATest.java 4 Oct 2005 16:11:27 -0000 1.1 @@ -0,0 +1,40 @@
+/**
+ *
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ *
+ * 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.servicemix.components.jca;
+
+import org.servicemix.TestSupport;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class JmsOverJcaWithFullXATest extends TestSupport {
+
+ public void testSendMessagesToJmsThenOutofJmsToReceiver() throws Exception {
+ QName service = new QName("http://servicemix.org/cheese/", "myJmsSender");
+
+ assertSendAndReceiveMessages(service);
+ }
+
+ protected AbstractXmlApplicationContext createBeanFactory() {
+ return new ClassPathXmlApplicationContext("org/servicemix/components/jca/xa-on-jca-flow.xml");
+ }
+}
servicemix/base/src/test/resources/org/servicemix/components/jca
xa-on-jca-flow.xml added at 1.1
diff -N xa-on-jca-flow.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ xa-on-jca-flow.xml 4 Oct 2005 16:11:27 -0000 1.1 @@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns:foo="http://servicemix.org/cheese/"> + + <!-- + || ActiveMQ Broker + --> + <bean id="broker" class="org.activemq.spring.BrokerFactoryBean" singleton="true"> + <property name="config" value="classpath:org/servicemix/components/jca/broker.xml"/> + </bean> + + <!-- START SNIPPET: jca --> + <bean id="jencks" class="org.jencks.JCAContainer"> + + <!-- lets use the default configuration of work manager and transaction manager--> + <property name="bootstrapContext"> + <bean class="org.jencks.factory.BootstrapContextFactoryBean"> + <property name="threadPoolSize" value="25"/> + </bean> + </property> + + + <!-- the JCA Resource Adapter --> + <property name="resourceAdapter"> + <bean id="activeMQResourceAdapter" class="org.activemq.ra.ActiveMQResourceAdapter"> + <property name="serverUrl" value="tcp://localhost:61626"/> + </bean> + </property> + </bean> + <!-- END SNIPPET: jca --> + + <!-- START SNIPPET: tm --> + <bean id="transactionContextManager" class="org.jencks.factory.TransactionContextManagerFactoryBean"/> + <bean id="userTransaction" class="org.jencks.factory.GeronimoTransactionManagerFactoryBean" /> + <!-- END SNIPPET: tm --> + + <!-- the JBI container --> + <container id="jbi"> + + <!-- use JCA flow --> + <property name="flow"> + <bean class="org.servicemix.jbi.nmr.flow.jca.JCAFlow"> + <property name="transactionContextManager" ref="transactionContextManager" /> + <property name="jmsURL" value="tcp://localhost:61626" /> + </bean> + </property> + <!-- use XA transactions --> + <property name="transactionManager" ref="userTransaction"/> + <!-- use autoEnlistInTransaction --> + <property name="autoEnlistInTransaction" value="true"/> + + <components> + + <component id="myJmsSender" service="foo:myJmsSender" class="org.servicemix.components.jms.JmsSenderComponent"> + <property name="template"> + <bean class="org.springframework.jms.core.JmsTemplate"> + <property name="connectionFactory" ref="jmsFactory"/> + <property name="defaultDestinationName" value="test.org.servicemix.example.jca"/> + <property name="pubSubDomain" value="true"/> + </bean> + </property> + </component> + + <!-- START SNIPPET: receive --> + <component id="myJmsReceiver" service="foo:myJmsReceiver" class="org.servicemix.components.jms.JmsInUsingJCABinding" destinationService="foo:receiver"> + + <property name="jcaContainer" ref="jencks"/> + + <property name="activationSpec"> + <bean class="org.activemq.ra.ActiveMQActivationSpec"> + <property name="destination" value="test.org.servicemix.example.jca"/> + <property name="destinationType" value="javax.jms.Topic"/> + </bean> + </property> + + </component> + <!-- END SNIPPET: receive --> + + <component id="receiver" service="foo:receiver" class="org.servicemix.examples.ReceiverComponent"/> + + + <!-- just to test that we are sending messages, lets trace the messages we receive --> + <component id="jmsTrace" service="foo:jmsTrace" class="org.servicemix.components.jms.JmsInUsingJCABinding" destinationService="foo:trace"> + + <property name="jcaContainer" ref="jencks"/> + + <property name="activationSpec"> + <bean class="org.activemq.ra.ActiveMQActivationSpec"> + <property name="destination" value="test.org.servicemix.example.jca"/> + <property name="destinationType" value="javax.jms.Topic"/> + </bean> + </property> + </component> + + <component id="jmsTrace" service="foo:trace" class="org.servicemix.components.groovy.GroovyComponent"> + <property name="disableOutput" value="true"/> + <property name="scriptText"> + <value> + <![CDATA[ +log.info "Received message $inMessage with content $inMessage.bodyText" + ]]> + </value> + </property> + </component> + </components> + </container> + + + <bean id="client" class="org.servicemix.client.DefaultServiceMixClient"> + <constructor-arg ref="jbi"/> + </bean> + + <bean id="jmsFactory" class="org.activemq.pool.PooledConnectionFactory"> + <property name="connectionFactory"> + <bean class="org.activemq.ActiveMQConnectionFactory"> + <property name="brokerURL"> + <value>tcp://localhost:61626</value> + </property> + </bean> + </property> + </bean> + +</beans>
