use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testEvictWithConfInMultiConf2.
@Test
public void testEvictWithConfInMultiConf2() throws Exception {
// same as preceding one but the conflict appears in a root conf and not in another
// which should keep the evicted
// bug 105 - test #4
// mod6.1 r1.3 conf A depends on
// mod5.2 r1.0 which depends on mod5.1 r4.0 conf B
//
// mod6.1 r1.3 conf B depends on
// mod5.2 r1.0 which depends on mod5.1 r4.0 conf B
// mod5.1 r4.2 conf A
//
// mod5.1 r4.2 conf B depends on mod1.2 r2.0
ResolveReport report = ivy.resolve(new File("test/repositories/2/mod6.1/ivy-1.3.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org6", "mod6.1", "1.3");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org5", "mod5.1", "4.2")).exists());
assertTrue(getArchiveFileInCache("org5", "mod5.1", "4.2", "art51A", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("org5", "mod5.1", "4.2", "art51B", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org5", "mod5.1", "4.0")).exists());
assertTrue(getArchiveFileInCache("org5", "mod5.1", "4.0", "art51A", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("org5", "mod5.1", "4.0", "art51B", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org5", "mod5.2", "1.0")).exists());
assertTrue(getArchiveFileInCache("org5", "mod5.2", "1.0", "mod5.2", "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());
// 4.2 artifacts should be present in conf B only
ConfigurationResolveReport crr = report.getConfigurationReport("A");
assertNotNull(crr);
assertEquals(0, crr.getDownloadReports(ModuleRevisionId.newInstance("org5", "mod5.1", "4.2")).length);
crr = report.getConfigurationReport("B");
assertNotNull(crr);
assertEquals(2, crr.getDownloadReports(ModuleRevisionId.newInstance("org5", "mod5.1", "4.2")).length);
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveForceWithDynamicRevisionsAndSeveralConfs2.
@Test
public void testResolveForceWithDynamicRevisionsAndSeveralConfs2() throws Exception {
// mod4.1 v 4.7 (conf compile, test extends compile) depends on
// - mod1.2 v 1+ and forces it in conf compile
// - mod3.1 v 1.3 in conf test->runtime
// which defines confs compile, runtime extends compile
// which depends on mod1.2 v 2+ in conf compile->default
ResolveReport report = ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.7.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org4", "mod4.1", "4.7");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org3", "mod3.1", "1.3")).exists());
assertTrue(getArchiveFileInCache("org3", "mod3.1", "1.3", "mod3.1", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "1.1")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "1.1", "mod1.2", "jar", "jar").exists());
assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2")).exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveExcludesModuleWide.
@Test
public void testResolveExcludesModuleWide() throws Exception {
// mod2.6 depends on mod2.1 and excludes mod1.1 module wide
// mod2.1 depends on mod1.1 which depends on mod1.2
ResolveReport report = ivy.resolve(new File("test/repositories/1/org2/mod2.6/ivys/ivy-0.11.xml"), getResolveOptions(new String[] { "*" }));
ModuleDescriptor md = report.getModuleDescriptor();
assertEquals(ModuleRevisionId.newInstance("org2", "mod2.6", "0.11"), md.getModuleRevisionId());
assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertFalse(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveMaven2ClassifiersWithoutPOM.
/**
* Test case for IVY-1041.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1041">IVY-1041</a>
*/
@Test
public void testResolveMaven2ClassifiersWithoutPOM() throws Exception {
// test-classifier depends on test-classified with classifier asl
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
ResolveReport report = ivy.resolve(new File("test/repositories/m2/org/apache/test-classifier/2.0/test-classifier-2.0.pom"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test-classifier", "2.0");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test-classified", "2.0")).exists());
Map<String, String> cmap = new HashMap<>();
cmap.put("classifier", "asl");
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test-classified", /* branch */
null, "2.0", "test-classified", "jar", "jar", cmap).exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testIVY1159_orderIsModBModAReplaceForced.
/**
* Test case for IVY-1159.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1159">IVY-1159</a>
*/
@Test
public void testIVY1159_orderIsModBModAReplaceForced() throws Exception {
testIVY1159("ivy-depsorder_modB_then_modA.xml", true);
File deliveredIvyFile = new File("build/test/deliver/ivy-1.xml");
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(ivy.getSettings(), deliveredIvyFile.toURI().toURL(), false);
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(2, dds.length);
assertEquals(ModuleRevisionId.newInstance("myorg", "modB", "1"), dds[0].getDependencyRevisionId());
assertEquals(ModuleRevisionId.newInstance("myorg", "modA", "1"), dds[1].getDependencyRevisionId());
}
Aggregations