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..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,6 +59,12 @@ */ final class AetherFactories { + static final String BASIC_REPOSITORY_CONNECTOR_FACTORY_FQN = "org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory"; + + static final String FILE_TRANSPORTER_FACTORY_FQN = "org.eclipse.aether.transport.file.FileTransporterFactory"; + + 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 +140,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.HttpTransporterFanewRepositorySystemctory", - 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