You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2016/04/15 21:39:03 UTC

mina-sshd git commit: Using local temp folder for RootedFileSystemProviderTest sandbox instead of system one

Repository: mina-sshd
Updated Branches:
  refs/heads/master 3ef5d1a93 -> a42f9b553


Using local temp folder for RootedFileSystemProviderTest sandbox instead of system one


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/a42f9b55
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/a42f9b55
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/a42f9b55

Branch: refs/heads/master
Commit: a42f9b553264d6979cc990934a243fe7715b306a
Parents: 3ef5d1a
Author: Lyor Goldstein <ly...@gmail.com>
Authored: Fri Apr 15 22:39:24 2016 +0300
Committer: Lyor Goldstein <ly...@gmail.com>
Committed: Fri Apr 15 22:39:24 2016 +0300

----------------------------------------------------------------------
 .../common/file/root/RootedFileSystemProviderTest.java   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/a42f9b55/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java b/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
index 9167c17..dd1fcbb 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
@@ -34,6 +34,8 @@ import java.util.Collections;
 import java.util.Random;
 import java.util.TreeSet;
 
+import org.apache.sshd.common.util.ValidateUtils;
+import org.apache.sshd.util.test.Utils;
 import org.junit.BeforeClass;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -59,7 +61,9 @@ public class RootedFileSystemProviderTest extends AssertableFile {
 
     @BeforeClass
     public static void onlyOnce() throws IOException {
-        rootSandbox = FileHelper.createTestSandbox();
+        Path targetFolder = ValidateUtils.checkNotNull(
+                Utils.detectTargetFolder(RootedFileSystemProviderTest.class), "Failed to detect target folder").toPath();
+        rootSandbox = FileHelper.createTestSandbox(targetFolder.resolve(TEMP_SUBFOLDER_NAME));
         fileSystem = (RootedFileSystem) new RootedFileSystemProvider().newFileSystem(rootSandbox,
                 Collections.<String, Object> emptyMap());
     }
@@ -223,12 +227,13 @@ public class RootedFileSystemProviderTest extends AssertableFile {
         /**
          * Create a randomized test sandbox on each test execution
          *
+         * @param tempDir location to create the sandbox
          * @return the created sandbox Path
          * @throws IOException
          *             on failure to create
          */
-        public static Path createTestSandbox() throws IOException {
-            Path created = Files.createTempDirectory("testRoot");
+        public static Path createTestSandbox(Path tempDir) throws IOException {
+            Path created = Files.createDirectories(tempDir.resolve(RootedFileSystemProviderTest.class.getSimpleName()));
             created.toFile().deleteOnExit();
             return created;
         }