Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2021-10-19 03:32:20 -0400
committerThomas Wolf2021-10-19 03:32:20 -0400
commitf698fbf919c67edac4b3999cc932c1f22da1dffd (patch)
treee10ebcf3dfa2cd58aa99245b311b84431c581b83
parentf8b0c00e6a8f5628babff6dd37254a21589b6e44 (diff)
downloadjgit-f698fbf919c67edac4b3999cc932c1f22da1dffd.tar.gz
jgit-f698fbf919c67edac4b3999cc932c1f22da1dffd.tar.xz
jgit-f698fbf919c67edac4b3999cc932c1f22da1dffd.zip
JSch: fix service publication for ServiceLoader
The file name in META-INF/services must be the fully qualified interface name; the content the fully qualified implementation class name. This was broken in commit 9683bc71. Add a test for the default factory being found by the ServiceLoader. Change-Id: I1f180d7f60e5c1e74a39bbd9a5f0099bd8343e21 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r--org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/ServiceLoaderTest.java24
-rw-r--r--org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory (renamed from org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.ssh.jsch.SshSessionFactory)0
2 files changed, 24 insertions, 0 deletions
diff --git a/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/ServiceLoaderTest.java b/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/ServiceLoaderTest.java
new file mode 100644
index 0000000000..2bae221e29
--- /dev/null
+++ b/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/ServiceLoaderTest.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2021, Thomas Wolf <thomas.wolf@paranor.ch> and others
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+package org.eclipse.jgit.transport.ssh.jsch;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.jgit.transport.SshSessionFactory;
+import org.junit.Test;
+
+public class ServiceLoaderTest {
+
+ @Test
+ public void testDefaultFactoryFound() {
+ SshSessionFactory defaultFactory = SshSessionFactory.getInstance();
+ assertNotNull(defaultFactory);
+ }
+}
diff --git a/org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.ssh.jsch.SshSessionFactory b/org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory
index aca489659e..aca489659e 100644
--- a/org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.ssh.jsch.SshSessionFactory
+++ b/org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory

Back to the top