From 3acb2c97264a2d07cef3b58bb0332b613506a747 Mon Sep 17 00:00:00 2001 From: Jan-Niklas Pieninck Date: Tue, 23 Dec 2025 09:57:39 +0100 Subject: [PATCH 1/3] fix: correct class name of HttpTransporterFactory fixes spring-cloud#2392 Signed-off-by: Jan-Niklas Pieninck --- .../cloud/contract/stubrunner/AetherFactories.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/AetherFactories.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/AetherFactories.java index 956367c1b8..d3a78d1c9c 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/AetherFactories.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/AetherFactories.java @@ -140,7 +140,7 @@ public void serviceCreationFailed(Class type, Class impl, Throwable except registerIfPresent(locator, "org.eclipse.aether.transport.file.FileTransporterFactory", TransporterFactory.class); - registerIfPresent(locator, "org.eclipse.aether.transport.http.HttpTransporterFanewRepositorySystemctory", + registerIfPresent(locator, "org.eclipse.aether.transport.http.HttpTransporterFactory", TransporterFactory.class); RepositorySystem system = locator.getService(RepositorySystem.class); From 70a7d0b989861933ca7aada545aebff5109446b1 Mon Sep 17 00:00:00 2001 From: Jan-Niklas Pieninck Date: Tue, 23 Dec 2025 11:39:10 +0100 Subject: [PATCH 2/3] fix: extract fqn to constants and add tests fixes spring-cloud#2392 Signed-off-by: Jan-Niklas Pieninck --- .../contract/stubrunner/AetherFactories.java | 24 +++++++++++---- .../stubrunner/AetherFactoriesTests.java | 30 +++++++++++++++++++ 2 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/AetherFactoriesTests.java diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/AetherFactories.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/AetherFactories.java index d3a78d1c9c..9891c60619 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/AetherFactories.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/AetherFactories.java @@ -59,6 +59,21 @@ */ final class AetherFactories { + /** + * Fully qualified name of {@code BasicRepositoryConnectorFactory}. + */ + public static final String BASIC_REPOSITORY_CONNECTOR_FACTORY_FQN = "org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory"; + + /** + * Fully qualified name of {@code FileTransporterFactory}. + */ + public static final String FILE_TRANSPORTER_FACTORY_FQN = "org.eclipse.aether.transport.file.FileTransporterFactory"; + + /** + * Fully qualified name of {@code HttpTransporterFactory}. + */ + public static final String HTTP_TRANSPORTER_FACTORY_FQN = "org.eclipse.aether.transport.http.HttpTransporterFactory"; + private static final Log log = LogFactory.getLog(AetherFactories.class); private static final String MAVEN_LOCAL_REPOSITORY_LOCATION = "maven.repo.local"; @@ -134,14 +149,11 @@ public void serviceCreationFailed(Class type, Class impl, Throwable except // Try to register connector + transporters reflectively, but do not hard-link // them. - registerIfPresent(locator, "org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory", - RepositoryConnectorFactory.class); + registerIfPresent(locator, BASIC_REPOSITORY_CONNECTOR_FACTORY_FQN, RepositoryConnectorFactory.class); - registerIfPresent(locator, "org.eclipse.aether.transport.file.FileTransporterFactory", - TransporterFactory.class); + registerIfPresent(locator, FILE_TRANSPORTER_FACTORY_FQN, TransporterFactory.class); - registerIfPresent(locator, "org.eclipse.aether.transport.http.HttpTransporterFactory", - TransporterFactory.class); + registerIfPresent(locator, HTTP_TRANSPORTER_FACTORY_FQN, TransporterFactory.class); RepositorySystem system = locator.getService(RepositorySystem.class); diff --git a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/AetherFactoriesTests.java b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/AetherFactoriesTests.java new file mode 100644 index 0000000000..477e68f298 --- /dev/null +++ b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/AetherFactoriesTests.java @@ -0,0 +1,30 @@ +package org.springframework.cloud.contract.stubrunner; + +import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory; +import org.eclipse.aether.transport.file.FileTransporterFactory; +import org.eclipse.aether.transport.http.HttpTransporterFactory; +import org.junit.Test; + +import static org.assertj.core.api.BDDAssertions.then; + +/** + * @author Jan-Niklas Pieninck + */ +public class AetherFactoriesTests { + + @Test + public void should_match_fqn_of_basic_repository_connector_factory() { + then(AetherFactories.BASIC_REPOSITORY_CONNECTOR_FACTORY_FQN).isEqualTo(BasicRepositoryConnectorFactory.class.getName()); + } + + @Test + public void should_match_fqn_of_file_transporter_factory() { + then(AetherFactories.FILE_TRANSPORTER_FACTORY_FQN).isEqualTo(FileTransporterFactory.class.getName()); + } + + @Test + public void should_match_fqn_of_http_transporter_factory() { + then(AetherFactories.HTTP_TRANSPORTER_FACTORY_FQN).isEqualTo(HttpTransporterFactory.class.getName()); + } + +} \ No newline at end of file From e83d065ac19f674559484bf8194c2eb9a758f6cd Mon Sep 17 00:00:00 2001 From: Jan-Niklas Pieninck Date: Thu, 25 Dec 2025 11:44:25 +0100 Subject: [PATCH 3/3] fix: change scope of constants fixes spring-cloud#2392 Signed-off-by: Jan-Niklas Pieninck --- .../contract/stubrunner/AetherFactories.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/AetherFactories.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/AetherFactories.java index 9891c60619..e442361ec8 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/AetherFactories.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/AetherFactories.java @@ -59,20 +59,11 @@ */ final class AetherFactories { - /** - * Fully qualified name of {@code BasicRepositoryConnectorFactory}. - */ - public static final String BASIC_REPOSITORY_CONNECTOR_FACTORY_FQN = "org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory"; + static final String BASIC_REPOSITORY_CONNECTOR_FACTORY_FQN = "org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory"; - /** - * Fully qualified name of {@code FileTransporterFactory}. - */ - public static final String FILE_TRANSPORTER_FACTORY_FQN = "org.eclipse.aether.transport.file.FileTransporterFactory"; + static final String FILE_TRANSPORTER_FACTORY_FQN = "org.eclipse.aether.transport.file.FileTransporterFactory"; - /** - * Fully qualified name of {@code HttpTransporterFactory}. - */ - public static final String HTTP_TRANSPORTER_FACTORY_FQN = "org.eclipse.aether.transport.http.HttpTransporterFactory"; + static final String HTTP_TRANSPORTER_FACTORY_FQN = "org.eclipse.aether.transport.http.HttpTransporterFactory"; private static final Log log = LogFactory.getLog(AetherFactories.class);