MavenRepository { Collection<RemoteRepository> getRemoteRepositoriesForRequest() { return remoteRepositoriesForRequest; } protected  MavenRepository( Aether aether ); static synchronized MavenRepository getMavenRepository(); static MavenRepository getMavenRepository( MavenProject mavenProject ); List<DependencyDescriptor> getArtifactDependecies( String artifactName ); Artifact resolveArtifact( AFReleaseId releaseId ); Artifact resolveArtifact( String artifactName ); Artifact resolveArtifact( String artifactName,
                                     boolean logUnresolvedArtifact ); Version resolveVersion( String artifactName ); void deployArtifact( RemoteRepository repository,
                                AFReleaseId releaseId,
                                File jar,
                                File pomfile ); void installArtifact( AFReleaseId releaseId,
                                 byte[] jarContent,
                                 byte[] pomContent ); void installArtifact( AFReleaseId releaseId,
                                 File jar,
                                 File pomfile ); void deployPomArtifact( String groupId,
                                   String artifactId,
                                   String version,
                                   File pomfile ); static String toFileName( AFReleaseId releaseId,
                                     String classifier ); void removeLocalArtifact(AFReleaseId releaseId); static MavenRepository defaultMavenRepository; }
@Test public void testMirrors() { MavenRepositoryMock.setCustomSettingsFileName("settings_with_mirror.xml"); final MavenRepository repo = new MavenRepositoryMock(Aether.getAether()); final Collection<RemoteRepository> remoteRepos = repo.getRemoteRepositoriesForRequest(); assertEquals(2, remoteRepos.size()); for (final RemoteRepository remoteRepo : remoteRepos) { assertTrue(remoteRepo.getId().equals("qa") || remoteRepo.getId().equals("foo")); } }
@Test public void testProxy() { MavenRepositoryMock.setCustomSettingsFileName("settings_custom.xml"); final MavenRepository repo = new MavenRepositoryMock(Aether.getAether()); final Collection<RemoteRepository> remoteRepos = repo.getRemoteRepositoriesForRequest(); final Set<RemoteRepository> testServerRepos = remoteRepos .stream() .filter(r -> r.getId().equals("test-server")) .collect(Collectors.toSet()); assertEquals(2, testServerRepos.size()); for (RemoteRepository remoteRepository : testServerRepos) { assertNotNull(remoteRepository.getProxy()); } }