@Test public void testLoadFromOriginalLocation() throws Exception { String repositoryId = "other-id"; URI url = URI.create( localServer.addServer("original", ResourceUtil.resourceFile("repositories/e342"))); Repositories repos = loadRepositories(repositoryId, url); assertThat(repos.getMetadataRepository(), notNullValue()); assertThat(repos.getArtifactRepository(), notNullValue()); }
@Test public void testLoadFromMirroredLocation() throws Exception { String repositoryId = "well-known-id"; URI originalUrl = URI.create(localServer.addServer("original", noContent())); // will fail if used URI mirroredUrl = URI.create( localServer.addServer("mirrored", ResourceUtil.resourceFile("repositories/e342"))); prepareMavenMirrorConfiguration(repositoryId, mirroredUrl); Repositories repos = loadRepositories(repositoryId, originalUrl); assertThat(repos.getMetadataRepository(), notNullValue()); assertThat(repos.getArtifactRepository(), notNullValue()); }
@Test public void testLoadFromMirroredLocationWithFallbackId() throws Exception { URI originalUrl = URI.create(localServer.addServer("original", noContent())); // will fail if used URI mirroredUrl = URI.create( localServer.addServer("mirrored", ResourceUtil.resourceFile("repositories/e342"))); String repositoryFallbackId = originalUrl.toString(); assertFalse( "self-test: fallback ID shall be URL without trailing slash", repositoryFallbackId.endsWith("/")); prepareMavenMirrorConfiguration(repositoryFallbackId, mirroredUrl); Repositories repos = loadRepositories(null, originalUrl); assertThat(repos.getMetadataRepository(), notNullValue()); assertThat(repos.getArtifactRepository(), notNullValue()); }