Return-Path: Delivered-To: apmail-activemq-camel-commits-archive@locus.apache.org Received: (qmail 28800 invoked from network); 11 Jun 2008 02:59:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Jun 2008 02:59:58 -0000 Received: (qmail 70110 invoked by uid 500); 11 Jun 2008 03:00:01 -0000 Delivered-To: apmail-activemq-camel-commits-archive@activemq.apache.org Received: (qmail 70091 invoked by uid 500); 11 Jun 2008 03:00:01 -0000 Mailing-List: contact camel-commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-dev@activemq.apache.org Delivered-To: mailing list camel-commits@activemq.apache.org Received: (qmail 70082 invoked by uid 99); 11 Jun 2008 03:00:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jun 2008 20:00:01 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jun 2008 02:59:19 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C293E2388A2A; Tue, 10 Jun 2008 19:59:37 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r666509 - in /activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel: component/cxf/CxfProducerRouterTest.java wsdl_first/PersonProcessor.java Date: Wed, 11 Jun 2008 02:59:37 -0000 To: camel-commits@activemq.apache.org From: ningjiang@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080611025937.C293E2388A2A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ningjiang Date: Tue Jun 10 19:59:37 2008 New Revision: 666509 URL: http://svn.apache.org/viewvc?rev=666509&view=rev Log: Added snippet tags for camel-cxf wiki page Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonProcessor.java Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java?rev=666509&r1=666508&r2=666509&view=diff ============================================================================== --- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java (original) +++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerRouterTest.java Tue Jun 10 19:59:37 2008 @@ -79,8 +79,10 @@ public void testInvokingSimpleServerWithParams() throws Exception { + // START SNIPPET: sending Exchange senderExchange = new DefaultExchange(context, ExchangePattern.InOut); final List params = new ArrayList(); + // Prepare the request message for the camel-cxf procedure params.add(TEST_MESSAGE); senderExchange.getIn().setBody(params); senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, ECHO_OPERATION); @@ -88,12 +90,15 @@ Exchange exchange = template.send("direct:EndpointA", senderExchange); org.apache.camel.Message out = exchange.getOut(); + // The response message's body is an object array which first element is the return value of the operation, + // If there are some holder parameters, the holder parameter will be filled in the reset of array. Object[] output = (Object[])out.getBody(); LOG.info("Received output text: " + output[0]); Map responseContext = CastUtils.cast((Map)out.getHeader(Client.RESPONSE_CONTEXT)); assertNotNull(responseContext); assertEquals("We should get the response context here", "UTF-8", responseContext.get(org.apache.cxf.message.Message.ENCODING)); assertEquals("Reply body on Camel is wrong", "echo " + TEST_MESSAGE, output[0]); + // END SNIPPET: sending } public void testInvokingSimpleServerWithMessageDataFormat() throws Exception { Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonProcessor.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonProcessor.java?rev=666509&r1=666508&r2=666509&view=diff ============================================================================== --- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonProcessor.java (original) +++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonProcessor.java Tue Jun 10 19:59:37 2008 @@ -25,33 +25,39 @@ import org.apache.commons.logging.LogFactory; import org.apache.cxf.message.MessageContentsList; +// START SNIPPET: personProcessor public class PersonProcessor implements Processor { private static final transient Log LOG = LogFactory.getLog(PersonProcessor.class); public void process(Exchange exchange) throws Exception { LOG.info("processing exchange in camel"); - + // Get the parameters list which element is the holder. MessageContentsList msgList = (MessageContentsList)exchange.getIn().getBody(); Holder personId = (Holder)msgList.get(0); Holder ssn = (Holder)msgList.get(1); Holder name = (Holder)msgList.get(2); if (personId.value == null || personId.value.length() == 0) { - // only wrote the rubbish above to get into this section LOG.info("person id 123, so throwing exception"); + // Try to throw out the soap fault message org.apache.camel.wsdl_first.types.UnknownPersonFault personFault = new org.apache.camel.wsdl_first.types.UnknownPersonFault(); personFault.setPersonId(""); org.apache.camel.wsdl_first.UnknownPersonFault fault = new org.apache.camel.wsdl_first.UnknownPersonFault("Get the null value of person name", personFault); + // Since camel has its own exception handler framework, we can't throw the exception to trigger it + // We just set the fault message in the exchange for camel-cxf component handling exchange.getFault().setBody(fault); } name.value = "Bonjour"; ssn.value = "123"; LOG.info("setting Bonjour as the response"); + // Set the response message, first element is the return value of the operation, + // the others are the holders of method parameters exchange.getOut().setBody(new Object[] {null, personId, ssn, name}); } } +// END SNIPPET: personProcessor