camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r908925 - in /camel/trunk/components/camel-spring/src/test: data/ java/org/apache/camel/component/xslt/ resources/org/apache/camel/component/xslt/
Date Thu, 11 Feb 2010 10:59:28 GMT
Author: davsclaus
Date: Thu Feb 11 10:59:26 2010
New Revision: 908925

URL: http://svn.apache.org/viewvc?rev=908925&view=rev
Log:
Added unit test of showing how to use xslt include

Added:
    camel/trunk/components/camel-spring/src/test/data/staff.xml   (with props)
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltIncludeTest.java
  (with props)
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/staff_include.xsl
  (with props)
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/staff_template.xsl
  (with props)

Added: camel/trunk/components/camel-spring/src/test/data/staff.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/data/staff.xml?rev=908925&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/data/staff.xml (added)
+++ camel/trunk/components/camel-spring/src/test/data/staff.xml Thu Feb 11 10:59:26 2010
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<staff>
+
+    <programmer>
+        <name>Bugs Bunny</name>
+        <dob>03/21/1970</dob>
+        <age>31</age>
+        <address>4895 Wabbit Hole Road</address>
+        <phone>865-111-1111</phone>
+    </programmer>
+
+    <programmer>
+        <name>Daisy Duck</name>
+        <dob>08/09/1949</dob>
+        <age>51</age>
+        <address>748 Golden Pond</address>
+        <phone>865-222-2222</phone>
+    </programmer>
+
+    <programmer>
+        <name>Minnie Mouse</name>
+        <dob>04/13/1977</dob>
+        <age>24</age>
+        <address>4064 Cheese Factory Blvd</address>
+        <phone>865-333-3333</phone>
+    </programmer>
+
+    <programmer>
+        <name>Pluto</name>
+        <dob>07/04/1979</dob>
+        <age>21</age>
+        <address>414 Dog Lane</address>
+        <phone>865-333-3333</phone>
+    </programmer>
+
+    <programmer>
+        <name>Road Runner</name>
+        <dob>01/19/1953</dob>
+        <age>48</age>
+        <address>135 Desert View Street</address>
+        <phone>none</phone>
+    </programmer>
+
+</staff>
\ No newline at end of file

Propchange: camel/trunk/components/camel-spring/src/test/data/staff.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/data/staff.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-spring/src/test/data/staff.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltIncludeTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltIncludeTest.java?rev=908925&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltIncludeTest.java
(added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltIncludeTest.java
Thu Feb 11 10:59:26 2010
@@ -0,0 +1,49 @@
+/**
+ * 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.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version $Revision$
+ */
+public class XsltIncludeTest extends ContextTestSupport {
+
+    public void testXsltInclude() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        // the include file has the span style so check that its there
+        mock.message(0).constant("<span style=\"font-size=22px;\">Minnie Mouse</span>");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("file:src/test/data/?fileName=staff.xml&noop=true")
+                    .to("xslt:org/apache/camel/component/xslt/staff_include.xsl")
+                    .to("log:foo")
+                    .to("mock:result");
+            }
+        };
+    }
+}

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

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

Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/staff_include.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/staff_include.xsl?rev=908925&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/staff_include.xsl
(added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/staff_include.xsl
Thu Feb 11 10:59:26 2010
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+    <xsl:include href="file:src/test/resources/org/apache/camel/component/xslt/staff_template.xsl"/>
+
+    <xsl:template match="staff/programmer">
+        <html>
+            <body>
+                <xsl:apply-templates select="name"/>
+                <xsl:apply-templates select="dob"/>
+                <xsl:apply-templates select="age"/>
+                <br/>
+            </body>
+        </html>
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

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

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

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

Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/staff_template.xsl
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/staff_template.xsl?rev=908925&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/staff_template.xsl
(added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/xslt/staff_template.xsl
Thu Feb 11 10:59:26 2010
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+    <xsl:template match="staff/programmer">
+        <html>
+            <body>
+                <xsl:apply-templates select="name"/>
+                <xsl:apply-templates select="dob"/>
+                <xsl:apply-templates select="age"/>
+                <br/>
+            </body>
+        </html>
+    </xsl:template>
+
+    <xsl:template match="name">
+        <span style="font-size=22px;">
+            <xsl:value-of select="."/>
+        </span>
+        <br/>
+    </xsl:template>
+
+    <xsl:template match="dob">
+        DOB:
+        <span style="color:blue;">
+            <xsl:value-of select="."/>
+        </span>
+        <br/>
+    </xsl:template>
+
+    <xsl:template match="age">
+        AGE:
+        <span style="color:green;">
+            <xsl:value-of select="."/>
+        </span>
+        <br/>
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file

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

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

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



Mime
View raw message