use of org.sonatype.aether.util.metadata.DefaultMetadata in project sonatype-aether by sonatype.
the class EnhancedLocalRepositoryManagerTest method setup.
@Before
public void setup() throws Exception {
repository = new RemoteRepository("enhanced-remote-repo", "default", TestFileUtils.createTempDir("enhanced-remote-repo").toURI().toURL().toString());
repository.setRepositoryManager(true);
artifact = new DefaultArtifact("gid", "aid", "", "jar", "1-test", Collections.<String, String>emptyMap(), TestFileUtils.createTempFile("artifact"));
metadata = new DefaultMetadata("gid", "aid", "1-test", "maven-metadata.xml", Nature.RELEASE, TestFileUtils.createTempFile("metadata"));
noVerMetadata = new DefaultMetadata("gid", "aid", null, "maven-metadata.xml", Nature.RELEASE, TestFileUtils.createTempFile("metadata"));
basedir = TestFileUtils.createTempDir("enhanced-repo");
manager = new EnhancedLocalRepositoryManager(basedir);
artifactFile = new File(basedir, manager.getPathForLocalArtifact(artifact));
session = new TestRepositorySystemSession();
}
use of org.sonatype.aether.util.metadata.DefaultMetadata in project sonatype-aether by sonatype.
the class DefaultDeployerTest method setup.
@Before
public void setup() throws IOException {
artifact = new DefaultArtifact("gid", "aid", "jar", "ver");
artifact = artifact.setFile(TestFileUtils.createTempFile("artifact"));
metadata = new DefaultMetadata("gid", "aid", "ver", "type", Nature.RELEASE_OR_SNAPSHOT, TestFileUtils.createTempFile("metadata"));
session = new TestRepositorySystemSession();
manager = new StubRemoteRepositoryManager();
deployer = new DefaultDeployer();
deployer.setRemoteRepositoryManager(manager);
deployer.setRepositoryEventDispatcher(new StubRepositoryEventDispatcher());
UpdateCheckManager updateCheckManager = new StaticUpdateCheckManager(true);
deployer.setUpdateCheckManager(updateCheckManager);
deployer.setFileProcessor(TestFileProcessor.INSTANCE);
deployer.setSyncContextFactory(new StubSyncContextFactory());
request = new DeployRequest();
request.setRepository(new RemoteRepository("id", "default", "file:///"));
connector = new RecordingRepositoryConnector();
manager.setConnector(connector);
listener = new RecordingRepositoryListener();
session.setRepositoryListener(listener);
}
use of org.sonatype.aether.util.metadata.DefaultMetadata 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.util.metadata.DefaultMetadata in project sonatype-aether by sonatype.
the class ArtifactWorkerTest method testMetadataTransfer.
@Test
public void testMetadataTransfer() throws IOException, MetadataTransferException {
String expectedContent = "Dies ist ein Test.";
File srcFile = TestFileUtils.createTempFile(expectedContent);
DefaultMetadata metadata = new DefaultMetadata("test", "artId1", "1", "jar", Nature.RELEASE_OR_SNAPSHOT);
MetadataUpload up = new MetadataUpload(metadata, srcFile);
FileRepositoryWorker worker = new FileRepositoryWorker(up, repository, session);
worker.setFileProcessor(TestFileProcessor.INSTANCE);
worker.run();
if (up.getException() != null) {
throw up.getException();
}
File targetFile = TestFileUtils.createTempFile("");
TestFileUtils.delete(targetFile);
MetadataDownload down = new MetadataDownload();
down.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_FAIL);
down.setMetadata(metadata).setFile(targetFile);
worker = new FileRepositoryWorker(down, repository, session);
worker.setFileProcessor(TestFileProcessor.INSTANCE);
worker.run();
if (down.getException() != null) {
throw down.getException();
}
assertTrue("download did not happen.", targetFile.exists());
assertContentEquals(targetFile, expectedContent);
}
Aggregations