svn commit: r642316 - in /activemq/camel/trunk/components/camel-spring/src/test: java/org/apache/camel/spring/processor/XsltTest.java resources/org/apache/camel/spring/processor/XsltTest-context.xml resources/org/apache/camel/spring/processor/example.xsl

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r642316 - in /activemq/camel/trunk/components/camel-spring/src/test: java/org/apache/camel/spring/processor/XsltTest.java resources/org/apache/camel/spring/processor/XsltTest-context.xml resources/org/apache/camel/spring/processor/example.xsl

jstrachan-2
Author: jstrachan
Date: Fri Mar 28 10:41:46 2008
New Revision: 642316

URL: http://svn.apache.org/viewvc?rev=642316&view=rev
Log:
added a spring based XSLT test case

Added:
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/XsltTest.java
      - copied, changed from r642205, activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XsltTest.java
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/XsltTest-context.xml   (with props)
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/example.xsl   (with props)

Copied: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/XsltTest.java (from r642205, activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XsltTest.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/XsltTest.java?p2=activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/XsltTest.java&p1=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XsltTest.java&r1=642205&r2=642316&rev=642316&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XsltTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/XsltTest.java Fri Mar 28 10:41:46 2008
@@ -14,39 +14,39 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.builder.xml;
+package org.apache.camel.spring.processor;
 
 import java.net.URL;
 
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.CamelTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 
 import static org.apache.camel.builder.xml.XsltBuilder.xslt;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @version $Revision$
  */
-public class XsltTest extends ContextTestSupport {
+@ContextConfiguration
+public class XsltTest extends AbstractJUnit38SpringContextTests {
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+
+    @Autowired
+    protected CamelTemplate template;
+
 
     public void testXslt() throws Exception {
-        MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
-        resultEndpoint
-            .expectedBodiesReceived("<?xml version=\"1.0\" encoding=\"UTF-8\"?><goodbye>world!</goodbye>");
+        resultEndpoint.expectedBodiesReceived("<?xml version=\"1.0\" encoding=\"UTF-8\"?><goodbye>world!</goodbye>");
 
-        sendBody("direct:start", "<hello>world!</hello>");
+        template.sendBody("<hello>world!</hello>");
 
         resultEndpoint.assertIsSatisfied();
     }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() {
-        return new RouteBuilder() {
-            public void configure() throws Exception {
-                URL styleSheet = getClass().getResource("example.xsl");
-
-                from("direct:start").process(xslt(styleSheet)).to("mock:result");
-            }
-        };
-    }
-}
+}
\ No newline at end of file

Added: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/XsltTest-context.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/XsltTest-context.xml?rev=642316&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/XsltTest-context.xml (added)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/XsltTest-context.xml Fri Mar 28 10:41:46 2008
@@ -0,0 +1,36 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+
+
+  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
+    <template id="template" defaultEndpoint="direct:start"/>
+
+    <route>
+      <from uri="direct:start"/>
+      <to uri="xslt:org/apache/camel/spring/processor/example.xsl"/>
+      <to uri="mock:result"/>
+    </route>
+  </camelContext>
+</beans>

Propchange: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/XsltTest-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/example.xsl
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/example.xsl?rev=642316&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/example.xsl (added)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/example.xsl Fri Mar 28 10:41:46 2008
@@ -0,0 +1,26 @@
+<?xml version = "1.0"?>
+<!--
+  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 version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <xsl:template match="/">
+    <goodbye>
+      <xsl:value-of select="/hello"/>
+    </goodbye>
+  </xsl:template>
+
+</xsl:stylesheet>

Propchange: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/example.xsl
------------------------------------------------------------------------------
    svn:eol-style = native