From f698fbf919c67edac4b3999cc932c1f22da1dffd Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Tue, 19 Oct 2021 09:32:20 +0200 Subject: [PATCH] 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 --- .../transport/ssh/jsch/ServiceLoaderTest.java | 24 +++++++++++++++++++ ....eclipse.jgit.transport.SshSessionFactory} | 0 2 files changed, 24 insertions(+) create mode 100644 org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/ServiceLoaderTest.java rename org.eclipse.jgit.ssh.jsch/resources/META-INF/services/{org.eclipse.jgit.transport.ssh.jsch.SshSessionFactory => org.eclipse.jgit.transport.SshSessionFactory} (100%) 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 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 similarity index 100% rename from org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.ssh.jsch.SshSessionFactory rename to org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory -- 2.39.5