use of org.sonatype.aether.installation.InstallRequest in project sonatype-aether by sonatype.
the class DefaultInstallerTest method testSuccessfulMetadataEvents.
@Test
public void testSuccessfulMetadataEvents() throws InstallationException {
InstallRequest request = new InstallRequest();
request.addMetadata(metadata);
installer.install(session, request);
checkEvents("Repository Event problem", metadata, false);
}
use of org.sonatype.aether.installation.InstallRequest in project sonatype-aether by sonatype.
the class DefaultInstallerTest method setup.
@Before
public void setup() throws IOException {
artifact = new DefaultArtifact("gid", "aid", "jar", "ver");
artifact = artifact.setFile(TestFileUtils.createTempFile("artifact".getBytes(), 1));
metadata = new DefaultMetadata("gid", "aid", "ver", "type", Nature.RELEASE_OR_SNAPSHOT, TestFileUtils.createTempFile("metadata".getBytes(), 1));
session = new TestRepositorySystemSession();
localArtifactPath = session.getLocalRepositoryManager().getPathForLocalArtifact(artifact);
localMetadataPath = session.getLocalRepositoryManager().getPathForLocalMetadata(metadata);
localArtifactFile = new File(session.getLocalRepository().getBasedir(), localArtifactPath);
installer = new DefaultInstaller();
installer.setFileProcessor(TestFileProcessor.INSTANCE);
installer.setRepositoryEventDispatcher(new StubRepositoryEventDispatcher());
installer.setSyncContextFactory(new StubSyncContextFactory());
request = new InstallRequest();
listener = new RecordingRepositoryListener();
session.setRepositoryListener(listener);
lrm = (TestLocalRepositoryManager) session.getLocalRepositoryManager();
TestFileUtils.delete(session.getLocalRepository().getBasedir());
}
use of org.sonatype.aether.installation.InstallRequest in project sonatype-aether by sonatype.
the class DefaultInstallerTest method testNullArtifactFile.
@Test(expected = InstallationException.class)
public void testNullArtifactFile() throws InstallationException {
InstallRequest request = new InstallRequest();
request.addArtifact(artifact.setFile(null));
installer.install(session, request);
}
use of org.sonatype.aether.installation.InstallRequest in project sonatype-aether by sonatype.
the class DefaultInstallerTest method checkFailedEvents.
private void checkFailedEvents(String msg, Metadata metadata) {
InstallRequest request = new InstallRequest().addMetadata(metadata);
msg = "Repository events problem (case: " + msg + ")";
try {
installer.install(session, request);
fail("expected exception");
} catch (InstallationException e) {
checkEvents(msg, metadata, true);
}
}
use of org.sonatype.aether.installation.InstallRequest in project sonatype-aether by sonatype.
the class DefaultInstallerTest method testSetArtifactTimestamps.
@Test
public void testSetArtifactTimestamps() throws InstallationException {
artifact.getFile().setLastModified(artifact.getFile().lastModified() - 60000);
request.addArtifact(artifact);
installer.install(session, request);
assertEquals("artifact timestamp was not set to src file", artifact.getFile().lastModified(), localArtifactFile.lastModified());
request = new InstallRequest();
request.addArtifact(artifact);
artifact.getFile().setLastModified(artifact.getFile().lastModified() - 60000);
installer.install(session, request);
assertEquals("artifact timestamp was not set to src file", artifact.getFile().lastModified(), localArtifactFile.lastModified());
}
Aggregations