svn commit: r833386 - in /camel/branches/camel-1.x: ./ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java

View: New views
1 Messages — Rating Filter:   Alert me  

svn commit: r833386 - in /camel/branches/camel-1.x: ./ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java

by ningjiang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Author: ningjiang
Date: Fri Nov  6 13:25:03 2009
New Revision: 833386

URL: http://svn.apache.org/viewvc?rev=833386&view=rev
Log:
Merged revisions 833381 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk

........
  r833381 | ningjiang | 2009-11-06 21:02:21 +0800 (Fri, 06 Nov 2009) | 1 line
 
  CAMEL-2142 added unit test for checkException
........

Modified:
    camel/branches/camel-1.x/   (props changed)
    camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java
    camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java

Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov  6 13:25:03 2009
@@ -1 +1 @@
-/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,776198,776289,776504,776975,778102,778689-778701,779121,779143,779489,781314-781349,781775,781
 923,781974,781993,782557,782594,782681,782886,782918-782923,783204,783248,783363,783639,783704,785564,785584,785599,787206,787581,787598,787605,787928,788393,789121,789703,790560,790936,791379,791476,791767,792038,792381,792398,792899,793359,793518,793547-793555,793862,793935,794237,794368,794550,794967,795790,798027,798052,798063,798489,798864,799252,800340,800785,800797,801084,801196,801960,802307,802478,803559,807476,810751,812937,814493,816105,817654,818063,818182-818354,818744,818747,819475,819483,819956,820152,820168,821272,821290,822655,823013,823018,823031,823102,823177,823575,824218,824721,825760,825765,826977,828288,828333,829900,830052,830493,832647,833285,833289,833350,833370
+/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,776198,776289,776504,776975,778102,778689-778701,779121,779143,779489,781314-781349,781775,781
 923,781974,781993,782557,782594,782681,782886,782918-782923,783204,783248,783363,783639,783704,785564,785584,785599,787206,787581,787598,787605,787928,788393,789121,789703,790560,790936,791379,791476,791767,792038,792381,792398,792899,793359,793518,793547-793555,793862,793935,794237,794368,794550,794967,795790,798027,798052,798063,798489,798864,799252,800340,800785,800797,801084,801196,801960,802307,802478,803559,807476,810751,812937,814493,816105,817654,818063,818182-818354,818744,818747,819475,819483,819956,820152,820168,821272,821290,822655,823013,823018,823031,823102,823177,823575,824218,824721,825760,825765,826977,828288,828333,829900,830052,830493,832647,833285,833289,833350,833370,833381

Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java?rev=833386&r1=833385&r2=833386&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java (original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java Fri Nov  6 13:25:03 2009
@@ -85,6 +85,13 @@
         return LOG;
     }
 
+    public void setCheckException(boolean exception) {
+        checkException = exception;
+    }
+    
+    public boolean isCheckException() {
+        return checkException;
+    }
     /**
      * @param inMessage the incoming message
      * @return the inbuilt backchannel

Modified: camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java?rev=833386&r1=833385&r2=833386&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java (original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java Fri Nov  6 13:25:03 2009
@@ -23,7 +23,9 @@
 import javax.xml.namespace.QName;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
@@ -45,6 +47,7 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                onException(RuntimeCamelException.class).handled(true).to("mock:error");
                 from("direct:Producer").to("direct:EndpointA");
             }
         };
@@ -138,7 +141,7 @@
         String reponse = new String(bytes);
         assertEquals("The reponse date should be equals", content, reponse);
     }
-
+    
     public void testRoundTripDestination() throws Exception {
 
         inMessage = null;
@@ -172,6 +175,8 @@
                 }
             }
         };
+        MockEndpoint error = (MockEndpoint)context.getEndpoint("mock:error");
+        error.expectedMessageCount(0);
         //this call will active the camelDestination
         destination.setMessageObserver(observer);
         // set is oneway false for get response from destination
@@ -181,7 +186,60 @@
         // create the thread to handler the Destination incomming message
 
         verifyReceivedMessage(inMessage, "HelloWorld Response");
+        error.assertIsSatisfied();
+        destination.shutdown();
+    }
+    
+  
+    public void testRoundTripDestinationWithFault() throws Exception {
+
+        inMessage = null;
+        EndpointInfo conduitEpInfo = new EndpointInfo();
+        conduitEpInfo.setAddress("camel://direct:Producer");
+        // set up the conduit send to be true
+        CamelConduit conduit = setupCamelConduit(conduitEpInfo, true, false);
+        final Message outMessage = new MessageImpl();
+
+        endpointInfo.setAddress("camel://direct:EndpointA");
+        final CamelDestination destination = setupCamelDestination(endpointInfo, true);
+        destination.setCheckException(true);
+
+        // set up MessageObserver for handlering the conduit message
+        MessageObserver observer = new MessageObserver() {
+            public void onMessage(Message m) {
+                try {
+                    Exchange exchange = new ExchangeImpl();
+                    exchange.setInMessage(m);
+                    m.setExchange(exchange);
+                    verifyReceivedMessage(m, "HelloWorld");
+                    //verifyHeaders(m, outMessage);
+                    // setup the message for
+                    Conduit backConduit;
+                    backConduit = destination.getBackChannel(m, null, null);
+                    // wait for the message to be got from the conduit
+                    Message replyMessage = new MessageImpl();
+                    replyMessage.setContent(Exception.class, new RuntimeCamelException());
+                    sendoutMessage(backConduit, replyMessage, true, "HelloWorld Fault");
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        };
+        
+        MockEndpoint error = (MockEndpoint)context.getEndpoint("mock:error");
+        error.expectedMessageCount(1);
+        
+        //this call will active the camelDestination
+        destination.setMessageObserver(observer);
+        // set is oneway false for get response from destination
+        // need to use another thread to send the request message
+        sendoutMessage(conduit, outMessage, false, "HelloWorld");
+        // wait for the message to be got from the destination,
+        // create the thread to handler the Destination incomming message
 
+        verifyReceivedMessage(inMessage, "HelloWorld Fault");
+        error.assertIsSatisfied();
+        
         destination.shutdown();
     }
 


Need professional support or training for Apache Camel? Graphic Design by Hiram and the Nabble Forum configured by James