use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class DefaultRepositorySystemSessionTest method testDefaultProxySelectorUsesExistingProxy.
@Test
public void testDefaultProxySelectorUsesExistingProxy() {
DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
RemoteRepository repo = new RemoteRepository("id", "default", "void");
assertSame(null, session.getProxySelector().getProxy(repo));
repo.setProxy(new Proxy("http", "localhost", 8080, null));
assertSame(repo.getProxy(), session.getProxySelector().getProxy(repo));
}
use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class DefaultRemoteRepositoryManagerTest method testAggregateSimpleRepos.
@Test
public void testAggregateSimpleRepos() {
RemoteRepository dominant1 = newRepo("a", "file://", false, "", "");
RemoteRepository recessive1 = newRepo("a", "http://", true, "", "");
RemoteRepository recessive2 = newRepo("b", "file://", true, "", "");
List<RemoteRepository> result = manager.aggregateRepositories(session, Arrays.asList(dominant1), Arrays.asList(recessive1, recessive2), false);
assertEquals(2, result.size());
assertEqual(dominant1, result.get(0));
assertEqual(recessive2, result.get(1));
}
use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class DefaultRemoteRepositoryManagerTest method testGetPolicy.
@Test
public void testGetPolicy() {
RepositoryPolicy snapshotPolicy = new RepositoryPolicy(true, RepositoryPolicy.UPDATE_POLICY_ALWAYS, RepositoryPolicy.CHECKSUM_POLICY_IGNORE);
RepositoryPolicy releasePolicy = new RepositoryPolicy(true, RepositoryPolicy.UPDATE_POLICY_NEVER, RepositoryPolicy.CHECKSUM_POLICY_FAIL);
RemoteRepository repo = new RemoteRepository("id", "type", "http://localhost");
repo.setPolicy(true, snapshotPolicy);
repo.setPolicy(false, releasePolicy);
RepositoryPolicy effectivePolicy = manager.getPolicy(session, repo, true, true);
assertEquals(true, effectivePolicy.isEnabled());
assertEquals(RepositoryPolicy.CHECKSUM_POLICY_IGNORE, effectivePolicy.getChecksumPolicy());
assertEquals(RepositoryPolicy.UPDATE_POLICY_ALWAYS, effectivePolicy.getUpdatePolicy());
}
use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class DefaultUpdateCheckManagerTest method setup.
@Before
public void setup() throws Exception {
File dir = TestFileUtils.createTempFile("");
TestFileUtils.delete(dir);
File metadataFile = new File(dir, "metadata.txt");
TestFileUtils.write("metadata", metadataFile);
File artifactFile = new File(dir, "artifact.txt");
TestFileUtils.write("artifact", artifactFile);
session = new TestRepositorySystemSession();
repository = new RemoteRepository("id", "default", TestFileUtils.createTempDir().toURL().toString());
manager = new DefaultUpdateCheckManager();
metadata = new StubMetadata("gid", "aid", "ver", "maven-metadata.xml", Metadata.Nature.RELEASE_OR_SNAPSHOT, metadataFile);
artifact = new StubArtifact("gid", "aid", "", "ext", "ver").setFile(artifactFile);
}
use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class AsyncConnectorSuiteConfiguration method before.
@Override
@Before
public void before() throws Exception {
super.before();
this.factory = new AsyncRepositoryConnectorFactory(NullLogger.INSTANCE, new TestFileProcessor());
this.session = new TestRepositorySystemSession();
this.repository = new RemoteRepository("async-test-repo", "default", url("repo"));
this.artifact = new StubArtifact("gid", "aid", "classifier", "extension", "version", null);
this.metadata = new StubMetadata("gid", "aid", "version", "maven-metadata.xml", Metadata.Nature.RELEASE_OR_SNAPSHOT, null);
connector = null;
}
Aggregations