You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2008/12/25 02:45:44 UTC
svn commit: r729387 - in
/servicemix/components/bindings/servicemix-cxf-bc/trunk: ./
src/main/java/org/apache/servicemix/cxfbc/
src/test/java/org/apache/servicemix/cxfbc/ src/test/resources/
src/test/resources/org/apache/servicemix/cxfbc/ src/test/reso...
Author: ffang
Date: Wed Dec 24 17:45:43 2008
New Revision: 729387
URL: http://svn.apache.org/viewvc?rev=729387&view=rev
Log:
[SM-1726]enable transaction support for cxf bc consumer over jms transport
Added:
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionTest.java (with props)
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.java (with props)
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction.xml (with props)
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml (with props)
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl (with props)
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/tx.xml (with props)
Modified:
servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/GreeterImplTwoWayJMS.java
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_test_timeout.xml
Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml?rev=729387&r1=729386&r2=729387&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml Wed Dec 24 17:45:43 2008
@@ -96,9 +96,39 @@
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-services</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-pool</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activeio-core</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.2.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-pool</artifactId>
+ <version>5.2.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activeio-core</artifactId>
+ <version>3.1.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-utils</artifactId>
<scope>provided</scope>
Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=729387&r1=729386&r2=729387&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java Wed Dec 24 17:45:43 2008
@@ -34,6 +34,7 @@
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.NormalizedMessage;
import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.transaction.TransactionManager;
import javax.wsdl.WSDLException;
import javax.wsdl.extensions.soap.SOAPBinding;
import javax.xml.namespace.QName;
@@ -88,11 +89,15 @@
import org.apache.cxf.service.model.BindingFaultInfo;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.FaultInfo;
import org.apache.cxf.service.model.MessagePartInfo;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.transport.ChainInitiationObserver;
+import org.apache.cxf.transport.Destination;
import org.apache.cxf.transport.http_jetty.JettyHTTPDestination;
import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine;
+import org.apache.cxf.transport.jms.JMSConfiguration;
+import org.apache.cxf.transport.jms.JMSDestination;
import org.apache.cxf.transport.http_jetty.continuations.JettyContinuationWrapper;
import org.apache.cxf.ws.addressing.AddressingProperties;
import org.apache.cxf.ws.rm.Servant;
@@ -113,7 +118,7 @@
import org.mortbay.jetty.HttpConnection;
import org.mortbay.jetty.handler.AbstractHandler;
import org.springframework.core.io.Resource;
-
+import org.springframework.transaction.PlatformTransactionManager;
/**
*
@@ -167,6 +172,8 @@
private List<AbstractFeature> features = new CopyOnWriteArrayList<AbstractFeature>();
+ private boolean transactionEnabled;
+
/**
* @return the wsdl
*/
@@ -292,9 +299,29 @@
super.activate();
registerListServiceHandler();
applyFeatures();
+ checkJmsTransportTransaction();
server.start();
}
+ private void checkJmsTransportTransaction() {
+ Destination destination = server.getDestination();
+ if (destination instanceof JMSDestination) {
+ JMSDestination jmsDestination = (JMSDestination)destination;
+ JMSConfiguration jmsConfig = jmsDestination.getJmsConfig();
+ if (jmsConfig.isSessionTransacted()) {
+ TransactionManager tm = (TransactionManager) getContext().getTransactionManager();
+ if (tm == null) {
+ throw new IllegalStateException("No TransactionManager available");
+ } else if (tm instanceof PlatformTransactionManager) {
+ jmsConfig.setTransactionManager((PlatformTransactionManager)tm);
+ setSynchronous(true);
+ transactionEnabled = true;
+ }
+ }
+ }
+
+ }
+
private void applyFeatures() {
if (getFeatures() != null) {
for (AbstractFeature feature : getFeatures()) {
@@ -780,6 +807,32 @@
}
}
+
+ public void handleFault(Message message) {
+ if (transactionEnabled) {
+ //detect if the fault is defined in the wsdl, which means need return to client and
+ //jms transactionManger just commit
+ Exchange ex = message.getExchange();
+ BindingOperationInfo boi = ex.get(BindingOperationInfo.class);
+ for (BindingFaultInfo bfi : boi.getFaults()) {
+ FaultInfo fi = bfi.getFaultInfo();
+ //get fault details
+ MessagePartInfo mpi = fi.getMessageParts().get(0);
+ if (mpi != null) {
+ Fault fault = (Fault) message.getContent(Exception.class);
+ Element detail = fault.getDetail();
+ if (detail != null
+ && detail.getFirstChild().getLocalName().equals(mpi.getName().getLocalPart())) {
+ //it's fault defined in the wsdl, so let it go back to the client
+ return;
+ }
+ }
+ }
+ //this exception is undefined in the wsdl, so tell the transactionManager injected into
+ //jms transport need rollback
+ throw new RuntimeException("rollback");
+ }
+ }
// this method is used for ws-policy to set BindingFaultInfo
protected void processFaultDetail(Fault fault, Message msg) {
Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionTest.java?rev=729387&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionTest.java (added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionTest.java Wed Dec 24 17:45:43 2008
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.cxfbc;
+
+import java.io.IOException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.ServerLauncher;
+import org.apache.hello_world_soap_http.BadRecordLitFault;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.HelloWorldService;
+import org.apache.hello_world_soap_http.NoSuchCodeLitFault;
+import org.apache.servicemix.jbi.container.SpringJBIContainer;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.tck.SpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class CxfBcJmsTransactionTest extends SpringTestSupport {
+
+ protected static boolean serversStarted;
+ private ServerLauncher sl;
+ private ServerLauncher embeddedLauncher;
+ private ServerLauncher jmsLauncher;
+
+
+
+ public void startServers() throws Exception {
+ if (serversStarted) {
+ return;
+ }
+ Map<String, String> props = new HashMap<String, String>();
+ if (System.getProperty("activemq.store.dir") != null) {
+ props.put("activemq.store.dir", System.getProperty("activemq.store.dir"));
+ }
+ props.put("java.util.logging.config.file",
+ System.getProperty("java.util.logging.config.file"));
+
+ assertTrue("server did not launch correctly",
+ launchServer(EmbededJMSBrokerLauncher.class, props, false));
+ embeddedLauncher = sl;
+ assertTrue("server did not launch correctly",
+ launchServer(MyJMSServer.class, null, false));
+ jmsLauncher = sl;
+
+ serversStarted = true;
+ }
+
+ protected void setUp() throws Exception {
+ startServers();
+ //super.setUp();
+
+ }
+
+ public void setUpJBI(String beanFile) throws Exception {
+ if (context != null) {
+ context.refresh();
+ }
+ transformer = new SourceTransformer();
+ if (beanFile == null) {
+ context = createBeanFactory();
+ } else {
+ context = createBeanFactory(beanFile);
+ }
+
+ jbi = (SpringJBIContainer) context.getBean("jbi");
+ assertNotNull("JBI Container not found in spring!", jbi);
+ }
+
+ protected void tearDown() throws Exception {
+ try {
+ embeddedLauncher.stopServer();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ fail("failed to stop server " + embeddedLauncher.getClass());
+ }
+ try {
+ jmsLauncher.stopServer();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ fail("failed to stop server " + jmsLauncher.getClass());
+ }
+ serversStarted = false;
+ }
+
+ public boolean launchServer(Class<?> clz, Map<String, String> p, boolean inProcess) {
+ boolean ok = false;
+ try {
+ sl = new ServerLauncher(clz.getName(), p, null, inProcess);
+ ok = sl.launchServer();
+ assertTrue("server failed to launch", ok);
+
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ fail("failed to launch server " + clz);
+ }
+
+ return ok;
+ }
+
+ public void testJMSTransaction() throws Exception {
+ setUpJBI("org/apache/servicemix/cxfbc/jms_transport_transaction.xml");
+ jmsTestBase();
+ }
+
+ private void jmsTestBase() throws Exception, NoSuchCodeLitFault, BadRecordLitFault {
+ SpringBusFactory bf = new SpringBusFactory();
+ Bus testBus = bf.createBus("org/apache/servicemix/cxfbc/jms_test_timeout.xml");
+ BusFactory.setDefaultBus(testBus);
+
+ URL wsdl = getWSDLURL("org/apache/servicemix/cxfbc/ws/security/hello_world.wsdl");
+
+ QName serviceName = getServiceName(new QName(
+ "http://apache.org/hello_world_soap_http", "HelloWorldService"));
+ QName portName = getPortName(new QName(
+ "http://apache.org/hello_world_soap_http", "HelloWorldPort"));
+
+ assertNotNull(wsdl);
+
+ HelloWorldService service = new HelloWorldService(wsdl, serviceName);
+ assertNotNull(service);
+
+ String response1 = new String("Hello ");
+ String response2 = new String("Bonjour");
+ try {
+ Greeter greeter = service.getPort(portName, Greeter.class);
+ String greeting = greeter.greetMe("transaction");
+ assertNotNull("no response received from service", greeting);
+ String exResponse = response1 + "transaction";
+ assertEquals(exResponse, greeting);
+
+ String reply = greeter.sayHi();
+ assertNotNull("no response received from service", reply);
+ assertEquals(response2, reply);
+ greeter.greetMeOneWay("test");
+ try {
+ greeter.testDocLitFault("BadRecordLitFault");
+ fail("Should have thrown BadRecoedLitFault");
+ } catch (BadRecordLitFault ex) {
+ assertNotNull(ex.getFaultInfo());
+ }
+
+ try {
+ greeter.testDocLitFault("NoSuchCodeLitFault");
+ fail("Should have thrown NoSuchCodeLitFault exception");
+ } catch (NoSuchCodeLitFault nslf) {
+ assertNotNull(nslf.getFaultInfo());
+ assertNotNull(nslf.getFaultInfo().getCode());
+ }
+
+ } catch (UndeclaredThrowableException ex) {
+ throw (Exception) ex.getCause();
+ }
+ }
+
+ @Override
+ protected AbstractXmlApplicationContext createBeanFactory() {
+ return new ClassPathXmlApplicationContext(
+ "org/apache/servicemix/cxfbc/jms_transport_transaction.xml");
+ }
+
+ protected AbstractXmlApplicationContext createBeanFactory(String beanFile) {
+ // load cxf se and bc from specified spring config file
+ return new ClassPathXmlApplicationContext(beanFile);
+ }
+
+ public QName getServiceName(QName q) {
+ return q;
+ }
+
+ public QName getPortName(QName q) {
+ return q;
+ }
+
+ public URL getWSDLURL(String s) throws Exception {
+ return CxfBcJmsTest.class.getClassLoader().getResource(s);
+ }
+
+}
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.java?rev=729387&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.java (added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.java Wed Dec 24 17:45:43 2008
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.cxfbc;
+
+import java.io.IOException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.ServerLauncher;
+import org.apache.hello_world_soap_http.BadRecordLitFault;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.HelloWorldService;
+import org.apache.hello_world_soap_http.NoSuchCodeLitFault;
+import org.apache.servicemix.jbi.container.SpringJBIContainer;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.tck.SpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class CxfBcJmsTransactionWsdlConfigTest extends SpringTestSupport {
+
+ protected static boolean serversStarted;
+ private ServerLauncher sl;
+ private ServerLauncher embeddedLauncher;
+ private ServerLauncher jmsLauncher;
+
+
+
+ public void startServers() throws Exception {
+ if (serversStarted) {
+ return;
+ }
+ Map<String, String> props = new HashMap<String, String>();
+ if (System.getProperty("activemq.store.dir") != null) {
+ props.put("activemq.store.dir", System.getProperty("activemq.store.dir"));
+ }
+ props.put("java.util.logging.config.file",
+ System.getProperty("java.util.logging.config.file"));
+
+ assertTrue("server did not launch correctly",
+ launchServer(EmbededJMSBrokerLauncher.class, props, false));
+ embeddedLauncher = sl;
+ assertTrue("server did not launch correctly",
+ launchServer(MyJMSServer.class, null, false));
+ jmsLauncher = sl;
+
+ serversStarted = true;
+ }
+
+ protected void setUp() throws Exception {
+ startServers();
+ //super.setUp();
+
+ }
+
+ public void setUpJBI(String beanFile) throws Exception {
+ if (context != null) {
+ context.refresh();
+ }
+ transformer = new SourceTransformer();
+ if (beanFile == null) {
+ context = createBeanFactory();
+ } else {
+ context = createBeanFactory(beanFile);
+ }
+
+ jbi = (SpringJBIContainer) context.getBean("jbi");
+ assertNotNull("JBI Container not found in spring!", jbi);
+ }
+
+ protected void tearDown() throws Exception {
+ try {
+ embeddedLauncher.stopServer();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ fail("failed to stop server " + embeddedLauncher.getClass());
+ }
+ try {
+ jmsLauncher.stopServer();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ fail("failed to stop server " + jmsLauncher.getClass());
+ }
+ serversStarted = false;
+ if (jbi != null) {
+ jbi.shutDown();
+ jbi.destroy();
+ jbi = null;
+ }
+ //to release the lock for txlog
+ Thread.sleep(3000);
+ }
+
+ public boolean launchServer(Class<?> clz, Map<String, String> p, boolean inProcess) {
+ boolean ok = false;
+ try {
+ sl = new ServerLauncher(clz.getName(), p, null, inProcess);
+ ok = sl.launchServer();
+ assertTrue("server failed to launch", ok);
+
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ fail("failed to launch server " + clz);
+ }
+
+ return ok;
+ }
+
+
+ public void testJMSTransactionWsdlConfig() throws Exception {
+ setUpJBI("org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml");
+ jmsTestBase();
+ }
+
+ private void jmsTestBase() throws Exception, NoSuchCodeLitFault, BadRecordLitFault {
+ SpringBusFactory bf = new SpringBusFactory();
+ Bus testBus = bf.createBus("org/apache/servicemix/cxfbc/jms_test_timeout.xml");
+ BusFactory.setDefaultBus(testBus);
+
+ URL wsdl = getWSDLURL("org/apache/servicemix/cxfbc/ws/security/hello_world.wsdl");
+
+ QName serviceName = getServiceName(new QName(
+ "http://apache.org/hello_world_soap_http", "HelloWorldService"));
+ QName portName = getPortName(new QName(
+ "http://apache.org/hello_world_soap_http", "HelloWorldPort"));
+
+ assertNotNull(wsdl);
+
+ HelloWorldService service = new HelloWorldService(wsdl, serviceName);
+ assertNotNull(service);
+
+ String response1 = new String("Hello ");
+ String response2 = new String("Bonjour");
+ try {
+ Greeter greeter = service.getPort(portName, Greeter.class);
+ String greeting = greeter.greetMe("transaction");
+ assertNotNull("no response received from service", greeting);
+ String exResponse = response1 + "transaction";
+ assertEquals(exResponse, greeting);
+
+ String reply = greeter.sayHi();
+ assertNotNull("no response received from service", reply);
+ assertEquals(response2, reply);
+ greeter.greetMeOneWay("test");
+ try {
+ greeter.testDocLitFault("BadRecordLitFault");
+ fail("Should have thrown BadRecoedLitFault");
+ } catch (BadRecordLitFault ex) {
+ assertNotNull(ex.getFaultInfo());
+ }
+
+ try {
+ greeter.testDocLitFault("NoSuchCodeLitFault");
+ fail("Should have thrown NoSuchCodeLitFault exception");
+ } catch (NoSuchCodeLitFault nslf) {
+ assertNotNull(nslf.getFaultInfo());
+ assertNotNull(nslf.getFaultInfo().getCode());
+ }
+
+ } catch (UndeclaredThrowableException ex) {
+ throw (Exception) ex.getCause();
+ }
+ }
+
+ @Override
+ protected AbstractXmlApplicationContext createBeanFactory() {
+ return new ClassPathXmlApplicationContext(
+ "org/apache/servicemix/cxfbc/jms_transport_transaction.xml");
+ }
+
+ protected AbstractXmlApplicationContext createBeanFactory(String beanFile) {
+ // load cxf se and bc from specified spring config file
+ return new ClassPathXmlApplicationContext(beanFile);
+ }
+
+ public QName getServiceName(QName q) {
+ return q;
+ }
+
+ public QName getPortName(QName q) {
+ return q;
+ }
+
+ public URL getWSDLURL(String s) throws Exception {
+ return CxfBcJmsTest.class.getClassLoader().getResource(s);
+ }
+
+}
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTransactionWsdlConfigTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/GreeterImplTwoWayJMS.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/GreeterImplTwoWayJMS.java?rev=729387&r1=729386&r2=729387&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/GreeterImplTwoWayJMS.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/GreeterImplTwoWayJMS.java Wed Dec 24 17:45:43 2008
@@ -27,6 +27,7 @@
)
public class GreeterImplTwoWayJMS
extends org.apache.hello_world_soap_http.GreeterImpl {
+ static int count = 3;
public String greetMe(String me) {
System.out.println("\n\n*** GreetMe called with: " + me + "***\n\n");
if ("ffang".equals(me)) {
@@ -45,6 +46,11 @@
e.printStackTrace();
}
}
+ if ("transaction".equals(me) && count > 0) {
+ //do some test designed for CxfBcJmsTransactionTest
+ count--;
+ throw new RuntimeException("triger jms transport transaction rollback");
+ }
return "Hello " + me;
}
Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_test_timeout.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_test_timeout.xml?rev=729387&r1=729386&r2=729387&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_test_timeout.xml (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_test_timeout.xml Wed Dec 24 17:45:43 2008
@@ -27,9 +27,6 @@
passes on slow machines.
-->
<jms:conduit name="{http://apache.org/hello_world_soap_http}HelloWorldPort.jms-conduit" abstract="true">
- <jms:clientConfig clientReceiveTimeout="20000"/>
- </jms:conduit>
- <jms:conduit name="{http://apache.org/hello_world_soap_http}HelloWorldPortProxy.jms-conduit" abstract="true">
<jms:clientConfig clientReceiveTimeout="200000"/>
</jms:conduit>
Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction.xml?rev=729387&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction.xml (added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction.xml Wed Dec 24 17:45:43 2008
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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 xmlns:sm="http://servicemix.apache.org/config/1.0"
+ xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
+ xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
+ xmlns:test="urn:test"
+ xmlns:greeter="http://apache.org/hello_world_soap_http"
+ >
+ <import resource="classpath:tx.xml" />
+ <sm:container id="jbi" embedded="true" transactionManager="#transactionManager">
+
+ <sm:endpoints>
+ <cxfbc:consumer wsdl="org/apache/servicemix/cxfbc/ws/security/hello_world.wsdl"
+ service="greeter:HelloWorldService"
+ endpoint="HelloWorldPort"
+ targetEndpoint="HelloWorldPortProxy"
+ targetService="greeter:HelloWorldService"
+ targetInterface="greeter:Greeter"
+ >
+ <cxfbc:inInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </cxfbc:inInterceptors>
+ <cxfbc:outInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </cxfbc:outInterceptors>
+ <cxfbc:inFaultInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </cxfbc:inFaultInterceptors>
+ <cxfbc:outFaultInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </cxfbc:outFaultInterceptors>
+ <cxfbc:features>
+ <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
+ <property name="jmsConfig">
+ <bean class="org.apache.cxf.transport.jms.JMSConfiguration">
+ <property name="connectionFactory">
+ <ref bean="myConnectionFactory" />
+ </property>
+ <property name="sessionTransacted">
+ <value>true</value>
+ </property>
+ <property name="targetDestination">
+ <value>test.jmstransport.text</value>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </cxfbc:features>
+ </cxfbc:consumer>
+ <cxfbc:provider wsdl="org/apache/servicemix/cxfbc/ws/security/hello_world.wsdl"
+ service="greeter:HelloWorldService"
+ endpoint="HelloWorldPortProxy"
+ interfaceName="greeter:Greetr"
+ >
+ <!--cxfbc:inInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </cxfbc:inInterceptors>
+ <cxfbc:outInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </cxfbc:outInterceptors>
+ <cxfbc:inFaultInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </cxfbc:inFaultInterceptors>
+ <cxfbc:outFaultInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </cxfbc:outFaultInterceptors-->
+ <cxfbc:features>
+ <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
+ <property name="jmsConfig">
+ <bean class="org.apache.cxf.transport.jms.JMSConfiguration">
+ <property name="connectionFactory">
+ <ref bean="myConnectionFactory" />
+ </property>
+ <property name="targetDestination">
+ <value>test.jmstransport.text.provider</value>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </cxfbc:features>
+ </cxfbc:provider>
+
+ </sm:endpoints>
+
+ </sm:container>
+ <bean id="myConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory102">
+ <property name="targetConnectionFactory">
+ <bean class="org.apache.activemq.ActiveMQConnectionFactory">
+ <property name="brokerURL" value="tcp://localhost:61616" />
+ </bean>
+ </property>
+ </bean>
+
+</beans>
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml?rev=729387&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml (added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml Wed Dec 24 17:45:43 2008
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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 xmlns:sm="http://servicemix.apache.org/config/1.0"
+ xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
+ xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
+ xmlns:test="urn:test"
+ xmlns:greeter="http://apache.org/hello_world_soap_http"
+ >
+ <import resource="classpath:tx.xml" />
+ <sm:container id="jbi" embedded="true" transactionManager="#transactionManager">
+
+ <sm:endpoints>
+ <cxfbc:consumer wsdl="org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl"
+ service="greeter:HelloWorldService"
+ endpoint="HelloWorldPort"
+ targetEndpoint="HelloWorldPortProxy"
+ targetService="greeter:HelloWorldService"
+ targetInterface="greeter:Greeter"
+ >
+ <cxfbc:inInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </cxfbc:inInterceptors>
+ <cxfbc:outInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </cxfbc:outInterceptors>
+ <cxfbc:inFaultInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </cxfbc:inFaultInterceptors>
+ <cxfbc:outFaultInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </cxfbc:outFaultInterceptors>
+ </cxfbc:consumer>
+ <cxfbc:provider wsdl="org/apache/servicemix/cxfbc/ws/security/hello_world.wsdl"
+ service="greeter:HelloWorldService"
+ endpoint="HelloWorldPortProxy"
+ interfaceName="greeter:Greetr"
+ >
+ <cxfbc:inInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </cxfbc:inInterceptors>
+ <cxfbc:outInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </cxfbc:outInterceptors>
+ <cxfbc:inFaultInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </cxfbc:inFaultInterceptors>
+ <cxfbc:outFaultInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </cxfbc:outFaultInterceptors>
+ </cxfbc:provider>
+
+ </sm:endpoints>
+ </sm:container>
+
+</beans>
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/jms_transport_transaction_wsdl_config.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl?rev=729387&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl (added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl Wed Dec 24 17:45:43 2008
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<wsdl:definitions
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://apache.org/hello_world_soap_http"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:jms="http://cxf.apache.org/transports/jms"
+ targetNamespace="http://apache.org/hello_world_soap_http"
+ name="WSSecurity"
+ >
+
+ <wsdl:import
+ namespace="http://apache.org/hello_world_soap_http"
+ location="hello_world_base.wsdl"
+ />
+
+ <wsdl:service name="SOAPServiceWSSecurity">
+ <wsdl:port
+ name="TimestampSignEncrypt"
+ binding="tns:Greeter_SOAPBinding">
+ <soap:address location="http://localhost:9000/SOAPServiceWSSecurity/TimestampSignEncrypt"/>
+ </wsdl:port>
+ </wsdl:service>
+ <service name="HelloWorldService">
+ <port binding="tns:Greeter_SOAPBinding" name="HelloWorldPort">
+ <jms:address
+ jndiConnectionFactoryName="ConnectionFactory"
+ jndiDestinationName="dynamicQueues/test.jmstransport.text"> <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
+ <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61616"/>
+ </jms:address>
+
+ <jms:server durableSubscriberName="CXF_subscriber" transactional="true"/>
+ </port>
+ <port binding="tns:Greeter_SOAPBinding" name="HelloWorldPortProxy">
+ <jms:address
+ jndiConnectionFactoryName="ConnectionFactory" jndiDestinationName="dynamicQueues/test.jmstransport.text.provider"> <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
+ <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61616"/>
+ </jms:address>
+
+ <jms:server durableSubscriberName="CXF_subscriber"/>
+ </port>
+ </service>
+
+
+
+</wsdl:definitions>
+
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_transaction.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/tx.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/tx.xml?rev=729387&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/tx.xml (added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/tx.xml Wed Dec 24 17:45:43 2008
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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 xmlns:jencks="http://jencks.org/2.0">
+
+ <!-- Transaction manager -->
+ <jencks:transactionManager
+ id="transactionManager"
+ transactionLogDir="./data/txlog"
+ defaultTransactionTimeoutSeconds="600" />
+
+ <!-- Work manager -->
+ <jencks:workManager
+ id="workManager"
+ threadPoolSize="200"
+ transactionManager="#transactionManager" />
+
+ <!-- Bootstrap context for JCA -->
+ <jencks:bootstrapContext
+ id="bootstrapContext"
+ workManager="#workManager"
+ transactionManager="#transactionManager" />
+
+ <!-- Connection manager for JCA -->
+ <jencks:connectionTracker id="connectionTracker" geronimoTransactionManager="#transactionManager" />
+
+ <jencks:poolingSupport
+ id="poolingSupport" />
+
+ <jencks:connectionManager
+ id="connectionManager"
+ containerManagedSecurity="false"
+ transaction="xa"
+ transactionManager="#transactionManager"
+ poolingSupport="#poolingSupport"
+ connectionTracker="#connectionTracker" />
+
+</beans>
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/tx.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/tx.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/tx.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml