use of org.apache.ivy.core.module.descriptor.Artifact in project ant-ivy by apache.
the class P2DescriptorTest method testResolvePacked.
@Test
public void testResolvePacked() throws Exception {
settings.setDefaultResolver("p2-with-packed");
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE, "org.junit", "4.10.0.v4_10_0_v20120426-0900");
ResolvedModuleRevision rmr = p2WithPackedResolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
assertNotNull(rmr);
assertEquals(mrid, rmr.getId());
assertEquals(1, rmr.getDescriptor().getAllArtifacts().length);
DownloadOptions options = new DownloadOptions();
DownloadReport report = p2WithPackedResolver.download(rmr.getDescriptor().getAllArtifacts(), options);
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0];
ArtifactDownloadReport ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
assertNotNull(ar.getUnpackedLocalFile());
}
use of org.apache.ivy.core.module.descriptor.Artifact in project ant-ivy by apache.
the class P2DescriptorTest method testResolveNotZipped.
@Test
public void testResolveNotZipped() throws Exception {
settings.setDefaultResolver("p2-zipped");
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE, "org.eclipse.e4.core.services", "1.0.0.v20120521-2346");
ResolvedModuleRevision rmr = p2ZippedResolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
assertNotNull(rmr);
assertEquals(mrid, rmr.getId());
assertEquals(1, rmr.getDescriptor().getAllArtifacts().length);
DownloadOptions options = new DownloadOptions();
DownloadReport report = p2ZippedResolver.download(rmr.getDescriptor().getAllArtifacts(), options);
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0];
ArtifactDownloadReport ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
assertNull(ar.getUnpackedLocalFile());
}
use of org.apache.ivy.core.module.descriptor.Artifact in project ant-ivy by apache.
the class NameSpaceHelperTest method testTransformArtifactWithExtraAttributes.
@Test
public void testTransformArtifactWithExtraAttributes() {
Artifact artifact = new DefaultArtifact(ArtifactRevisionId.newInstance(ModuleRevisionId.parse("org.apache#test;1.0"), "test", "jar", "jar", Collections.singletonMap("m:qualifier", "sources")), new Date(), null, false);
MRIDTransformationRule r = new MRIDTransformationRule();
r.addSrc(new MRIDRule("org.apache", "test", null));
r.addDest(new MRIDRule("apache", "test", null));
Artifact transformed = NameSpaceHelper.transform(artifact, r);
assertEquals("apache#test;1.0", transformed.getModuleRevisionId().toString());
assertEquals(Collections.singletonMap("m:qualifier", "sources"), transformed.getQualifiedExtraAttributes());
}
use of org.apache.ivy.core.module.descriptor.Artifact in project gradle by gradle.
the class DefaultArtifactPomTest method cannotAddMultipleArtifactsWithTheSameTypeAndClassifier.
@Test
public void cannotAddMultipleArtifactsWithTheSameTypeAndClassifier() {
// No classifier
Artifact mainArtifact = createTestArtifact("someName", null);
artifactPom.addArtifact(mainArtifact, new File("someFile"));
assertIsDuplicate(mainArtifact, new File("someFile"));
assertIsDuplicate(mainArtifact, new File("otherFile"));
assertIsDuplicate(createTestArtifact("otherName", null), new File("otherFile"));
// Classifier
Artifact classifierArtifact = createTestArtifact("someName", "classifier");
artifactPom.addArtifact(classifierArtifact, new File("classifierFile"));
assertIsDuplicate(classifierArtifact, new File("someFile"));
assertIsDuplicate(classifierArtifact, new File("otherFile"));
assertIsDuplicate(createTestArtifact("otherName", "classifier"), new File("otherFile"));
}
use of org.apache.ivy.core.module.descriptor.Artifact in project gradle by gradle.
the class DefaultArtifactPomTest method pomWithMainArtifactAndMetadataArtifacts.
@Test
public void pomWithMainArtifactAndMetadataArtifacts() {
Artifact mainArtifact = createTestArtifact("someName", null, "mainPackaging");
File mainFile = new File("someFile");
File metadataFile = new File("someMetadataFile");
Artifact metadataArtifact = createTestArtifact("otherName", null, "sometype");
artifactPom.addArtifact(mainArtifact, mainFile);
artifactPom.addArtifact(metadataArtifact, metadataFile);
assertThat(artifactPom.getArtifact().getName(), equalTo("someName"));
assertThat(artifactPom.getArtifact().getExtension(), equalTo("mainPackaging"));
assertThat(artifactPom.getArtifact().getType(), equalTo("mainPackaging"));
assertThat(artifactPom.getArtifact().getClassifier(), nullValue());
assertThat(artifactPom.getArtifact().getFile(), equalTo(mainFile));
PublishArtifact artifact = singleItem(artifactPom.getAttachedArtifacts());
assertThat(artifact.getName(), equalTo("someName"));
assertThat(artifact.getExtension(), equalTo("sometype"));
assertThat(artifact.getType(), equalTo("sometype"));
assertThat(artifact.getClassifier(), nullValue());
assertThat(artifact.getFile(), equalTo(metadataFile));
assertThat(artifactPom.getPom().getGroupId(), equalTo("org"));
assertThat(artifactPom.getPom().getArtifactId(), equalTo("someName"));
assertThat(artifactPom.getPom().getVersion(), equalTo("1.0"));
assertThat(artifactPom.getPom().getPackaging(), equalTo("mainPackaging"));
}
Aggregations