Search in sources :

Example 46 with RemoteRepository

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));
}
Also used : Proxy(org.sonatype.aether.repository.Proxy) RemoteRepository(org.sonatype.aether.repository.RemoteRepository) Test(org.junit.Test)

Example 47 with RemoteRepository

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));
}
Also used : RemoteRepository(org.sonatype.aether.repository.RemoteRepository) Test(org.junit.Test)

Example 48 with RemoteRepository

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());
}
Also used : RepositoryPolicy(org.sonatype.aether.repository.RepositoryPolicy) RemoteRepository(org.sonatype.aether.repository.RemoteRepository) Test(org.junit.Test)

Example 49 with RemoteRepository

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);
}
Also used : TestRepositorySystemSession(org.sonatype.aether.test.impl.TestRepositorySystemSession) StubMetadata(org.sonatype.aether.test.util.impl.StubMetadata) StubArtifact(org.sonatype.aether.test.util.impl.StubArtifact) RemoteRepository(org.sonatype.aether.repository.RemoteRepository) File(java.io.File) Before(org.junit.Before)

Example 50 with RemoteRepository

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;
}
Also used : TestRepositorySystemSession(org.sonatype.aether.test.impl.TestRepositorySystemSession) TestFileProcessor(org.sonatype.aether.test.impl.TestFileProcessor) StubArtifact(org.sonatype.aether.test.util.impl.StubArtifact) StubMetadata(org.sonatype.aether.test.util.impl.StubMetadata) RemoteRepository(org.sonatype.aether.repository.RemoteRepository) Before(org.junit.Before)

Aggregations

RemoteRepository (org.sonatype.aether.repository.RemoteRepository)71 Artifact (org.sonatype.aether.artifact.Artifact)30 Test (org.junit.Test)27 DefaultArtifact (org.sonatype.aether.util.artifact.DefaultArtifact)18 File (java.io.File)15 RepositorySystemSession (org.sonatype.aether.RepositorySystemSession)15 TestRepositorySystemSession (org.sonatype.aether.test.impl.TestRepositorySystemSession)13 StubArtifact (org.sonatype.aether.test.util.impl.StubArtifact)13 Dependency (org.sonatype.aether.graph.Dependency)12 ArtifactRequest (org.sonatype.aether.resolution.ArtifactRequest)12 ArtifactResult (org.sonatype.aether.resolution.ArtifactResult)12 LocalArtifactRequest (org.sonatype.aether.repository.LocalArtifactRequest)11 CollectRequest (org.sonatype.aether.collection.CollectRequest)10 LocalArtifactResult (org.sonatype.aether.repository.LocalArtifactResult)10 ArrayList (java.util.ArrayList)8 RepositorySystem (org.sonatype.aether.RepositorySystem)8 IOException (java.io.IOException)7 Before (org.junit.Before)7 Metadata (org.sonatype.aether.metadata.Metadata)7 DependencyRequest (org.sonatype.aether.resolution.DependencyRequest)7