Search in sources :

Example 11 with InstallRequest

use of org.sonatype.aether.installation.InstallRequest in project sonatype-aether by sonatype.

the class DefaultInstallerTest method testDoNotUpdateUnchangedArtifact.

@Test
public void testDoNotUpdateUnchangedArtifact() throws InstallationException {
    request.addArtifact(artifact);
    installer.install(session, request);
    installer.setFileProcessor(new DefaultFileProcessor() {

        @Override
        public long copy(File src, File target, ProgressListener listener) throws IOException {
            throw new IOException("copy called");
        }
    });
    request = new InstallRequest();
    request.addArtifact(artifact);
    installer.install(session, request);
}
Also used : InstallRequest(org.sonatype.aether.installation.InstallRequest) IOException(java.io.IOException) File(java.io.File) Test(org.junit.Test)

Example 12 with InstallRequest

use of org.sonatype.aether.installation.InstallRequest in project sonatype-aether by sonatype.

the class DefaultInstallerTest method checkFailedEvents.

private void checkFailedEvents(String msg, Artifact artifact) {
    InstallRequest request = new InstallRequest().addArtifact(artifact);
    msg = "Repository events problem (case: " + msg + ")";
    try {
        installer.install(session, request);
        fail("expected exception");
    } catch (InstallationException e) {
        checkEvents(msg, artifact, true);
    }
}
Also used : InstallRequest(org.sonatype.aether.installation.InstallRequest) InstallationException(org.sonatype.aether.installation.InstallationException)

Aggregations

InstallRequest (org.sonatype.aether.installation.InstallRequest)12 Test (org.junit.Test)6 File (java.io.File)3 RepositorySystemSession (org.sonatype.aether.RepositorySystemSession)2 Artifact (org.sonatype.aether.artifact.Artifact)2 InstallationException (org.sonatype.aether.installation.InstallationException)2 DefaultArtifact (org.sonatype.aether.util.artifact.DefaultArtifact)2 IOException (java.io.IOException)1 MavenRepositorySystemSession (org.apache.maven.repository.internal.MavenRepositorySystemSession)1 Before (org.junit.Before)1 RepositorySystem (org.sonatype.aether.RepositorySystem)1 RecordingRepositoryListener (org.sonatype.aether.test.impl.RecordingRepositoryListener)1 TestRepositorySystemSession (org.sonatype.aether.test.impl.TestRepositorySystemSession)1 SubArtifact (org.sonatype.aether.util.artifact.SubArtifact)1 DefaultMetadata (org.sonatype.aether.util.metadata.DefaultMetadata)1