You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/05/21 08:11:02 UTC

[camel] branch camel-2.23.x updated (d043425 -> 55a53ad)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch camel-2.23.x
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from d043425  CAMEL-13541: fixed Race condition in camel-hystrix when xecutionTimeoutInMilliseconds() and onFallback() are used
     new 19aec98  CAMEL-13400 Camel FTP Cannot list directory with 'File not found' prepending additional '/' in front of directory automatically (#2931)
     new 8e6d761  CAMEL-13400: Fixed CS
     new 55a53ad  Fixed CS

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/file/remote/FtpConsumer.java   |  2 +-
 .../camel/component/file/remote/SftpConsumer.java  |  2 +-
 ... => FromFtpRecursiveNotStepwiseNoBasePath.java} | 46 +++++++++----------
 .../FromSftpRecursiveNotStepwiseNoBasePath.java}   | 51 +++++++++++-----------
 .../file/remote/sftp/SftpServerTestSupport.java    |  6 +++
 5 files changed, 53 insertions(+), 54 deletions(-)
 copy components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/{FtpConsumerWithNoFileOptionTest.java => FromFtpRecursiveNotStepwiseNoBasePath.java} (64%)
 copy components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/{FtpConsumerWithNoFileOptionTest.java => sftp/FromSftpRecursiveNotStepwiseNoBasePath.java} (59%)


[camel] 03/03: Fixed CS

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-2.23.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 55a53ad24cce0d73b61d2389aa380ed4f392b18f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue May 21 10:08:02 2019 +0200

    Fixed CS
---
 .../component/file/remote/FromFtpRecursiveNotStepwiseNoBasePath.java    | 2 +-
 .../file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePath.java        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePath.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePath.java
index c0ae0be..8e20c46 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePath.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePath.java
@@ -1,4 +1,4 @@
-/*
+/**
  * 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.
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePath.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePath.java
index 1cbcb6f..4099e82 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePath.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePath.java
@@ -1,4 +1,4 @@
-/*
+/**
  * 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.


[camel] 02/03: CAMEL-13400: Fixed CS

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-2.23.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 8e6d761cf126c94b6ceee4a42eb10014b5cfc293
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue May 21 09:56:12 2019 +0200

    CAMEL-13400: Fixed CS
---
 .../FromFtpRecursiveNotStepwiseNoBasePath.java     | 68 ++++++++++----------
 .../FromSftpRecursiveNotStepwiseNoBasePath.java    | 74 +++++++++++-----------
 .../file/remote/sftp/SftpServerTestSupport.java    |  4 +-
 3 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePath.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePath.java
index 6112d17..c0ae0be 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePath.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePath.java
@@ -23,42 +23,42 @@ import org.junit.Test;
 
 public class FromFtpRecursiveNotStepwiseNoBasePath extends FtpServerTestSupport {
 
-  protected String getFtpUrl() {
-    return "ftp://admin@localhost:" + getPort() + "?password=admin&initialDelay=3000&stepwise=false"
-        + "&recursive=true";
-  }
+    protected String getFtpUrl() {
+        return "ftp://admin@localhost:" + getPort() + "?password=admin&initialDelay=3000&stepwise=false"
+                + "&recursive=true";
+    }
 
-  @Override
-  @Before
-  public void setUp() throws Exception {
-    super.setUp();
-    prepareFtpServer();
-  }
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        prepareFtpServer();
+    }
 
-  @Test
-  public void testRecursiveNotStepwiseNoBasePath() throws Exception {
-    //CAMEL-13400
-    MockEndpoint mock = getMockEndpoint("mock:result");
-    mock.expectedBodiesReceivedInAnyOrder("Bye World", "Hello World", "Goodday World");
-    assertMockEndpointsSatisfied();
-  }
+    @Test
+    public void testRecursiveNotStepwiseNoBasePath() throws Exception {
+        //CAMEL-13400
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceivedInAnyOrder("Bye World", "Hello World", "Goodday World");
+        assertMockEndpointsSatisfied();
+    }
 
-  @Override
-  protected RouteBuilder createRouteBuilder() throws Exception {
-    return new RouteBuilder() {
-      @Override
-      public void configure() throws Exception {
-        from(getFtpUrl())
-            .convertBodyTo(String.class)
-            .to("log:ftp")
-            .to("mock:result");
-      }
-    };
-  }
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from(getFtpUrl())
+                        .convertBodyTo(String.class)
+                        .to("log:ftp")
+                        .to("mock:result");
+            }
+        };
+    }
 
-  private void prepareFtpServer() throws Exception {
-    sendFile(getFtpUrl(), "Bye World", "bye.txt");
-    sendFile(getFtpUrl(), "Hello World", "sub/hello.txt");
-    sendFile(getFtpUrl(), "Goodday World", "sub/sub2/godday.txt");
-  }
+    private void prepareFtpServer() throws Exception {
+        sendFile(getFtpUrl(), "Bye World", "bye.txt");
+        sendFile(getFtpUrl(), "Hello World", "sub/hello.txt");
+        sendFile(getFtpUrl(), "Goodday World", "sub/sub2/godday.txt");
+    }
 }
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePath.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePath.java
index 001a1c9..1cbcb6f 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePath.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePath.java
@@ -24,46 +24,46 @@ import org.junit.Test;
 
 public class FromSftpRecursiveNotStepwiseNoBasePath extends SftpServerTestSupport {
 
-  protected String getSftpUrl() {
-    return "sftp://admin@localhost:" + getPort() + "?password=admin&initialDelay=3000&stepwise=false"
-        + "&recursive=true";
-  }
+    protected String getSftpUrl() {
+        return "sftp://admin@localhost:" + getPort() + "?password=admin&initialDelay=3000&stepwise=false"
+                + "&recursive=true";
+    }
 
-  @Override
-  @Before
-  public void setUp() throws Exception {
-    rootDirMode = true;
-    super.setUp();
-    prepareFtpServer();
-  }
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        rootDirMode = true;
+        super.setUp();
+        prepareFtpServer();
+    }
 
-  @Test
-  public void testRecursiveNotStepwiseNoBasePath() throws Exception {
-    //CAMEL-13400
-    MockEndpoint mock = getMockEndpoint("mock:result");
-    mock.expectedBodiesReceivedInAnyOrder("Bye World", "Hello World", "Goodday World");
-    assertMockEndpointsSatisfied();
-  }
+    @Test
+    public void testRecursiveNotStepwiseNoBasePath() throws Exception {
+        //CAMEL-13400
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceivedInAnyOrder("Bye World", "Hello World", "Goodday World");
+        assertMockEndpointsSatisfied();
+    }
 
-  @Override
-  protected RouteBuilder createRouteBuilder() throws Exception {
-    return new RouteBuilder() {
-      @Override
-      public void configure() throws Exception {
-        from(getSftpUrl())
-            .convertBodyTo(String.class)
-            .to("mock:result");
-      }
-    };
-  }
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from(getSftpUrl())
+                        .convertBodyTo(String.class)
+                        .to("mock:result");
+            }
+        };
+    }
 
-  private void prepareFtpServer() throws Exception {
-    sendFile("Bye World", "bye.txt");
-    sendFile("Hello World", "sub/hello.txt");
-    sendFile("Goodday World", "sub/sub2/godday.txt");
-  }
+    private void prepareFtpServer() throws Exception {
+        sendFile("Bye World", "bye.txt");
+        sendFile("Hello World", "sub/hello.txt");
+        sendFile("Goodday World", "sub/sub2/godday.txt");
+    }
 
-  public void sendFile(Object body, String fileName) {
-    template.sendBodyAndHeader("file://" + FTP_ROOT_DIR, body, Exchange.FILE_NAME, fileName);
-  }
+    public void sendFile(Object body, String fileName) {
+        template.sendBodyAndHeader("file://" + FTP_ROOT_DIR, body, Exchange.FILE_NAME, fileName);
+    }
 }
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
index f4dbf12..51380bf 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
@@ -45,7 +45,7 @@ public class SftpServerTestSupport extends BaseServerTestSupport {
     protected SshServer sshd;
     protected boolean canTest;
     protected String oldUserHome;
-    protected boolean rootDirMode = false;
+    protected boolean rootDirMode;
 
     @Override
     @Before
@@ -80,7 +80,7 @@ public class SftpServerTestSupport extends BaseServerTestSupport {
             sshd.setPasswordAuthenticator((username, password, session) -> true);
             sshd.setPublickeyAuthenticator((username, password, session) -> true);
             if (rootDirMode) {
-              sshd.setFileSystemFactory(new VirtualFileSystemFactory(FileSystems.getDefault().getPath(System.getProperty("user.dir") + "/target/res")));
+                sshd.setFileSystemFactory(new VirtualFileSystemFactory(FileSystems.getDefault().getPath(System.getProperty("user.dir") + "/target/res")));
             }
             sshd.start();
         } catch (Exception e) {


[camel] 01/03: CAMEL-13400 Camel FTP Cannot list directory with 'File not found' prepending additional '/' in front of directory automatically (#2931)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-2.23.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 19aec9838ee1163d4e206caa9820be9ebca3a889
Author: Roberto Flores (Beto) <49...@users.noreply.github.com>
AuthorDate: Tue May 21 02:54:07 2019 -0500

    CAMEL-13400 Camel FTP Cannot list directory with 'File not found' prepending additional '/' in front of directory automatically (#2931)
    
    * CAMEL-13400 Camel FTP Cannot list directory with 'File not found' prepending additional '/' in front of directory automatically
    
    * CAMEL-13400 Fix for SFTP
---
 .../camel/component/file/remote/FtpConsumer.java   |  2 +-
 .../camel/component/file/remote/SftpConsumer.java  |  2 +-
 .../FromFtpRecursiveNotStepwiseNoBasePath.java     | 64 ++++++++++++++++++++
 .../FromSftpRecursiveNotStepwiseNoBasePath.java    | 69 ++++++++++++++++++++++
 .../file/remote/sftp/SftpServerTestSupport.java    |  6 ++
 5 files changed, 141 insertions(+), 2 deletions(-)

diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
index 3d3c384..882cc71 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
@@ -186,7 +186,7 @@ public class FtpConsumer extends RemoteFileConsumer<FTPFile> {
                 if (endpoint.isRecursive() && depth < endpoint.getMaxDepth() && isValidFile(remote, true, files)) {
                     // recursive scan and add the sub files and folders
                     String subDirectory = file.getName();
-                    String path = absolutePath + "/" + subDirectory;
+                    String path = ObjectHelper.isNotEmpty(absolutePath) ? absolutePath + "/" + subDirectory : subDirectory;
                     boolean canPollMore = pollSubDirectory(path, subDirectory, fileList, depth);
                     if (!canPollMore) {
                         return false;
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java
index 8b2fb33..ad110d1 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java
@@ -173,7 +173,7 @@ public class SftpConsumer extends RemoteFileConsumer<SftpRemoteFile> {
                 if (endpoint.isRecursive() && depth < endpoint.getMaxDepth() && isValidFile(remote, true, files)) {
                     // recursive scan and add the sub files and folders
                     String subDirectory = file.getFilename();
-                    String path = absolutePath + "/" + subDirectory;
+                    String path = ObjectHelper.isNotEmpty(absolutePath) ? absolutePath + "/" + subDirectory : subDirectory;
                     boolean canPollMore = pollSubDirectory(path, subDirectory, fileList, depth);
                     if (!canPollMore) {
                         return false;
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePath.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePath.java
new file mode 100644
index 0000000..6112d17
--- /dev/null
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRecursiveNotStepwiseNoBasePath.java
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+package org.apache.camel.component.file.remote;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Before;
+import org.junit.Test;
+
+public class FromFtpRecursiveNotStepwiseNoBasePath extends FtpServerTestSupport {
+
+  protected String getFtpUrl() {
+    return "ftp://admin@localhost:" + getPort() + "?password=admin&initialDelay=3000&stepwise=false"
+        + "&recursive=true";
+  }
+
+  @Override
+  @Before
+  public void setUp() throws Exception {
+    super.setUp();
+    prepareFtpServer();
+  }
+
+  @Test
+  public void testRecursiveNotStepwiseNoBasePath() throws Exception {
+    //CAMEL-13400
+    MockEndpoint mock = getMockEndpoint("mock:result");
+    mock.expectedBodiesReceivedInAnyOrder("Bye World", "Hello World", "Goodday World");
+    assertMockEndpointsSatisfied();
+  }
+
+  @Override
+  protected RouteBuilder createRouteBuilder() throws Exception {
+    return new RouteBuilder() {
+      @Override
+      public void configure() throws Exception {
+        from(getFtpUrl())
+            .convertBodyTo(String.class)
+            .to("log:ftp")
+            .to("mock:result");
+      }
+    };
+  }
+
+  private void prepareFtpServer() throws Exception {
+    sendFile(getFtpUrl(), "Bye World", "bye.txt");
+    sendFile(getFtpUrl(), "Hello World", "sub/hello.txt");
+    sendFile(getFtpUrl(), "Goodday World", "sub/sub2/godday.txt");
+  }
+}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePath.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePath.java
new file mode 100644
index 0000000..001a1c9
--- /dev/null
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/FromSftpRecursiveNotStepwiseNoBasePath.java
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+package org.apache.camel.component.file.remote.sftp;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Before;
+import org.junit.Test;
+
+public class FromSftpRecursiveNotStepwiseNoBasePath extends SftpServerTestSupport {
+
+  protected String getSftpUrl() {
+    return "sftp://admin@localhost:" + getPort() + "?password=admin&initialDelay=3000&stepwise=false"
+        + "&recursive=true";
+  }
+
+  @Override
+  @Before
+  public void setUp() throws Exception {
+    rootDirMode = true;
+    super.setUp();
+    prepareFtpServer();
+  }
+
+  @Test
+  public void testRecursiveNotStepwiseNoBasePath() throws Exception {
+    //CAMEL-13400
+    MockEndpoint mock = getMockEndpoint("mock:result");
+    mock.expectedBodiesReceivedInAnyOrder("Bye World", "Hello World", "Goodday World");
+    assertMockEndpointsSatisfied();
+  }
+
+  @Override
+  protected RouteBuilder createRouteBuilder() throws Exception {
+    return new RouteBuilder() {
+      @Override
+      public void configure() throws Exception {
+        from(getSftpUrl())
+            .convertBodyTo(String.class)
+            .to("mock:result");
+      }
+    };
+  }
+
+  private void prepareFtpServer() throws Exception {
+    sendFile("Bye World", "bye.txt");
+    sendFile("Hello World", "sub/hello.txt");
+    sendFile("Goodday World", "sub/sub2/godday.txt");
+  }
+
+  public void sendFile(Object body, String fileName) {
+    template.sendBodyAndHeader("file://" + FTP_ROOT_DIR, body, Exchange.FILE_NAME, fileName);
+  }
+}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
index 9a7370a..f4dbf12 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.file.remote.sftp;
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.FileSystems;
 import java.nio.file.Paths;
 import java.security.NoSuchAlgorithmException;
 import java.util.Collections;
@@ -26,6 +27,7 @@ import java.util.List;
 import org.apache.camel.component.file.remote.BaseServerTestSupport;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.io.FileUtils;
+import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
 import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
 import org.apache.sshd.common.session.helpers.AbstractSession;
 import org.apache.sshd.server.SshServer;
@@ -43,6 +45,7 @@ public class SftpServerTestSupport extends BaseServerTestSupport {
     protected SshServer sshd;
     protected boolean canTest;
     protected String oldUserHome;
+    protected boolean rootDirMode = false;
 
     @Override
     @Before
@@ -76,6 +79,9 @@ public class SftpServerTestSupport extends BaseServerTestSupport {
             sshd.setCommandFactory(new ScpCommandFactory());
             sshd.setPasswordAuthenticator((username, password, session) -> true);
             sshd.setPublickeyAuthenticator((username, password, session) -> true);
+            if (rootDirMode) {
+              sshd.setFileSystemFactory(new VirtualFileSystemFactory(FileSystems.getDefault().getPath(System.getProperty("user.dir") + "/target/res")));
+            }
             sshd.start();
         } catch (Exception e) {
             // ignore if algorithm is not on the OS