use of org.apache.ivy.core.resolve.ResolvedModuleRevision 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.resolve.ResolvedModuleRevision 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.resolve.ResolvedModuleRevision in project ant-ivy by apache.
the class OBRResolverTest method genericTestResolveDownload.
private void genericTestResolveDownload(DependencyResolver resolver, ModuleRevisionId mrid) throws ParseException {
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
assertNotNull(rmr);
assertEquals(mrid, rmr.getId());
Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0];
DownloadReport report = resolver.download(new Artifact[] { artifact }, new DownloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
ArtifactDownloadReport ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
// test to ask to download again, should use cache
report = resolver.download(new Artifact[] { artifact }, new DownloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
}
use of org.apache.ivy.core.resolve.ResolvedModuleRevision in project ant-ivy by apache.
the class P2DescriptorTest method testResolveZipped.
@Test
public void testResolveZipped() throws Exception {
settings.setDefaultResolver("p2-zipped");
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE, "org.apache.ant", "1.8.3.v20120321-1730");
ResolvedModuleRevision rmr = p2ZippedResolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
assertNotNull(rmr);
assertEquals(mrid, rmr.getId());
assertEquals(2, rmr.getDescriptor().getAllArtifacts().length);
DownloadOptions options = new DownloadOptions();
DownloadReport report = p2ZippedResolver.download(rmr.getDescriptor().getAllArtifacts(), options);
assertNotNull(report);
assertEquals(2, report.getArtifactsReports().length);
for (int i = 0; i < 2; i++) {
Artifact artifact = rmr.getDescriptor().getAllArtifacts()[i];
ArtifactDownloadReport ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
// only the binary get unpacked
if (ar.getArtifact().getType().equals("source")) {
assertNull(ar.getUnpackedLocalFile());
} else {
assertNotNull(ar.getUnpackedLocalFile());
}
}
}
use of org.apache.ivy.core.resolve.ResolvedModuleRevision in project ant-ivy by apache.
the class UpdateSiteAndIbiblioResolverTest method testArtifactRef.
@Test
public void testArtifactRef() throws ParseException {
// Simple Dependency for ibiblio
ModuleRevisionId mrid1 = ModuleRevisionId.newInstance("log4j", "log4j", "1.2.16");
ResolvedModuleRevision rmr1 = chain.getDependency(new DefaultDependencyDescriptor(mrid1, false), data);
// Simple Dependency for updatesite
ModuleRevisionId mrid2 = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE, "org.apache.ivy", "2.0.0.final_20090108225011");
ResolvedModuleRevision rmr2 = chain.getDependency(new DefaultDependencyDescriptor(mrid2, false), data);
assertNotNull(rmr1);
assertNotNull(rmr2);
Artifact[] artifacts1 = rmr1.getDescriptor().getArtifacts("default");
Artifact[] artifacts2 = rmr2.getDescriptor().getArtifacts("default");
chain.exists(artifacts2[0]);
chain.exists(artifacts1[0]);
}
Aggregations