Search in sources :

Example 6 with TestRepositorySystemSession

use of org.sonatype.aether.test.impl.TestRepositorySystemSession 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)

Example 7 with TestRepositorySystemSession

use of org.sonatype.aether.test.impl.TestRepositorySystemSession in project sonatype-aether by sonatype.

the class ArtifactWorkerTest method setup.

@Before
public void setup() throws IOException {
    repository = new RemoteRepository("test", "default", TestFileUtils.createTempDir("test-remote-repository").toURL().toString());
    session = new TestRepositorySystemSession();
    layout = new MavenDefaultLayout();
}
Also used : TestRepositorySystemSession(org.sonatype.aether.test.impl.TestRepositorySystemSession) MavenDefaultLayout(org.sonatype.aether.util.layout.MavenDefaultLayout) RemoteRepository(org.sonatype.aether.repository.RemoteRepository) Before(org.junit.Before)

Example 8 with TestRepositorySystemSession

use of org.sonatype.aether.test.impl.TestRepositorySystemSession in project sonatype-aether by sonatype.

the class ResumeGetTest method before.

@Before
public void before() throws Exception {
    factory = new AsyncRepositoryConnectorFactory(new SysoutLogger(), new TestFileProcessor());
    session = new TestRepositorySystemSession();
    artifact = new StubArtifact("gid", "aid", "classifier", "extension", "version");
    server = new Server(0);
}
Also used : TestRepositorySystemSession(org.sonatype.aether.test.impl.TestRepositorySystemSession) TestFileProcessor(org.sonatype.aether.test.impl.TestFileProcessor) Server(org.eclipse.jetty.server.Server) SysoutLogger(org.sonatype.aether.test.impl.SysoutLogger) StubArtifact(org.sonatype.aether.test.util.impl.StubArtifact) Before(org.junit.Before)

Example 9 with TestRepositorySystemSession

use of org.sonatype.aether.test.impl.TestRepositorySystemSession in project sonatype-aether by sonatype.

the class DefaultArtifactResolverTest method testResolveFromWorkspaceFallbackToRepository.

@Test
public void testResolveFromWorkspaceFallbackToRepository() throws IOException, ArtifactResolutionException {
    session = new TestRepositorySystemSession() {

        @Override
        public WorkspaceReader getWorkspaceReader() {
            return new WorkspaceReader() {

                public WorkspaceRepository getRepository() {
                    return new WorkspaceRepository("default");
                }

                public List<String> findVersions(Artifact artifact) {
                    return Arrays.asList(artifact.getVersion());
                }

                public File findArtifact(Artifact artifact) {
                    return null;
                }
            };
        }
    };
    connector.setExpectGet(artifact);
    remoteRepositoryManager.setConnector(connector);
    ArtifactRequest request = new ArtifactRequest(artifact, null, "");
    request.addRepository(new RemoteRepository("id", "default", "file:///"));
    ArtifactResult result = resolver.resolveArtifact(session, request);
    assertTrue("exception on resolveArtifact", result.getExceptions().isEmpty());
    Artifact resolved = result.getArtifact();
    assertNotNull(resolved.getFile());
    resolved = resolved.setFile(null);
    assertEquals(artifact, resolved);
    connector.assertSeenExpected();
}
Also used : TestRepositorySystemSession(org.sonatype.aether.test.impl.TestRepositorySystemSession) ArtifactRequest(org.sonatype.aether.resolution.ArtifactRequest) LocalArtifactRequest(org.sonatype.aether.repository.LocalArtifactRequest) WorkspaceRepository(org.sonatype.aether.repository.WorkspaceRepository) List(java.util.List) RemoteRepository(org.sonatype.aether.repository.RemoteRepository) WorkspaceReader(org.sonatype.aether.repository.WorkspaceReader) File(java.io.File) StubArtifact(org.sonatype.aether.test.util.impl.StubArtifact) Artifact(org.sonatype.aether.artifact.Artifact) LocalArtifactResult(org.sonatype.aether.repository.LocalArtifactResult) ArtifactResult(org.sonatype.aether.resolution.ArtifactResult) Test(org.junit.Test)

Example 10 with TestRepositorySystemSession

use of org.sonatype.aether.test.impl.TestRepositorySystemSession in project sonatype-aether by sonatype.

the class DefaultArtifactResolverTest method setup.

@Before
public void setup() throws IOException {
    UpdateCheckManager updateCheckManager = new StaticUpdateCheckManager(true);
    remoteRepositoryManager = new StubRemoteRepositoryManager();
    VersionResolver versionResolver = new StubVersionResolver();
    session = new TestRepositorySystemSession();
    lrm = (TestLocalRepositoryManager) session.getLocalRepositoryManager();
    resolver = new DefaultArtifactResolver(NullLogger.INSTANCE, TestFileProcessor.INSTANCE, new StubRepositoryEventDispatcher(), versionResolver, updateCheckManager, remoteRepositoryManager, new StubSyncContextFactory());
    artifact = new StubArtifact("gid", "aid", "", "ext", "ver");
    connector = new RecordingRepositoryConnector();
    remoteRepositoryManager.setConnector(connector);
}
Also used : TestRepositorySystemSession(org.sonatype.aether.test.impl.TestRepositorySystemSession) VersionResolver(org.sonatype.aether.impl.VersionResolver) UpdateCheckManager(org.sonatype.aether.impl.UpdateCheckManager) StubArtifact(org.sonatype.aether.test.util.impl.StubArtifact) Before(org.junit.Before)

Aggregations

TestRepositorySystemSession (org.sonatype.aether.test.impl.TestRepositorySystemSession)17 Before (org.junit.Before)14 RemoteRepository (org.sonatype.aether.repository.RemoteRepository)9 StubArtifact (org.sonatype.aether.test.util.impl.StubArtifact)6 File (java.io.File)5 Test (org.junit.Test)3 StubMetadata (org.sonatype.aether.test.util.impl.StubMetadata)3 DefaultArtifact (org.sonatype.aether.util.artifact.DefaultArtifact)3 DefaultMetadata (org.sonatype.aether.util.metadata.DefaultMetadata)3 List (java.util.List)2 Artifact (org.sonatype.aether.artifact.Artifact)2 UpdateCheckManager (org.sonatype.aether.impl.UpdateCheckManager)2 LocalArtifactRequest (org.sonatype.aether.repository.LocalArtifactRequest)2 LocalArtifactResult (org.sonatype.aether.repository.LocalArtifactResult)2 WorkspaceReader (org.sonatype.aether.repository.WorkspaceReader)2 WorkspaceRepository (org.sonatype.aether.repository.WorkspaceRepository)2 ArtifactRequest (org.sonatype.aether.resolution.ArtifactRequest)2 ArtifactResult (org.sonatype.aether.resolution.ArtifactResult)2 RecordingRepositoryListener (org.sonatype.aether.test.impl.RecordingRepositoryListener)2 SysoutLogger (org.sonatype.aether.test.impl.SysoutLogger)2