Author: dvaleri Date: Thu Mar 21 16:43:27 2013 New Revision: 1459393 URL: http://svn.apache.org/r1459393 Log: [CAMEL-6195] Applied Christian's patch with minor updates for CS compliance and completeness.
Removed: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/CopyOfFtpSimpleConsumeStreamingWithMultipleFilesTest.java Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingPartialReadTest.java camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingTest.java camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingWithMultipleFilesTest.java camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingPartialReadTest.java camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingTest.java camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingWithMultipleFilesTest.java Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingPartialReadTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingPartialReadTest.java?rev=1459393&r1=1459392&r2=1459393&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingPartialReadTest.java (original) +++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingPartialReadTest.java Thu Mar 21 16:43:27 2013 @@ -22,6 +22,7 @@ import java.io.InputStream; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.file.GenericFile; import org.apache.camel.component.mock.MockEndpoint; import org.junit.Test; @@ -51,6 +52,8 @@ public class FtpSimpleConsumeStreamingPa context.startRoute("foo"); assertMockEndpointsSatisfied(); + GenericFile<?> remoteFile1 = (GenericFile<?>) mock.getExchanges().get(0).getIn().getBody(); + assertTrue(remoteFile1.getBody() instanceof InputStream); // Wait a little bit for the move to finish. Thread.sleep(2000); @@ -76,7 +79,6 @@ public class FtpSimpleConsumeStreamingPa @Override public void process(Exchange exchange) throws Exception { exchange.getIn().getBody(InputStream.class).read(); - } }) .to("mock:result") Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingTest.java?rev=1459393&r1=1459392&r2=1459393&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingTest.java (original) +++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingTest.java Thu Mar 21 16:43:27 2013 @@ -16,8 +16,11 @@ */ package org.apache.camel.component.file.remote; +import java.io.InputStream; + import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.file.GenericFile; import org.apache.camel.component.mock.MockEndpoint; import org.junit.Test; @@ -47,6 +50,8 @@ public class FtpSimpleConsumeStreamingTe context.startRoute("foo"); assertMockEndpointsSatisfied(); + GenericFile<?> remoteFile = (GenericFile<?>) mock.getExchanges().get(0).getIn().getBody(); + assertTrue(remoteFile.getBody() instanceof InputStream); } @Override Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingWithMultipleFilesTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingWithMultipleFilesTest.java?rev=1459393&r1=1459392&r2=1459393&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingWithMultipleFilesTest.java (original) +++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpSimpleConsumeStreamingWithMultipleFilesTest.java Thu Mar 21 16:43:27 2013 @@ -16,8 +16,11 @@ */ package org.apache.camel.component.file.remote; +import java.io.InputStream; + import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.file.GenericFile; import org.apache.camel.component.mock.MockEndpoint; import org.junit.Test; @@ -49,6 +52,11 @@ public class FtpSimpleConsumeStreamingWi context.startRoute("foo"); assertMockEndpointsSatisfied(); + + GenericFile<?> remoteFile1 = mock.getExchanges().get(0).getIn().getBody(GenericFile.class); + GenericFile<?> remoteFile2 = mock.getExchanges().get(1).getIn().getBody(GenericFile.class); + assertTrue(remoteFile1.getBody() instanceof InputStream); + assertTrue(remoteFile2.getBody() instanceof InputStream); } @Override Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingPartialReadTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingPartialReadTest.java?rev=1459393&r1=1459392&r2=1459393&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingPartialReadTest.java (original) +++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingPartialReadTest.java Thu Mar 21 16:43:27 2013 @@ -22,6 +22,7 @@ import java.io.InputStream; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.file.GenericFile; import org.apache.camel.component.mock.MockEndpoint; import org.junit.Test; @@ -50,6 +51,8 @@ public class SftpSimpleConsumeStreamingP context.startRoute("foo"); assertMockEndpointsSatisfied(); + GenericFile<?> remoteFile1 = (GenericFile<?>) mock.getExchanges().get(0).getIn().getBody(); + assertTrue(remoteFile1.getBody() instanceof InputStream); // Wait a little bit for the move to finish. Thread.sleep(2000); @@ -73,7 +76,6 @@ public class SftpSimpleConsumeStreamingP @Override public void process(Exchange exchange) throws Exception { exchange.getIn().getBody(InputStream.class).read(); - } }) .to("mock:result") Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingTest.java?rev=1459393&r1=1459392&r2=1459393&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingTest.java (original) +++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingTest.java Thu Mar 21 16:43:27 2013 @@ -16,8 +16,11 @@ */ package org.apache.camel.component.file.remote.sftp; +import java.io.InputStream; + import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.file.GenericFile; import org.apache.camel.component.mock.MockEndpoint; import org.junit.Test; @@ -41,10 +44,12 @@ public class SftpSimpleConsumeStreamingT mock.expectedMessageCount(1); mock.expectedHeaderReceived(Exchange.FILE_NAME, "hello.txt"); mock.expectedBodiesReceived(expected); - + context.startRoute("foo"); assertMockEndpointsSatisfied(); + GenericFile<?> remoteFile = mock.getExchanges().get(0).getIn().getBody(GenericFile.class); + assertTrue(remoteFile.getBody() instanceof InputStream); } @Override Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingWithMultipleFilesTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingWithMultipleFilesTest.java?rev=1459393&r1=1459392&r2=1459393&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingWithMultipleFilesTest.java (original) +++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleConsumeStreamingWithMultipleFilesTest.java Thu Mar 21 16:43:27 2013 @@ -16,8 +16,11 @@ */ package org.apache.camel.component.file.remote.sftp; +import java.io.InputStream; + import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.file.GenericFile; import org.apache.camel.component.mock.MockEndpoint; import org.junit.Test; @@ -46,6 +49,11 @@ public class SftpSimpleConsumeStreamingW context.startRoute("foo"); assertMockEndpointsSatisfied(); + + GenericFile<?> remoteFile1 = mock.getExchanges().get(0).getIn().getBody(GenericFile.class); + GenericFile<?> remoteFile2 = mock.getExchanges().get(1).getIn().getBody(GenericFile.class); + assertTrue(remoteFile1.getBody() instanceof InputStream); + assertTrue(remoteFile2.getBody() instanceof InputStream); } @Override