You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/05/15 11:48:54 UTC

svn commit: r775076 - in /camel/trunk/components/camel-spring/src/test: java/org/apache/camel/component/xslt/ resources/org/apache/camel/component/xslt/

Author: davsclaus
Date: Fri May 15 09:48:54 2009
New Revision: 775076

URL: http://svn.apache.org/viewvc?rev=775076&view=rev
Log:
CAMEL-1605: Added unit test about XSLT problem with fragments. Could highly be problem with Xalan, Xerces and the one shipped in JDK itself.

Added:
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltXmlFragmentTest.java   (with props)
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/XsltXmlFragmentTest-context.xml
      - copied, changed from r775059, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/camelContext.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/fragment.xsl   (with props)

Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltXmlFragmentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltXmlFragmentTest.java?rev=775076&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltXmlFragmentTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltXmlFragmentTest.java Fri May 15 09:48:54 2009
@@ -0,0 +1,47 @@
+/**
+ * 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.component.xslt;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
+
+/**
+ * @version $Revision$
+ */
+@ContextConfiguration
+public class XsltXmlFragmentTest extends AbstractJUnit38SpringContextTests {
+
+    @Autowired
+    protected CamelContext camelContext;
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint mock;
+
+    public void testFragmentPassedToXslt() throws Exception {
+        // TODO: See CAMEL-1605. This test is disabled as the bug could highly be outside of Camel
+        // mock.expectedMessageCount(1);
+
+        // ProducerTemplate template = camelContext.createProducerTemplate();
+        // template.sendBody("direct:test", "<?xml version='1.0'?>\n<root><fragment>insertme!</fragment></root>");
+
+        // MockEndpoint.assertIsSatisfied(camelContext);
+    }
+
+}

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltXmlFragmentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltXmlFragmentTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/XsltXmlFragmentTest-context.xml (from r775059, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/camelContext.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/XsltXmlFragmentTest-context.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/XsltXmlFragmentTest-context.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/camelContext.xml&r1=775059&r2=775076&rev=775076&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/camelContext.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/XsltXmlFragmentTest-context.xml Fri May 15 09:48:54 2009
@@ -22,18 +22,16 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-  <!-- START SNIPPET: example -->
-  <camelContext xmlns="http://camel.apache.org/schema/spring">
-    <route>
-      <from uri="direct:start"/>
-      <to uri="xslt:org/apache/camel/component/xslt/transform.xsl"/>
-      <multicast>
-        <bean ref="testBean"/>
-        <to uri="mock:result"/>
-      </multicast>
-    </route>
-  </camelContext>
-  <!-- END SNIPPET: example -->
+    <camelContext xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="direct:test"/>
+            <setHeader headerName="agent.xml">
+                <xpath>//fragment</xpath>
+            </setHeader>
+            <to uri="log:foo?showHeaders=true"/>
+            <to uri="xslt:org/apache/camel/component/xslt/fragment.xsl"/>
+            <to uri="mock:result"/>
+        </route>
+    </camelContext>
 
-  <bean id="testBean" class="org.apache.camel.component.xslt.TestBean" scope="singleton"/>
 </beans>

Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/fragment.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/fragment.xsl?rev=775076&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/fragment.xsl (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/fragment.xsl Fri May 15 09:48:54 2009
@@ -0,0 +1,26 @@
+<?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.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+    <xsl:param name="agent.xml"/>
+
+    <xsl:template match="/">
+        <xsl:value-of select="$agent.xml/agent/id" />
+    </xsl:template>
+
+</xsl:stylesheet>

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/fragment.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/fragment.xsl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/fragment.xsl
------------------------------------------------------------------------------
    svn:mime-type = text/xml