Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7FDDB97C1 for ; Fri, 31 Aug 2012 08:25:02 +0000 (UTC) Received: (qmail 23922 invoked by uid 500); 31 Aug 2012 08:25:02 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 23861 invoked by uid 500); 31 Aug 2012 08:25:02 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 23833 invoked by uid 99); 31 Aug 2012 08:25:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Aug 2012 08:25:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Fri, 31 Aug 2012 08:24:59 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 816F8238896F; Fri, 31 Aug 2012 08:24:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1379353 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/builder/xml/ components/camel-spring/src/test/java/org/apache/camel/spring/processor/ components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ Date: Fri, 31 Aug 2012 08:24:16 -0000 To: commits@camel.apache.org From: ningjiang@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120831082416.816F8238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ningjiang Date: Fri Aug 31 08:24:15 2012 New Revision: 1379353 URL: http://svn.apache.org/viewvc?rev=1379353&view=rev Log: CAMEL-5550 Added the unit test on Spring Xpath Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderNameResultTypeAndNamespaceTest.java camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderNameTest.java camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xPathHeaderNameContext.xml camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xPathHeaderNameResultTypeAndNamespaceContext.xml Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java?rev=1379353&r1=1379352&r2=1379353&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java Fri Aug 31 08:24:15 2012 @@ -852,7 +852,11 @@ public class XPathBuilder implements Exp } } } catch (XPathExpressionException e) { - throw new InvalidXPathExpression(getText(), e); + String message = getText(); + if (ObjectHelper.isNotEmpty(getHeaderName())) { + message = message + " with headerName " + getHeaderName(); + } + throw new InvalidXPathExpression(message, e); } finally { // IOHelper can handle if is is null IOHelper.close(is); Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderNameResultTypeAndNamespaceTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderNameResultTypeAndNamespaceTest.java?rev=1379353&view=auto ============================================================================== --- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderNameResultTypeAndNamespaceTest.java (added) +++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderNameResultTypeAndNamespaceTest.java Fri Aug 31 08:24:15 2012 @@ -0,0 +1,30 @@ +/** + * 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.camel.spring.processor; + +import org.apache.camel.CamelContext; +import org.apache.camel.builder.xml.XPathHeaderNameResultTypeAndNamespaceTest; + +import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext; + +public class SpringXPathHeaderNameResultTypeAndNamespaceTest extends XPathHeaderNameResultTypeAndNamespaceTest { + + protected CamelContext createCamelContext() throws Exception { + return createSpringCamelContext(this, "org/apache/camel/spring/processor/xPathHeaderNameResultTypeAndNamespaceContext.xml"); + } + +} Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderNameTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderNameTest.java?rev=1379353&view=auto ============================================================================== --- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderNameTest.java (added) +++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderNameTest.java Fri Aug 31 08:24:15 2012 @@ -0,0 +1,28 @@ +/** + * 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.camel.spring.processor; + +import org.apache.camel.CamelContext; +import org.apache.camel.builder.xml.XPathHeaderNameTest; + +import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext; + +public class SpringXPathHeaderNameTest extends XPathHeaderNameTest { + protected CamelContext createCamelContext() throws Exception { + return createSpringCamelContext(this, "org/apache/camel/spring/processor/xPathHeaderNameContext.xml"); + } +} Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xPathHeaderNameContext.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xPathHeaderNameContext.xml?rev=1379353&view=auto ============================================================================== --- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xPathHeaderNameContext.xml (added) +++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xPathHeaderNameContext.xml Fri Aug 31 08:24:15 2012 @@ -0,0 +1,45 @@ + + + + + + + + + + + /invoice/@orderType='premium' + + + + /invoice/@orderType='standard' + + + + + + + + + + Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xPathHeaderNameResultTypeAndNamespaceContext.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xPathHeaderNameResultTypeAndNamespaceContext.xml?rev=1379353&view=auto ============================================================================== --- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xPathHeaderNameResultTypeAndNamespaceContext.xml (added) +++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xPathHeaderNameResultTypeAndNamespaceContext.xml Fri Aug 31 08:24:15 2012 @@ -0,0 +1,42 @@ + + + + + + + + + + + /c:number = 55 + + + + + + + + + +