[ 
https://issues.apache.org/jira/browse/CAMEL-12733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16608583#comment-16608583
 ] 

Sergey Kryazhov edited comment on CAMEL-12733 at 9/9/18 10:39 PM:
------------------------------------------------------------------

The problem is in method SftpOperations.buildDirectory(). We save an absolute 
path, then make cd to directory from route and then make cd to original 
directory in finally block.

 
{code:java}
  String originalDirectory = getCurrentDirectory();
  ...
  channel.cd(directory);
  ...
  if (originalDirectory != null) {
    changeCurrentDirectory(originalDirectory);
  }
{code}
 

Absolute path in Windows is not started from /, though we ended with cwd equals 
to originalDirectory + originalDirectory. Actually, we don't need to check if 
directory exist via cd, we can make it via ls. In this way, the following cd to 
original directory is unnecessary. I run the tests with this small fix on 
Windows and they all passed.


was (Author: evilball):
The problem is in method SftpOperations.buildDirectory(). We save an absolute 
path, then make cd to directory from route and then make cd to original 
directory in finally block.

 
{code:java}
 String originalDirectory = getCurrentDirectory();
  ...
  channel.cd(directory);
  ...
  if (originalDirectory != null) {
changeCurrentDirectory(originalDirectory);
}
{code}
 

Absolute path in Windows is not started from /, though we ended with cwd equals 
to originalDirectory + originalDirectory. Actually, we don't need to check if 
directory exist via cd, we can make it via ls. In this way, the following cd to 
original directory is unnecessary. I run the tests with this small fix on 
Windows and they all passed.

> camel-sftp : stepwise=false is not working on windows
> -----------------------------------------------------
>
>                 Key: CAMEL-12733
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12733
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 2.23.0
>         Environment: windows 10
>            Reporter: Önder Sezgin
>            Priority: Minor
>
> [ERROR] Failures:
> [ERROR] 
> org.apache.camel.component.file.remote.sftp.SftpSimpleConsumeNotStepwiseTest.testSftpSimpleConsume(org.apache.camel.component.file.remote.sftp.SftpSimpleConsumeNotStepwiseTest)
> [ERROR] Run 1: 
> SftpSimpleConsumeNotStepwiseTest>SftpSimpleConsumeTest.testSftpSimpleConsume:47->CamelTestSupport.assertMockEndpointsSatisfied:958
>  mock://result Received message count. Expected: <1> but was: <0>
> [ERROR] Run 2: 
> SftpSimpleConsumeNotStepwiseTest>SftpSimpleConsumeTest.testSftpSimpleConsume:47->CamelTestSupport.assertMockEndpointsSatisfied:958
>  mock://result Received message count. Expected: <1> but was: <0>
> [ERROR] Run 3: 
> SftpSimpleConsumeNotStepwiseTest>SftpSimpleConsumeTest.testSftpSimpleConsume:47->CamelTestSupport.assertMockEndpointsSatisfied:958
>  mock://result Received message count. Expected: <1> but was: <0>
> [INFO]
> [ERROR] 
> org.apache.camel.component.file.remote.sftp.SftpSimpleConsumeRecursiveNotStepwiseTest.testSftpSimpleConsumeRecursive(org.apache.camel.component.file.remote.sftp.SftpSimpleConsumeRecursiveNotStepwiseTest)
> [ERROR] Run 1: 
> SftpSimpleConsumeRecursiveNotStepwiseTest>SftpSimpleConsumeRecursiveTest.testSftpSimpleConsumeRecursive:46->CamelTestSupport.assertMockEndpointsSatisfied:958
>  mock://result Received message count. Expected: <4> but was: <0>
> [ERROR] Run 2: 
> SftpSimpleConsumeRecursiveNotStepwiseTest>SftpSimpleConsumeRecursiveTest.testSftpSimpleConsumeRecursive:46->CamelTestSupport.assertMockEndpointsSatisfied:958
>  mock://result Received message count. Expected: <4> but was: <0>
> [ERROR] Run 3: 
> SftpSimpleConsumeRecursiveNotStepwiseTest>SftpSimpleConsumeRecursiveTest.testSftpSimpleConsumeRecursive:46->CamelTestSupport.assertMockEndpointsSatisfied:958
>  mock://result Received message count. Expected: <4> but was: <0>
> [INFO]
> [ERROR] 
> org.apache.camel.component.file.remote.sftp.SftpSimpleConsumeRecursiveTest.testSftpSimpleConsumeRecursive(org.apache.camel.component.file.remote.sftp.SftpSimpleConsumeRecursiveTest)
> [ERROR] Run 1: 
> SftpSimpleConsumeRecursiveTest.testSftpSimpleConsumeRecursive:46->CamelTestSupport.assertMockEndpointsSatisfied:958
>  mock://result Received message count. Expected: <4> but was: <0>
> [ERROR] Run 2: 
> SftpSimpleConsumeRecursiveTest.testSftpSimpleConsumeRecursive:46->CamelTestSupport.assertMockEndpointsSatisfied:958
>  mock://result Received message count. Expected: <4> but was: <0>
> [ERROR] Run 3: 
> SftpSimpleConsumeRecursiveTest.testSftpSimpleConsumeRecursive:46->CamelTestSupport.assertMockEndpointsSatisfied:958
>  mock://result Received message count. Expected: <4> but was: <0>
> [INFO]
> [ERROR] 
> org.apache.camel.component.file.remote.sftp.SftpUseListFalseTest.testSftpUseListFalse(org.apache.camel.component.file.remote.sftp.SftpUseListFalseTest)
> [ERROR] Run 1: 
> SftpUseListFalseTest.testSftpUseListFalse:44->CamelTestSupport.assertMockEndpointsSatisfied:958
>  mock://result Received message count. Expected: <1> but was: <0>
> [ERROR] Run 2: 
> SftpUseListFalseTest.testSftpUseListFalse:44->CamelTestSupport.assertMockEndpointsSatisfied:958
>  mock://result Received message count. Expected: <1> but was: <0>
> [ERROR] Run 3: 
> SftpUseListFalseTest.testSftpUseListFalse:44->CamelTestSupport.assertMockEndpointsSatisfied:958
>  mock://result Received message count. Expected: <1> but was: <0>
> [INFO]
> [ERROR] Errors:
> [ERROR] 
> org.apache.camel.component.file.remote.sftp.SftpProducerFileWithPathNoStepwiseTest.testProducerFileWithPathNoStepwise(org.apache.camel.component.file.remote.sftp.SftpProducerFileWithPathNoStepwiseTest)
> [ERROR] Run 1: 
> SftpProducerFileWithPathNoStepwiseTest.testProducerFileWithPathNoStepwise:45 
> » CamelExecution
> [ERROR] Run 2: 
> SftpProducerFileWithPathNoStepwiseTest.testProducerFileWithPathNoStepwise:45 
> » CamelExecution
> [ERROR] Run 3: 
> SftpProducerFileWithPathNoStepwiseTest.testProducerFileWithPathNoStepwise:45 
> » CamelExecution
> [INFO]
> [ERROR] 
> org.apache.camel.component.file.remote.sftp.SftpSimpleProduceNotStepwiseTest.testSftpSimpleProduce(org.apache.camel.component.file.remote.sftp.SftpSimpleProduceNotStepwiseTest)
> [ERROR] Run 1: SftpSimpleProduceNotStepwiseTest.testSftpSimpleProduce:40 » 
> CamelExecution Exc...
> [ERROR] Run 2: SftpSimpleProduceNotStepwiseTest.testSftpSimpleProduce:40 » 
> CamelExecution Exc...
> [ERROR] Run 3: SftpSimpleProduceNotStepwiseTest.testSftpSimpleProduce:40 » 
> CamelExecution Exc...
> [INFO]
> [ERROR] 
> org.apache.camel.component.file.remote.sftp.SftpSimpleProduceNotStepwiseTest.testSftpSimpleSubPathProduce(org.apache.camel.component.file.remote.sftp.SftpSimpleProduceNotStepwiseTest)
> [ERROR] Run 1: 
> SftpSimpleProduceNotStepwiseTest.testSftpSimpleSubPathProduce:53 » 
> CamelExecution
> [ERROR] Run 2: 
> SftpSimpleProduceNotStepwiseTest.testSftpSimpleSubPathProduce:53 » 
> CamelExecution
> [ERROR] Run 3: 
> SftpSimpleProduceNotStepwiseTest.testSftpSimpleSubPathProduce:53 » 
> CamelExecution
> [INFO]
> [ERROR] 
> org.apache.camel.component.file.remote.sftp.SftpSimpleProduceNotStepwiseTest.testSftpSimpleTwoSubPathProduce(org.apache.camel.component.file.remote.sftp.SftpSimpleProduceNotStepwiseTest)
> [ERROR] Run 1: 
> SftpSimpleProduceNotStepwiseTest.testSftpSimpleTwoSubPathProduce:66 » 
> CamelExecution
> [ERROR] Run 2: 
> SftpSimpleProduceNotStepwiseTest.testSftpSimpleTwoSubPathProduce:66 » 
> CamelExecution
> [ERROR] Run 3: 
> SftpSimpleProduceNotStepwiseTest.testSftpSimpleTwoSubPathProduce:66 » 
> CamelExecution
> [INFO]
> [INFO]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to