use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveMultipleExtends2.
@Test
public void testResolveMultipleExtends2() throws Exception {
// same as before, except that mod6.2 depends on mod1.2 2.1 extension->default
// so mod1.2 2.0 should be evicted in conf extension
ResolveReport report = ivy.resolve(new File("test/repositories/1/org6/mod6.2/ivys/ivy-0.4.xml"), getResolveOptions(new String[] { "default", "extension" }));
assertNotNull(report);
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org6", "mod6.2", "0.4");
assertEquals(mrid, md.getModuleRevisionId());
ConfigurationResolveReport crr = report.getConfigurationReport("default");
assertNotNull(crr);
assertEquals(2, crr.getArtifactsNumber());
IvyNode node = crr.getDependency(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"));
assertNotNull(node);
assertFalse(node.isEvicted("default"));
crr = report.getConfigurationReport("extension");
assertNotNull(crr);
assertEquals(2, crr.getArtifactsNumber());
node = crr.getDependency(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"));
assertNotNull(node);
assertTrue(node.isEvicted("extension"));
node = crr.getDependency(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1"));
assertNotNull(node);
assertFalse(node.isEvicted("extension"));
assertTrue(getResolvedIvyFileInCache(mrid).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org6", "mod6.1", "0.4")).exists());
assertTrue(getArchiveFileInCache("org6", "mod6.1", "0.4", "mod6.1", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class LatestCompatibleConflictManagerTest method resolveAndAssert.
private void resolveAndAssert(String mrid, String expectedModuleSet) throws ParseException, IOException {
ResolveReport report = fixture.resolve(mrid);
assertFalse(report.hasError());
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
TestHelper.assertModuleRevisionIds(expectedModuleSet, defaultReport.getModuleRevisionIds());
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class LatestConflictManagerTest method testLatestTime2.
@Test
public void testLatestTime2() throws Exception {
ivy = new Ivy();
ivy.configure(LatestConflictManagerTest.class.getResource("ivysettings-latest-time.xml"));
ivy.getSettings().setVariable("ivy.log.conflict.resolution", "true", true);
// set timestamps, because svn is not preserving this information,
// and the latest time strategy is relying on it
long time = System.currentTimeMillis() - 10000;
new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar").setLastModified(time);
new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.2.jar").setLastModified(time + 2000);
ResolveReport report = ivy.resolve(LatestConflictManagerTest.class.getResource("ivy-latest-time-2.xml"), getResolveOptions());
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
if (mrid.getName().equals("mod1.1")) {
assertEquals("1.0", mrid.getRevision());
} else if (mrid.getName().equals("mod1.2")) {
assertEquals("2.2", mrid.getRevision());
}
}
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class LatestConflictManagerTest method testLatestTime1.
/**
* Test case for IVY-407.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-407">IVY-407</a>
*/
@Test
public void testLatestTime1() throws Exception {
ivy = new Ivy();
ivy.configure(LatestConflictManagerTest.class.getResource("ivysettings-latest-time.xml"));
ivy.getSettings().setVariable("ivy.log.conflict.resolution", "true", true);
// set timestamps, because svn is not preserving this information,
// and the latest time strategy is relying on it
long time = System.currentTimeMillis() - 10000;
new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar").setLastModified(time);
new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.2.jar").setLastModified(time + 2000);
ResolveReport report = ivy.resolve(LatestConflictManagerTest.class.getResource("ivy-latest-time-1.xml"), getResolveOptions());
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
if (mrid.getName().equals("mod1.1")) {
assertEquals("1.0", mrid.getRevision());
} else if (mrid.getName().equals("mod1.2")) {
assertEquals("2.2", mrid.getRevision());
}
}
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class IvyCacheTask method getAllArtifactReports.
private Collection<ArtifactDownloadReport> getAllArtifactReports() throws ParseException {
String[] confs = splitToArray(getConf());
Collection<ArtifactDownloadReport> all = new LinkedHashSet<>();
ResolveReport report = getResolvedReport();
if (report != null) {
Message.debug("using internal report instance to get artifacts list");
for (String conf : confs) {
ConfigurationResolveReport configurationReport = report.getConfigurationReport(conf);
if (configurationReport == null) {
throw new BuildException("bad confs provided: " + conf + " not found among " + Arrays.asList(report.getConfigurations()));
}
for (ModuleRevisionId revId : configurationReport.getModuleRevisionIds()) {
all.addAll(Arrays.asList(configurationReport.getDownloadReports(revId)));
}
}
} else {
Message.debug("using stored report to get artifacts list");
XmlReportParser parser = new XmlReportParser();
ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
String resolvedId = getResolveId();
if (resolvedId == null) {
resolvedId = ResolveOptions.getDefaultResolveId(getResolvedModuleId());
}
for (String conf : confs) {
File reportFile = cacheMgr.getConfigurationResolveReportInCache(resolvedId, conf);
parser.parse(reportFile);
all.addAll(Arrays.asList(parser.getArtifactReports()));
}
}
return all;
}
Aggregations