use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveMultipleSameDependency.
@Test
public void testResolveMultipleSameDependency() throws Exception {
ResolveReport report = ivy.resolve(new File("test/repositories/1/multiple-same-deps/mod1/ivys/ivy-1.0.xml"), getResolveOptions(new String[] { "*" }));
assertTrue(getArchiveFileInCache("multiple-same-deps", "mod31", "1.0", "mod31", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("multiple-same-deps", "mod32", "1.0", "mod32", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("multiple-same-deps", "mod33", "1.0", "mod33", "jar", "jar").exists());
ConfigurationResolveReport runtimeReport = report.getConfigurationReport("runtime");
runtimeReport.getModuleRevisionIds().contains(ModuleRevisionId.parse("multiple-same-deps#mod31;1.0"));
runtimeReport.getModuleRevisionIds().contains(ModuleRevisionId.parse("multiple-same-deps#mod32;1.0"));
runtimeReport.getModuleRevisionIds().contains(ModuleRevisionId.parse("multiple-same-deps#mod33;1.0"));
ConfigurationResolveReport compileReport = report.getConfigurationReport("compile");
compileReport.getModuleRevisionIds().contains(ModuleRevisionId.parse("multiple-same-deps#mod31;1.0"));
compileReport.getModuleRevisionIds().contains(ModuleRevisionId.parse("multiple-same-deps#mod32;1.0"));
compileReport.getModuleRevisionIds().contains(ModuleRevisionId.parse("multiple-same-deps#mod33;1.0"));
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveModeDynamic1.
@Test
public void testResolveModeDynamic1() throws Exception {
// mod1.1;1.0.1 -> mod1.2;2.0|latest.integration
ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.1.xml"), getResolveOptions(new String[] { "default" }).setResolveMode(ResolveOptions.RESOLVEMODE_DYNAMIC));
assertNotNull(report);
ModuleRevisionId depId = ModuleRevisionId.newInstance("org1", "mod1.2", "2.2");
ConfigurationResolveReport crr = report.getConfigurationReport("default");
assertEquals(1, crr.getDownloadReports(depId).length);
assertTrue(getIvyFileInCache(depId).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveModeDefaultOverrideSettings.
@Test
public void testResolveModeDefaultOverrideSettings() throws Exception {
// same as ResolveModeDynamic2, but resolve mode is set in settings, and overridden when
// calling resolve
Map<String, String> attributes = new HashMap<>();
attributes.put("organisation", "org1");
attributes.put("module", "mod1.2");
ivy.getSettings().addModuleConfiguration(attributes, ExactPatternMatcher.INSTANCE, null, null, null, ResolveOptions.RESOLVEMODE_DYNAMIC);
ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.1.xml"), getResolveOptions(new String[] { "default" }).setResolveMode(ResolveOptions.RESOLVEMODE_DEFAULT));
assertNotNull(report);
ModuleRevisionId depId = ModuleRevisionId.newInstance("org1", "mod1.2", "2.0");
ConfigurationResolveReport crr = report.getConfigurationReport("default");
assertEquals(1, crr.getDownloadReports(depId).length);
assertTrue(getIvyFileInCache(depId).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveSeveralDefaultWithArtifactsAndConfs.
/**
* Test case for IVY-283.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-283">IVY-283</a>
*/
@Test
public void testResolveSeveralDefaultWithArtifactsAndConfs() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/IVY-283/ivysettings.xml"));
ResolveReport report = ivy.resolve(new File("test/repositories/IVY-283/ivy.xml"), getResolveOptions(new String[] { "*" }));
assertFalse(report.hasError());
// dependencies
ConfigurationResolveReport crr = report.getConfigurationReport("build");
assertNotNull(crr);
assertEquals(3, crr.getDownloadReports(ModuleRevisionId.newInstance("medicel", "C", "1.0")).length);
assertTrue(getArchiveFileInCache(ivy, "medicel", "C", "1.0", "lib_c_a", "jar", "jar").exists());
assertTrue(getArchiveFileInCache(ivy, "medicel", "C", "1.0", "lib_c_b", "jar", "jar").exists());
assertTrue(getArchiveFileInCache(ivy, "medicel", "C", "1.0", "lib_c_d", "jar", "jar").exists());
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testTransitiveEvictionWithExtendingConf.
/**
* Test case for IVY-590.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-590">IVY-590</a>
*/
@Test
public void testTransitiveEvictionWithExtendingConf() throws Exception {
ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-590.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
// test eviction
ConfigurationResolveReport compileReport = report.getConfigurationReport("compile");
IvyNode[] evicted = compileReport.getEvictedNodes();
assertNotNull(evicted);
Collection<ModuleRevisionId> evictedModules = new ArrayList<>();
for (IvyNode anEvicted : evicted) {
evictedModules.add(anEvicted.getId());
}
assertTrue(evictedModules.contains(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")));
}
Aggregations