You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/09/18 05:14:57 UTC

svn commit: r696553 - in /activemq/camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/ main/java/org/apache/camel/component/cxf/interceptors/ test/java/org/apache/camel/component/cxf/ test/java/org/apache/camel/component/cxf...

Author: ningjiang
Date: Wed Sep 17 20:14:56 2008
New Revision: 696553

URL: http://svn.apache.org/viewvc?rev=696553&view=rev
Log:
CAMEL-917 don't catch the exception in the CxfProducer process method

Modified:
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java?rev=696553&r1=696552&r2=696553&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java Wed Sep 17 20:14:56 2008
@@ -91,6 +91,7 @@
         final Endpoint endpoint = exchange.get(Endpoint.class);
         Message outMessage = null;
         if (result.isFailed()) {
+            // The exception will be send back to the soap client
             CxfMessage fault = result.getFault();
             outMessage = exchange.getInFaultMessage();
             if (outMessage == null) {
@@ -98,8 +99,12 @@
                 outMessage.setExchange(exchange);
                 exchange.setInFaultMessage(outMessage);
             }
-            Exception ex = (Exception) fault.getBody();
-            outMessage.setContent(Exception.class, ex);
+            Throwable ex = (Throwable) fault.getBody();
+            if (ex != null) {
+                outMessage.setContent(Throwable.class, ex);
+            } else {
+                outMessage.setContent(Throwable.class, result.getException());
+            }
         } else {
             outMessage = result.getOutMessage();
             if (LOG.isLoggable(Level.FINEST)) {

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java?rev=696553&r1=696552&r2=696553&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java Wed Sep 17 20:14:56 2008
@@ -62,12 +62,12 @@
     public static Message createCxfMessage(CxfExchange exchange) {
         return CxfBinding.createCxfMessage(new CxfHeaderFilterStrategy(), exchange);
     }
-    
+
     public static Message createCxfMessage(HeaderFilterStrategy strategy, CxfExchange exchange) {
 
         Message answer = exchange.getInMessage();
         CxfMessage in = exchange.getIn();
-        
+
         // Check the body if the POJO parameter list first
         Object body = in.getBody(List.class);
         if (body instanceof List) {
@@ -90,17 +90,17 @@
         //Ensure there is a request context, which is needed by propogateContext() below
         Map<String, Object> requestContext = CastUtils.cast((Map)answer.get(Client.REQUEST_CONTEXT));
         if (requestContext == null) {
-        	requestContext = new HashMap<String, Object>();
+            requestContext = new HashMap<String, Object>();
         }
-        if (exchange.getExchange() != null) { 
-        	requestContext.putAll(exchange.getExchange());
+        if (exchange.getExchange() != null) {
+            requestContext.putAll(exchange.getExchange());
         }
         if (exchange.getProperties() != null) {
             //Allows other components to pass properties into cxf request context
             requestContext.putAll(exchange.getProperties());
         }
         answer.put(Client.REQUEST_CONTEXT, requestContext);
-        
+
         return answer;
     }
 
@@ -110,8 +110,8 @@
     public static void storeCxfResponse(CxfExchange exchange, Message response) {
         CxfBinding.storeCxfResponse(new CxfHeaderFilterStrategy(), exchange, response);
     }
-    
-    public static void storeCxfResponse(HeaderFilterStrategy strategy, CxfExchange exchange, 
+
+    public static void storeCxfResponse(HeaderFilterStrategy strategy, CxfExchange exchange,
             Message response) {
         CxfMessage out = exchange.getOut();
         if (response != null) {
@@ -133,12 +133,12 @@
     public static void copyMessage(org.apache.camel.Message camelMessage, org.apache.cxf.message.Message cxfMessage) {
         CxfBinding.copyMessage(new CxfHeaderFilterStrategy(), camelMessage, cxfMessage);
     }
-    
+
     // Copy the Camel message to CXF message
-    public static void copyMessage(HeaderFilterStrategy strategy, 
+    public static void copyMessage(HeaderFilterStrategy strategy,
             org.apache.camel.Message camelMessage, org.apache.cxf.message.Message cxfMessage) {
         InputStream is = camelMessage.getBody(InputStream.class);
-        
+
         CxfHeaderHelper.propagateCamelToCxf(strategy, camelMessage.getHeaders(), cxfMessage);
         if (is != null) {
             cxfMessage.setContent(InputStream.class, is);
@@ -160,7 +160,7 @@
             response.put(Client.RESPONSE_CONTEXT, context);
         }
     }
-    
+
     public static void storeCxfResponse(CxfExchange exchange, Object response) {
         CxfMessage out = exchange.getOut();
         if (response != null) {

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=696553&r1=696552&r2=696553&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Wed Sep 17 20:14:56 2008
@@ -36,7 +36,6 @@
 import org.apache.camel.component.cxf.util.CxfEndpointUtils;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.util.ObjectHelper;
-import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
@@ -162,106 +161,96 @@
         return cfb.create();
     }
 
-    public void process(Exchange exchange) {
+    public void process(Exchange exchange) throws Exception {
         CxfExchange cxfExchange = endpoint.createExchange(exchange);
         process(cxfExchange);
         exchange.copyFrom(cxfExchange);
 
     }
 
-    public void process(CxfExchange exchange) {
+    public void process(CxfExchange exchange) throws Exception {
         Message inMessage = CxfBinding.createCxfMessage(endpoint.getHeaderFilterStrategy(), exchange);
         exchange.setProperty(CxfExchange.DATA_FORMAT, dataFormat);
-        try {
-            if (dataFormat.equals(DataFormat.POJO)) {
-                // InputStream is = m.getContent(InputStream.class);
-                // now we just deal with the POJO invocations
-                List parameters = inMessage.getContent(List.class);
-                if (parameters == null) {
-                    parameters = new ArrayList();
-                }
-                String operationName = exchange.getIn().getHeader(CxfConstants.OPERATION_NAME, String.class);
-                String operationNameSpace = exchange.getIn().getHeader(CxfConstants.OPERATION_NAMESPACE, String.class);
-                // Get context from message
-                Map<String, Object> context = new HashMap<String, Object>();
-                Map<String, Object> responseContext = CxfBinding.propogateContext(inMessage, context);
-                Message response = new MessageImpl();
-                if (operationName != null) {
-                    // we need to check out the operation Namespace
-                    try {
-                        Object[] result = null;
-                        // call for the client with the parameters
-                        result = invokeClient(operationNameSpace, operationName, parameters, context);
-                        if (result != null) {
-                            response.setContent(List.class, new MessageContentsList(result));
-                        } else {
-                            response.setContent(List.class, new MessageContentsList());
-                        }
-                        // copy the response context to the response
-                        CxfBinding.storeCXfResponseContext(response, responseContext);
-                        CxfBinding.storeCxfResponse(endpoint.getHeaderFilterStrategy(), exchange, response);
-                    } catch (Exception ex) {
-                        response.setContent(Exception.class, ex);
-                        CxfBinding.storeCxfFault(exchange, response);
-                    }
+
+        if (dataFormat.equals(DataFormat.POJO)) {
+            // InputStream is = m.getContent(InputStream.class);
+            // now we just deal with the POJO invocations
+            List parameters = inMessage.getContent(List.class);
+            if (parameters == null) {
+                parameters = new ArrayList();
+            }
+            String operationName = exchange.getIn().getHeader(CxfConstants.OPERATION_NAME, String.class);
+            String operationNameSpace = exchange.getIn().getHeader(CxfConstants.OPERATION_NAMESPACE,
+                                                                   String.class);
+            // Get context from message
+            Map<String, Object> context = new HashMap<String, Object>();
+            Map<String, Object> responseContext = CxfBinding.propogateContext(inMessage, context);
+            Message response = new MessageImpl();
+            if (operationName != null) {
+                // we need to check out the operation Namespace
+                Object[] result = null;
+                // call for the client with the parameters
+                result = invokeClient(operationNameSpace, operationName, parameters, context);
+                if (result != null) {
+                    response.setContent(List.class, new MessageContentsList(result));
                 } else {
-                    throw new RuntimeCamelException("Can't find the operation name in the message!");
+                    response.setContent(List.class, new MessageContentsList());
                 }
+                // copy the response context to the response
+                CxfBinding.storeCXfResponseContext(response, responseContext);
+                CxfBinding.storeCxfResponse(endpoint.getHeaderFilterStrategy(), exchange, response);
+
             } else {
-                // get the invocation context
-                org.apache.cxf.message.Exchange ex = exchange.getExchange();
-                if (ex == null) {
-                    ex = (org.apache.cxf.message.Exchange)exchange.getProperty(CxfConstants.CXF_EXCHANGE);
-                    exchange.setExchange(ex);
-                }
-                if (ex == null) {
-                    ex = new ExchangeImpl();
-                    exchange.setExchange(ex);
-                }
-                assert ex != null;
-                InvokingContext invokingContext = ex.get(InvokingContext.class);
-                if (invokingContext == null) {
-                    invokingContext = InvokingContextFactory.createContext(dataFormat);
-                    ex.put(InvokingContext.class, invokingContext);
-                }
-                Map<Class, Object> params = invokingContext.getRequestContent(inMessage);
-                // invoke the stream message with the exchange context
-                CxfClient cxfClient = (CxfClient)client;
-                // need to get the binding object to create the message
-                BindingOperationInfo boi = ex.get(BindingOperationInfo.class);
-                Message response = null;
-                if (boi == null) {
-                    // it should be the raw message
-                    response = new MessageImpl();
-                } else {
-                    // create the message here
-                    Endpoint ep = ex.get(Endpoint.class);
-                    response = ep.getBinding().createMessage();
-                }
-                response.setExchange(ex);
-                // invoke the message prepare the context
-                Map<String, Object> context = new HashMap<String, Object>();
-                Map<String, Object> responseContext = CxfBinding.propogateContext(inMessage, context);
-                try {
-                    Object result = cxfClient.dispatch(params, context, ex);
-                    ex.setOutMessage(response);
-                    invokingContext.setResponseContent(response, result);
-                    // copy the response context to the response
-                    CxfBinding.storeCXfResponseContext(response, responseContext);
-                    CxfBinding.storeCxfResponse(endpoint.getHeaderFilterStrategy(), exchange, response);
-                } catch (Exception e) {
-                    response.setContent(Exception.class, e);
-                    CxfBinding.storeCxfFault(exchange, response);
-                }
+                throw new RuntimeCamelException("Can't find the operation name in the message!");
             }
-        } catch (Exception e) {
-            // TODO add the fault message handling work
-            throw wrapRuntimeCamelException(e);
+        } else {
+            // get the invocation context
+            org.apache.cxf.message.Exchange ex = exchange.getExchange();
+            if (ex == null) {
+                ex = (org.apache.cxf.message.Exchange)exchange.getProperty(CxfConstants.CXF_EXCHANGE);
+                exchange.setExchange(ex);
+            }
+            if (ex == null) {
+                ex = new ExchangeImpl();
+                exchange.setExchange(ex);
+            }
+            assert ex != null;
+            InvokingContext invokingContext = ex.get(InvokingContext.class);
+            if (invokingContext == null) {
+                invokingContext = InvokingContextFactory.createContext(dataFormat);
+                ex.put(InvokingContext.class, invokingContext);
+            }
+            Map<Class, Object> params = invokingContext.getRequestContent(inMessage);
+            // invoke the stream message with the exchange context
+            CxfClient cxfClient = (CxfClient)client;
+            // need to get the binding object to create the message
+            BindingOperationInfo boi = ex.get(BindingOperationInfo.class);
+            Message response = null;
+            if (boi == null) {
+                // it should be the raw message
+                response = new MessageImpl();
+            } else {
+                // create the message here
+                Endpoint ep = ex.get(Endpoint.class);
+                response = ep.getBinding().createMessage();
+            }
+            response.setExchange(ex);
+            // invoke the message prepare the context
+            Map<String, Object> context = new HashMap<String, Object>();
+            Map<String, Object> responseContext = CxfBinding.propogateContext(inMessage, context);
+
+            Object result = cxfClient.dispatch(params, context, ex);
+            ex.setOutMessage(response);
+            invokingContext.setResponseContent(response, result);
+            // copy the response context to the response
+            CxfBinding.storeCXfResponseContext(response, responseContext);
+            CxfBinding.storeCxfResponse(endpoint.getHeaderFilterStrategy(), exchange, response);
+
+
         }
 
     }
 
-
     @Override
     protected void doStart() throws Exception {
         super.doStart();
@@ -272,17 +261,21 @@
         super.doStop();
     }
 
-    private Object[] invokeClient(String operationNameSpace, String operationName, List parameters, Map<String, Object> context) throws Exception {
+    private Object[] invokeClient(String operationNameSpace, String operationName, List parameters,
+                                  Map<String, Object> context) throws Exception {
 
         QName operationQName = null;
         if (operationNameSpace == null) {
-            operationQName = new QName(client.getEndpoint().getService().getName().getNamespaceURI(), operationName);
+            operationQName = new QName(client.getEndpoint().getService().getName().getNamespaceURI(),
+                                       operationName);
         } else {
             operationQName = new QName(operationNameSpace, operationName);
         }
-        BindingOperationInfo op = client.getEndpoint().getEndpointInfo().getBinding().getOperation(operationQName);
+        BindingOperationInfo op = client.getEndpoint().getEndpointInfo().getBinding()
+            .getOperation(operationQName);
         if (op == null) {
-            throw new RuntimeCamelException("No operation found in the CXF client, the operation is " + operationQName);
+            throw new RuntimeCamelException("No operation found in the CXF client, the operation is "
+                                            + operationQName);
         }
         if (!endpoint.isWrapped()) {
             if (op.isUnwrappedCapable()) {

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java?rev=696553&r1=696552&r2=696553&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java Wed Sep 17 20:14:56 2008
@@ -43,7 +43,7 @@
         // To walk around the FaultOutInterceptor NPE issue of CXF 2.0.4
         checkBindingOperationInfor(message);
 
-        Exception ex = message.getContent(Exception.class);
+        Throwable ex = message.getContent(Throwable.class);
 
         if (ex != null) {
             if (!(ex instanceof Fault)) {
@@ -63,7 +63,7 @@
                 SoapMessage sm = (SoapMessage)message;
                 ex = SoapFault.createFault((Fault)ex, sm.getVersion());
             }
-            message.setContent(Exception.class, ex);
+            message.setContent(Throwable.class, ex);
         }
     }
 

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java?rev=696553&r1=696552&r2=696553&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java Wed Sep 17 20:14:56 2008
@@ -38,7 +38,7 @@
     @SuppressWarnings("unchecked")
     public void handleMessage(Message message) throws Fault {
         // check the fault from the message
-        Exception ex = message.getContent(Exception.class);
+        Throwable ex = message.getContent(Throwable.class);
         if (ex != null) {
             if (ex instanceof Fault) {
                 throw (Fault)ex;

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java?rev=696553&r1=696552&r2=696553&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java Wed Sep 17 20:14:56 2008
@@ -32,7 +32,7 @@
 
     public void handleMessage(Message message) throws Fault {
         // check the fault from the message
-        Exception ex = message.getContent(Exception.class);
+        Throwable ex = message.getContent(Throwable.class);
         if (ex != null) {
             if (ex instanceof Fault) {
                 throw (Fault)ex;

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java?rev=696553&r1=696552&r2=696553&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java Wed Sep 17 20:14:56 2008
@@ -63,6 +63,7 @@
             fail("Should get the NoSuchCodeLitFault here.");
         } catch (NoSuchCodeLitFault fault) {
             // expect the fault here
+            assertNotNull("The fault info should not be null", fault.getFaultInfo());
         }
 
     }

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java?rev=696553&r1=696552&r2=696553&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java Wed Sep 17 20:14:56 2008
@@ -32,12 +32,13 @@
 // We use context to change the producer's endpoint address here
 public class CxfProducerContextTest extends CxfProducerTest {
 
-	// *** This class extends CxfProducerTest, so see that class for other tests run by this code
-	
-	private static final String TEST_KEY   = "sendSimpleMessage-test";
-	private static final String TEST_VALUE = "exchange property value should get passed through request context";
-	
-	public void testExchangePropertyPropagation() throws Exception {
+    // *** This class extends CxfProducerTest, so see that class for other tests
+    // run by this code
+
+    private static final String TEST_KEY = "sendSimpleMessage-test";
+    private static final String TEST_VALUE = "exchange property value should get passed through request context";
+
+    public void testExchangePropertyPropagation() throws Exception {
         CxfExchange exchange = sendSimpleMessage();
 
         assertNotNull(exchange);

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java?rev=696553&r1=696552&r2=696553&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java Wed Sep 17 20:14:56 2008
@@ -28,6 +28,7 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -36,6 +37,7 @@
 import org.apache.cxf.endpoint.ServerImpl;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.interceptor.Fault;
 import org.apache.hello_world_soap_http.GreeterImpl;
 
 /**
@@ -47,6 +49,7 @@
     protected static final String TEST_MESSAGE = "Hello World!";
     protected static final String SIMPLE_SERVER_ADDRESS = "http://localhost:28080/test";
     protected static final String JAXWS_SERVER_ADDRESS = "http://localhost:28081/test";
+    protected static final String WRONG_SERVER_ADDRESS = "http://localhost:9999/test";
 
     private static final transient Log LOG = LogFactory.getLog(CxfProducerTest.class);
 
@@ -98,6 +101,16 @@
 
     }
 
+    public void testInvokingAWrongServer() throws Exception {
+        try {
+            sendSimpleMessage(getWrongEndpointUri());
+            fail("We should get the exception here");
+        } catch (RuntimeCamelException ex) {
+            // only catch the RuntimeCamelException
+        }
+
+    }
+
 
     public void testInvokingJaxWsServerWithParams() throws Exception {
         CxfExchange exchange = sendJaxWsMessage();
@@ -118,10 +131,18 @@
 
     protected String getJaxwsEndpointUri() {
         return "cxf://" + JAXWS_SERVER_ADDRESS + "?serviceClass=org.apache.hello_world_soap_http.Greeter";
+    }
 
+    protected String getWrongEndpointUri() {
+        return "cxf://" + WRONG_SERVER_ADDRESS + "?serviceClass=org.apache.camel.component.cxf.HelloService";
     }
+
     protected CxfExchange sendSimpleMessage() {
-        CxfExchange exchange = (CxfExchange)template.send(getSimpleEndpointUri(), new Processor() {
+        return sendSimpleMessage(getSimpleEndpointUri());
+    }
+
+    private CxfExchange sendSimpleMessage(String endpointUri) {
+        CxfExchange exchange = (CxfExchange)template.send(endpointUri, new Processor() {
             public void process(final Exchange exchange) {
                 final List<String> params = new ArrayList<String>();
                 params.add(TEST_MESSAGE);

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java?rev=696553&r1=696552&r2=696553&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java Wed Sep 17 20:14:56 2008
@@ -115,7 +115,7 @@
 
         exchange = sendJaxWsMessageWithHolders("");
         assertEquals("We should get a fault here", exchange.isFailed(), true);
-        Exception ex = exchange.getFault().getBody(Exception.class);
+        Throwable ex = exchange.getException();
         assertTrue("We should get the UnknowPersonFault here", ex instanceof UnknownPersonFault);
     }
 

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java?rev=696553&r1=696552&r2=696553&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java Wed Sep 17 20:14:56 2008
@@ -26,6 +26,7 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.cxf.CxfConstants;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.message.Message;
@@ -51,20 +52,23 @@
 
     }
 
-    public void testCxfBusConfiguration() throws InterruptedException {
+    public void testCxfBusConfiguration() throws Exception {
         // get the camelContext from application context
         CamelContext camelContext = (CamelContext) ctx.getBean("camel");
         ProducerTemplate template = camelContext.createProducerTemplate();
-        Exchange exchange = template.send("cxf:bean:routerEndpoint", new Processor() {
-            public void process(final Exchange exchange) {
-                final List<String> params = new ArrayList<String>();
-                params.add("hello");
-                exchange.getIn().setBody(params);
-                exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, "echo");
-            }
-        });
-        
-        assertTrue("There should have a timeout exception", exchange.isFailed());
+        try {
+            Exchange exchange = template.send("cxf:bean:routerEndpoint", new Processor() {
+                public void process(final Exchange exchange) {
+                    final List<String> params = new ArrayList<String>();
+                    params.add("hello");
+                    exchange.getIn().setBody(params);
+                    exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, "echo");
+                }
+            });
+            fail("should get the exception here");
+        } catch (RuntimeCamelException ex) {
+            // do nothing here
+        }
 
     }