GitHub user patrickmcgloin opened a pull request:

    https://github.com/apache/camel/pull/1405

    CAMEL-10713 SCP not handling errors for failed transfers correctly

    This fix works for all existing Unit Tests and I can see the error in the 
logs when I use the new jar file to do an SCP transfer:
    
    Throwable exception.getCause [java.io.IOException: [scp] Return Code [1] 
scp: /scpDemo/: Is a directory].
    
    I tried to add a new Unit Test for this case but was unable to do so, the 
test past when it should have failed.  This is what I tried:
    
        @Test
        public void testScpProduceWithFolderCausesError() throws Exception {
            Assume.assumeTrue(this.isSetupComplete());
    
            getMockEndpoint("mock:result").expectedBodiesReceived("Hello 
World");
    
            String uri = getScpUri() + 
"?username=admin&password=admin&knownHostsFile=" + getKnownHostsFile();
            Map<String, Object> headers = new HashMap<String, Object>();
            headers.put(Exchange.FILE_PATH, "folder/");
            headers.put(Exchange.FILE_NAME, “folder2/hello.txt");
    
            template.sendBodyAndHeaders(uri, "Hello World", headers);
    
            assertMockEndpointsSatisfied();
        }  

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/patrickmcgloin/camel scp-error-handling

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/1405.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1405
    
----
commit 87f5913aa0cb9fc51d264762177db3214df802cb
Author: Patrick McGloin <patrickmcgloin@patricks-macbook-air.local>
Date:   2017-01-17T21:24:48Z

    CAMEL-10713 SCP not handling errors for failed transfers correctly

commit b3b4ed1bf0bcae5c5c2d89ed64f4d9b3464a381e
Author: Patrick McGloin <patrickmcgloin@patricks-macbook-air.local>
Date:   2017-01-18T07:12:14Z

    Indentation fix

commit d36d0deb5dcf6f479b041a77eca1f5e76d53851f
Author: Patrick McGloin <patrickmcgloin@patricks-macbook-air.local>
Date:   2017-01-18T07:14:32Z

    Newline at end of file

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to