diff options
Diffstat (limited to 'org.eclipse.jgit.junit.ssh/src/org/eclipse')
-rw-r--r-- | org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java | 6 | ||||
-rw-r--r-- | org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestHarness.java | 13 |
2 files changed, 9 insertions, 10 deletions
diff --git a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java index 5d043ffc3a..1138be8a96 100644 --- a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java +++ b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java @@ -116,7 +116,9 @@ public class SshTestGitServer { * @param hostKey * the unencrypted private key to use as host key * @throws IOException + * if an IO error occurred * @throws GeneralSecurityException + * if something went wrong */ public SshTestGitServer(@NonNull String testUser, @NonNull Path testKey, @NonNull Repository repository, @NonNull byte[] hostKey) @@ -138,7 +140,9 @@ public class SshTestGitServer { * @param hostKey * the unencrypted private key to use as host key * @throws IOException + * if an IO error occurred * @throws GeneralSecurityException + * if something went wrong * @since 5.9 */ public SshTestGitServer(@NonNull String testUser, @NonNull Path testKey, @@ -413,6 +417,7 @@ public class SshTestGitServer { * @return the port the server listens on; test clients should connect to * that port * @throws IOException + * if an IO error occurred */ public int start() throws IOException { server.start(); @@ -423,6 +428,7 @@ public class SshTestGitServer { * Stops the test server. * * @throws IOException + * if an IO error occurred */ public void stop() throws IOException { executorService.shutdownNow(); diff --git a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestHarness.java b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestHarness.java index a28d5ebd98..b183b22603 100644 --- a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestHarness.java +++ b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestHarness.java @@ -89,8 +89,6 @@ public abstract class SshTestHarness extends RepositoryTestCase { protected File knownHosts; - private File homeDir; - @Override public void setUp() throws Exception { super.setUp(); @@ -99,13 +97,8 @@ public abstract class SshTestHarness extends RepositoryTestCase { git.add().addFilepattern("file.txt").call(); git.commit().setMessage("Initial commit").call(); } - mockSystemReader.setProperty("user.home", - getTemporaryDirectory().getAbsolutePath()); - mockSystemReader.setProperty("HOME", - getTemporaryDirectory().getAbsolutePath()); - homeDir = FS.DETECTED.userHome(); - FS.DETECTED.setUserHome(getTemporaryDirectory().getAbsoluteFile()); - sshDir = new File(getTemporaryDirectory(), ".ssh"); + // The home directory is mocked here + sshDir = new File(FS.DETECTED.userHome(), ".ssh"); assertTrue(sshDir.mkdir()); File serverDir = new File(getTemporaryDirectory(), "srv"); assertTrue(serverDir.mkdir()); @@ -191,6 +184,7 @@ public abstract class SshTestHarness extends RepositoryTestCase { * to use * @return the public-key part of the line * @throws IOException + * if an IO error occurred */ protected static String createKnownHostsFile(File file, String host, int port, File publicKey) throws IOException { @@ -235,7 +229,6 @@ public abstract class SshTestHarness extends RepositoryTestCase { server.stop(); server = null; } - FS.DETECTED.setUserHome(homeDir); SshSessionFactory.setInstance(null); factory = null; } |