use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveTransitiveDependenciesWithOverride.
@Test
public void testResolveTransitiveDependenciesWithOverride() 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[] { "*" }));
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());
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testNamespaceMapping4.
@Test
public void testNamespaceMapping4() throws Exception {
// same as 2 but with incorrect dependency asked: the first ivy file asks for a dependency
// in the resolver namespace and not the system one: this should fail
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/namespace/ivysettings.xml"));
ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-namespace4.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("apache", "namespace", "4.0");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(report.hasError());
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testExtraAttributes.
@Test
public void testExtraAttributes() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/extra-attributes/ivysettings.xml"));
ivy.getSettings().setDefaultCache(cache);
FileSystemResolver fResolver = (FileSystemResolver) ivy.getSettings().getDefaultResolver();
// important for testing IVY-929
fResolver.setCheckconsistency(false);
ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-extra-att.xml"), getResolveOptions(ivy.getSettings(), new String[] { "*" }).setValidate(false));
assertFalse(report.hasError());
assertTrue(new File(cache, "apache/mymodule/task1/1854/ivy.xml").exists());
assertTrue(new File(cache, "apache/mymodule/task1/1854/mymodule-windows.jar").exists());
assertTrue(new File(cache, "apache/mymodule/task1/1854/mymodule-linux.jar").exists());
Set<ModuleRevisionId> moduleRevisions = report.getConfigurationReport("default").getModuleRevisionIds();
assertEquals(1, moduleRevisions.size());
ModuleRevisionId resolveModRevId = moduleRevisions.iterator().next();
assertEquals("apache", resolveModRevId.getOrganisation());
assertEquals("mymodule", resolveModRevId.getName());
assertEquals("1854", resolveModRevId.getRevision());
assertEquals("task1", resolveModRevId.getExtraAttribute("eatt"));
assertEquals("another", resolveModRevId.getExtraAttribute("eatt2"));
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testLatest.
@Test
public void testLatest() throws Exception {
// mod1.4 depends on latest mod1.2
ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.1.xml"), getResolveOptions(new String[] { "default" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.4", "1.0.1");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
ModuleRevisionId depId = ModuleRevisionId.newInstance("org1", "mod1.2", "2.2");
ConfigurationResolveReport crr = report.getConfigurationReport("default");
assertNotNull(crr);
assertEquals(1, crr.getDownloadReports(depId).length);
File r = getConfigurationResolveReportInCache(ResolveOptions.getDefaultResolveId(mrid.getModuleId()), "default");
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) && "mod1.2".equals(attributes.getValue("name"))) {
found[0] = true;
}
}
});
assertTrue(found[0]);
assertTrue(getIvyFileInCache(depId).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveExtendedAndExtends.
@Test
public void testResolveExtendedAndExtends() throws Exception {
// mod6.1 depends on mod1.2 2.0 in conf default, and conf extension extends default
ResolveReport report = ivy.resolve(new File("test/repositories/1/org6/mod6.1/ivys/ivy-0.3.xml"), getResolveOptions(new String[] { "default", "extension" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org6", "mod6.1", "0.3");
assertEquals(mrid, md.getModuleRevisionId());
ConfigurationResolveReport crr = report.getConfigurationReport("default");
assertNotNull(crr);
assertEquals(1, crr.getArtifactsNumber());
crr = report.getConfigurationReport("extension");
assertNotNull(crr);
assertEquals(1, crr.getArtifactsNumber());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
Aggregations