use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testEvictWithConf.
@Test
public void testEvictWithConf() throws Exception {
// bug 105 - test #1
// mod6.1 r1.0 depends on
// mod5.1 r4.2 conf A
// mod5.2 r1.0 which depends on mod5.1 r4.0 conf B
//
// 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.0.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org6", "mod6.1", "1.0");
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.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());
// should have been evicted before download
assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org5", "mod5.1", "4.0")).exists());
assertFalse(getArchiveFileInCache("org5", "mod5.1", "4.0", "art51A", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org5", "mod5.1", "4.0", "art51B", "jar", "jar").exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveMultipleConfsWithConflicts.
/**
* Test case for IVY-173.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-173">IVY-173</a>
*/
@Test
public void testResolveMultipleConfsWithConflicts() throws Exception {
// mod6.2 has two confs compile and run
// depends on mod1.2 2.1 in conf (compile->default)
// depends on mod1.1 1.0 in conf (*->default)
// depends on mod6.1 in conf (*->default)
// mod6.1
// depends on mod1.2 2.1
// mod1.1
// depends on mod1.2 2.0
ResolveReport report = ivy.resolve(new File("test/repositories/1/org6/mod6.2/ivys/ivy-0.5.xml"), getResolveOptions(new String[] { "compile", "run" }));
assertNotNull(report);
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org6", "mod6.2", "0.5");
assertEquals(mrid, md.getModuleRevisionId());
ConfigurationResolveReport crr = report.getConfigurationReport("compile");
assertNotNull(crr);
assertEquals(3, crr.getArtifactsNumber());
crr = report.getConfigurationReport("run");
assertNotNull(crr);
assertEquals(3, crr.getArtifactsNumber());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org6", "mod6.1", "0.5")).exists());
assertTrue(getArchiveFileInCache("org6", "mod6.1", "0.5", "mod6.1", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "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());
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 testResolveConflictInConf.
@Test
public void testResolveConflictInConf() throws Exception {
// conflicts in separate confs are not conflicts
// mod2.1 conf A depends on mod1.1 which depends on mod1.2 2.0
// mod2.1 conf B depends on mod1.2 2.1
ResolveReport report = ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.4.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.1", "0.4");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.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.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testMultiConfs.
@Test
public void testMultiConfs() throws Exception {
// mod 5.2 depends on mod5.1 conf B in its conf B and conf A in its conf A
// mod5.1 conf B publishes art51B
// mod5.1 conf A publishes art51A
ResolveReport report = ivy.resolve(new File("test/repositories/2/mod5.2/ivy-2.0.xml"), getResolveOptions(new String[] { "B", "A" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org5", "mod5.2", "2.0");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
ModuleRevisionId depId = ModuleRevisionId.newInstance("org5", "mod5.1", "4.1");
ConfigurationResolveReport crr = report.getConfigurationReport("A");
assertNotNull(crr);
assertEquals(1, crr.getDownloadReports(depId).length);
File r = new File(cache, ResolveOptions.getDefaultResolveId(mrid.getModuleId()) + "-A.xml");
assertTrue(r.exists());
final boolean[] found = new boolean[] { false };
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
saxParser.parse(r, new DefaultHandler() {
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) {
if ("artifact".equals(qName) && "art51B".equals(attributes.getValue("name"))) {
found[0] = true;
}
}
});
assertFalse(found[0]);
assertTrue(getIvyFileInCache(depId).exists());
assertTrue(getArchiveFileInCache("org5", "mod5.1", "4.1", "art51A", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("org5", "mod5.1", "4.1", "art51B", "jar", "jar").exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveTransitiveDependenciesWithOverrideAndDynamicResolveMode.
/**
* Test case for IVY-1131.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1131">IVY-1131</a>
*/
@Test
public void testResolveTransitiveDependenciesWithOverrideAndDynamicResolveMode() throws Exception {
// mod2.1 depends on mod1.1 which depends on mod1.2
ResolveReport report = ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.6.xml"), getResolveOptions(new String[] { "*" }).setResolveMode(ResolveOptions.RESOLVEMODE_DYNAMIC));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.1", "0.6");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "1.0", "mod1.2", "jar", "jar").exists());
}
Aggregations