Java Code Examples for org.eclipse.aether.repository.RemoteRepository#getMirroredRepositories()
The following examples show how to use
org.eclipse.aether.repository.RemoteRepository#getMirroredRepositories() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PomReposMirroredTest.java From quarkus with Apache License 2.0 | 6 votes |
@Test public void basicPomRepos() throws Exception { final BootstrapMavenContext mvn = bootstrapMavenContextWithSettings("custom-settings/pom-repos-mirrored"); final List<RemoteRepository> repos = mvn.getRemoteRepositories(); assertEquals(1, repos.size()); RemoteRepository repo = repos.get(0); assertEquals("private-repo", repo.getId()); assertNull(repo.getProxy()); assertNotNull(repo.getAuthentication()); List<RemoteRepository> mirroredRepos = repo.getMirroredRepositories(); assertNotNull(mirroredRepos); assertEquals(MIRRORED.size(), mirroredRepos.size()); for (RemoteRepository r : mirroredRepos) { assertTrue(MIRRORED.containsKey(r.getId())); assertEquals(MIRRORED.get(r.getId()), r.getUrl()); } }
Example 2
Source File: ProxyAndMirrorSettingsReposTest.java From quarkus with Apache License 2.0 | 6 votes |
@Test public void basicPomRepos() throws Exception { final BootstrapMavenContext mvn = bootstrapMavenContextWithSettings("custom-settings/proxy-and-mirror"); final List<RemoteRepository> repos = mvn.getRemoteRepositories(); assertEquals(2, repos.size()); assertEquals("custom-repo", repos.get(0).getId()); assertNotNull(repos.get(0).getProxy()); assertNotNull(repos.get(0).getMirroredRepositories()); final RemoteRepository centralRepo = repos.get(repos.size() - 1); assertEquals("mirror-A", centralRepo.getId(), "Central repo must be substitute by mirror"); assertNotNull(centralRepo.getProxy()); assertEquals(2, centralRepo.getMirroredRepositories().size()); final List<String> mirrored = Arrays.asList("central", "jboss-public-repository"); for (RemoteRepository repo : centralRepo.getMirroredRepositories()) { assertTrue(mirrored.contains(repo.getId())); } }
Example 3
Source File: MvnSettingsTestCase.java From galleon with Apache License 2.0 | 5 votes |
@Test public void testMirror() throws Exception { RepositorySystem system = Util.newRepositorySystem(); MavenConfig config = new MavenConfig(); InputStream stream = MvnSettingsTestCase.class.getClassLoader(). getResourceAsStream("settings_cli_test_mirror.xml"); File tmp = File.createTempFile("cli_mvn_test", null); tmp.deleteOnExit(); Files.copy(stream, tmp.toPath(), StandardCopyOption.REPLACE_EXISTING); config.setSettings(tmp.toPath()); MavenMvnSettings settings = new MavenMvnSettings(config, system, null); assertEquals(5, settings.getRepositories().size()); boolean seen3 = false; boolean seenMirror = false; for (RemoteRepository remote : settings.getRepositories()) { if (remote.getId().equals("repo3")) { seen3 = true; } if (remote.getId().equals("mirror1")) { assertTrue(remote.getUrl().equals("http://mirror1")); seenMirror = true; assertEquals(remote.getMirroredRepositories().size(), 2); boolean seen1 = false; boolean seen2 = false; for (RemoteRepository mirrored : remote.getMirroredRepositories()) { if (mirrored.getId().equals("repo1")) { seen1 = true; assertTrue(mirrored.getUrl(), mirrored.getUrl().equals("http://repo1")); } if (mirrored.getId().equals("repo2")) { seen2 = true; assertTrue(mirrored.getUrl(), mirrored.getUrl().equals("http://repo2")); } } assertTrue(seen1 && seen2); } } assertTrue(seenMirror && seen3); }
Example 4
Source File: MvnSettingsTestCase.java From galleon with Apache License 2.0 | 4 votes |
@Test public void testMirrorAll() throws Exception { RepositorySystem system = Util.newRepositorySystem(); MavenConfig config = new MavenConfig(); InputStream stream = MvnSettingsTestCase.class.getClassLoader(). getResourceAsStream("settings_cli_test_mirror_all.xml"); File tmp = File.createTempFile("cli_mvn_test", null); tmp.deleteOnExit(); Files.copy(stream, tmp.toPath(), StandardCopyOption.REPLACE_EXISTING); config.setSettings(tmp.toPath()); MavenMvnSettings settings = new MavenMvnSettings(config, system, null); assertEquals(4, settings.getRepositories().size()); boolean seenMirror = false; for (RemoteRepository remote : settings.getRepositories()) { if (remote.getId().equals("mirror1")) { assertTrue(remote.getUrl().equals("http://mirror1")); seenMirror = true; assertEquals(remote.getMirroredRepositories().size(), 3); boolean seen1 = false; boolean seen2 = false; boolean seen3 = false; for (RemoteRepository mirrored : remote.getMirroredRepositories()) { if (mirrored.getId().equals("repo1")) { seen1 = true; assertTrue(mirrored.getUrl(), mirrored.getUrl().equals("http://repo1")); } if (mirrored.getId().equals("repo2")) { seen2 = true; assertTrue(mirrored.getUrl(), mirrored.getUrl().equals("http://repo2")); } if (mirrored.getId().equals("repo3")) { seen3 = true; assertTrue(mirrored.getUrl(), mirrored.getUrl().equals("http://repo3")); } } assertTrue(seen1 && seen2 && seen3); } } assertTrue(seenMirror); }