Author: davsclaus
Date: Wed Dec  8 09:12:32 2010
New Revision: 1043339

URL: http://svn.apache.org/viewvc?rev=1043339&view=rev
Log:
Added test based on user forum issue.

Added:
    
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/file/SpringSimpleFileNameWithQuoteTest.java
      - copied, changed from r1043337, 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/file/SpringFileRouteTest.java
    
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/file/SpringSimpleFileNameWithQuoteTest-context.xml
      - copied, changed from r1043337, 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/file/SpringFileRouteTest-context.xml

Copied: 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/file/SpringSimpleFileNameWithQuoteTest.java
 (from r1043337, 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/file/SpringFileRouteTest.java)
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/file/SpringSimpleFileNameWithQuoteTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/file/SpringSimpleFileNameWithQuoteTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/file/SpringFileRouteTest.java&r1=1043337&r2=1043339&rev=1043339&view=diff
==============================================================================
--- 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/file/SpringFileRouteTest.java
 (original)
+++ 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/file/SpringSimpleFileNameWithQuoteTest.java
 Wed Dec  8 09:12:32 2010
@@ -16,14 +16,10 @@
  */
 package org.apache.camel.spring.file;
 
-import java.io.File;
-
-import org.apache.camel.Endpoint;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.TestSupport;
-import org.apache.camel.component.file.FileEndpoint;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
@@ -33,31 +29,25 @@ import org.springframework.test.context.
  * @version $Revision$
  */
 @ContextConfiguration
-public class SpringFileRouteTest extends AbstractJUnit38SpringContextTests {
+public class SpringSimpleFileNameWithQuoteTest extends 
AbstractJUnit38SpringContextTests {
     protected String expectedBody = "Hello World!";
     @Autowired
     protected ProducerTemplate template;
-    @Autowired
-    protected Endpoint inputFile;
     @EndpointInject(uri = "mock:result")
     protected MockEndpoint result;
 
     public void testMocksAreValid() throws Exception {
-        // lets check that our injected endpoint is valid
-        FileEndpoint fileEndpoint = 
TestSupport.assertIsInstanceOf(FileEndpoint.class, inputFile);
-        assertEquals("File", new File("target/test-default-inbox"), 
fileEndpoint.getFile());
-
         result.expectedBodiesReceived(expectedBody);
-        result.setResultWaitTime(5000);
+        result.expectedHeaderReceived("foo", "\"hello.txt\" abc");
 
-        template.sendBodyAndHeader(inputFile, expectedBody, 
Exchange.FILE_NAME, "hello.txt");
+        template.sendBodyAndHeader("file:target/foo", expectedBody, 
Exchange.FILE_NAME, "hello.txt");
 
         result.assertIsSatisfied();
     }
 
     @Override
     protected void setUp() throws Exception {
-        TestSupport.deleteDirectory("target/test-default-inbox");
+        TestSupport.deleteDirectory("target/foo");
         super.setUp();
     }
 }

Copied: 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/file/SpringSimpleFileNameWithQuoteTest-context.xml
 (from r1043337, 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/file/SpringFileRouteTest-context.xml)
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/file/SpringSimpleFileNameWithQuoteTest-context.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/file/SpringSimpleFileNameWithQuoteTest-context.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/file/SpringFileRouteTest-context.xml&r1=1043337&r2=1043339&rev=1043339&view=diff
==============================================================================
--- 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/file/SpringFileRouteTest-context.xml
 (original)
+++ 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/file/SpringSimpleFileNameWithQuoteTest-context.xml
 Wed Dec  8 09:12:32 2010
@@ -22,19 +22,14 @@
        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";>
-        <template id="camelTemplate"/>
-
         <route>
-            <from ref="inputFile"/>
+            <from uri="file://target/foo"/>
+            <setHeader headerName="foo">
+                <simple>"${file:name}" abc</simple>
+            </setHeader>
             <to uri="mock:result"/>
         </route>
     </camelContext>
 
-    <bean id="inputFile" class="org.apache.camel.component.file.FileEndpoint">
-        <property name="file" value="target/test-default-inbox"/>
-    </bean>
-    <!-- END SNIPPET: example -->
-
 </beans>


Reply via email to