summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-04-11 13:45:51 -0400
committerJames Moger <james.moger@gitblit.com>2014-04-11 13:48:12 -0400
commite5d6095f0d804cb62d00fbb164f7c49371d412d6 (patch)
tree69d69e1d09084abaf3552e6f22246a3839af26d4 /src/test
parentb2fec20f1f1081607b54b3e7dd20b12d03cef113 (diff)
downloadgitblit-e5d6095f0d804cb62d00fbb164f7c49371d412d6.tar.gz
gitblit-e5d6095f0d804cb62d00fbb164f7c49371d412d6.zip
Add missing unit test utility class
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/gitblit/tests/JschConfigTestSessionFactory.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/java/com/gitblit/tests/JschConfigTestSessionFactory.java b/src/test/java/com/gitblit/tests/JschConfigTestSessionFactory.java
new file mode 100644
index 00000000..5d24b401
--- /dev/null
+++ b/src/test/java/com/gitblit/tests/JschConfigTestSessionFactory.java
@@ -0,0 +1,33 @@
+package com.gitblit.tests;
+
+import java.security.KeyPair;
+
+import org.eclipse.jgit.transport.JschConfigSessionFactory;
+import org.eclipse.jgit.transport.OpenSshConfig;
+import org.eclipse.jgit.util.FS;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+
+public class JschConfigTestSessionFactory extends JschConfigSessionFactory {
+
+ final KeyPair keyPair;
+
+ public JschConfigTestSessionFactory(KeyPair keyPair) {
+ this.keyPair = keyPair;
+ }
+
+ @Override
+ protected void configure(OpenSshConfig.Host host, Session session) {
+ session.setConfig("StrictHostKeyChecking", "no");
+ }
+
+ @Override
+ protected JSch getJSch(final OpenSshConfig.Host hc, FS fs) throws JSchException {
+ JSch jsch = super.getJSch(hc, fs);
+// jsch.removeAllIdentity();
+// jsch.addIdentity("unittest", keyPair.getPrivate().getEncoded(), keyPair.getPublic().getEncoded(), null);
+ return jsch;
+ }
+} \ No newline at end of file