use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class DefaultRemoteRepositoryManagerTest method testMirrorAuthentication.
@Test
public void testMirrorAuthentication() {
final RemoteRepository repo = newRepo("a", "http://", false, "", "");
final RemoteRepository mirror = newRepo("a", "http://", false, "", "");
mirror.setAuthentication(new Authentication("username", "password"));
session.setMirrorSelector(new MirrorSelector() {
public RemoteRepository getMirror(RemoteRepository repository) {
return mirror;
}
});
List<RemoteRepository> result = manager.aggregateRepositories(session, Collections.<RemoteRepository>emptyList(), Arrays.asList(repo), true);
assertEquals(1, result.size());
assertEquals("username", result.get(0).getAuthentication().getUsername());
assertEquals("password", result.get(0).getAuthentication().getPassword());
}
use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class DefaultRemoteRepositoryManagerTest method testProxySelector.
@Test
public void testProxySelector() {
final RemoteRepository repo = newRepo("a", "http://", false, "", "");
final Proxy proxy = new Proxy("http", "host", 2011, null);
session.setProxySelector(new ProxySelector() {
public Proxy getProxy(RemoteRepository repository) {
return proxy;
}
});
session.setMirrorSelector(new MirrorSelector() {
public RemoteRepository getMirror(RemoteRepository repository) {
return null;
}
});
List<RemoteRepository> result = manager.aggregateRepositories(session, Collections.<RemoteRepository>emptyList(), Arrays.asList(repo), true);
assertEquals(1, result.size());
assertEquals("http", result.get(0).getProxy().getType());
assertEquals("host", result.get(0).getProxy().getHost());
assertEquals(2011, result.get(0).getProxy().getPort());
}
use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class DefaultRemoteRepositoryManagerTest method testAggregateMirrorRepos_DominantMirrorIncomplete.
@Test
public void testAggregateMirrorRepos_DominantMirrorIncomplete() {
RemoteRepository dominant1 = newRepo("a", "http://", false, "", "");
RemoteRepository dominantMirror1 = newRepo("x", "file://", false, "", "");
dominantMirror1.setMirroredRepositories(Arrays.asList(dominant1));
RemoteRepository recessive1 = newRepo("a", "https://", true, "", "");
RemoteRepository recessive2 = newRepo("b", "https://", true, "", "");
RemoteRepository recessiveMirror1 = newRepo("x", "http://", true, "", "");
recessiveMirror1.setMirroredRepositories(Arrays.asList(recessive1, recessive2));
List<RemoteRepository> result = manager.aggregateRepositories(session, Arrays.asList(dominantMirror1), Arrays.asList(recessiveMirror1), false);
assertEquals(1, result.size());
assertEqual(newRepo("x", "file://", true, "", ""), result.get(0));
assertEquals(2, result.get(0).getMirroredRepositories().size());
assertEquals(dominant1, result.get(0).getMirroredRepositories().get(0));
assertEquals(recessive2, result.get(0).getMirroredRepositories().get(1));
}
use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class DefaultRemoteRepositoryManagerTest method testMirrorProxy.
@Test
public void testMirrorProxy() {
final RemoteRepository repo = newRepo("a", "http://", false, "", "");
final RemoteRepository mirror = newRepo("a", "http://", false, "", "");
mirror.setProxy(new Proxy("http", "host", 2011, null));
session.setMirrorSelector(new MirrorSelector() {
public RemoteRepository getMirror(RemoteRepository repository) {
return mirror;
}
});
List<RemoteRepository> result = manager.aggregateRepositories(session, Collections.<RemoteRepository>emptyList(), Arrays.asList(repo), true);
assertEquals(1, result.size());
assertEquals("http", result.get(0).getProxy().getType());
assertEquals("host", result.get(0).getProxy().getHost());
assertEquals(2011, result.get(0).getProxy().getPort());
}
use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class DefaultRemoteRepositoryManagerTest method testAggregateMirrorRepos_DominantMirrorComplete.
@Test
public void testAggregateMirrorRepos_DominantMirrorComplete() {
RemoteRepository dominant1 = newRepo("a", "http://", false, "", "");
RemoteRepository dominantMirror1 = newRepo("x", "file://", false, "", "");
dominantMirror1.setMirroredRepositories(Arrays.asList(dominant1));
RemoteRepository recessive1 = newRepo("a", "https://", true, "", "");
RemoteRepository recessiveMirror1 = newRepo("x", "http://", true, "", "");
recessiveMirror1.setMirroredRepositories(Arrays.asList(recessive1));
List<RemoteRepository> result = manager.aggregateRepositories(session, Arrays.asList(dominantMirror1), Arrays.asList(recessiveMirror1), false);
assertEquals(1, result.size());
assertEqual(dominantMirror1, result.get(0));
assertEquals(1, result.get(0).getMirroredRepositories().size());
assertEquals(dominant1, result.get(0).getMirroredRepositories().get(0));
}
Aggregations