use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testIVY1333.
/**
* Test case for IVY-1333.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1333">IVY-1333</a>
*/
@Test
public void testIVY1333() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/IVY-1333/ivysettings.xml"));
ivy.getSettings().setDefaultCache(cache);
ResolveReport rr = ivy.resolve(new File("test/repositories/IVY-1333/ivy.xml"), getResolveOptions(new String[] { "*" }));
ConfigurationResolveReport crr = rr.getConfigurationReport("default");
Set<ModuleRevisionId> modRevIds = crr.getModuleRevisionIds();
assertEquals(3, modRevIds.size());
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("org", "dep1", "1.0")));
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("org", "dep2", "1.0")));
Map<String, String> extra = new HashMap<>();
extra.put("o:a", "58701");
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("org", "badArtifact", "1.0.0.m4", extra)));
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testTransitiveConfMapping.
/**
* Test case for IVY-168.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-168">IVY-168</a>
*/
@Test
public void testTransitiveConfMapping() throws Exception {
// mod13.3 depends on mod13.2 which depends on mod13.1
// each module has two confs: j2ee and compile
// each module only publishes one artifact in conf compile
// each module has the following conf mapping on its dependencies: *->@
// moreover, mod13.1 depends on mod1.2 in with the following conf mapping: compile->default
// thus conf j2ee should be empty for each modules
ResolveReport report = ivy.resolve(new File("test/repositories/2/mod13.3/ivy-1.0.xml"), getResolveOptions(new String[] { "*" }));
assertFalse(report.hasError());
assertEquals(3, report.getConfigurationReport("compile").getArtifactsNumber());
assertEquals(0, report.getConfigurationReport("j2ee").getArtifactsNumber());
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testExtraAttributesMultipleDependenciesHang2.
@Test
public void testExtraAttributesMultipleDependenciesHang2() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/extra-attributes-multipledependencies/ivysettings-filerepo-attribs.xml"));
ivy.getSettings().setDefaultCache(cache);
ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-extra-att-multipledependencies2.xml"), getResolveOptions(ivy.getSettings(), new String[] { "*" }).setValidate(false));
assertFalse(report.hasError());
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testUnpack.
@Test
public void testUnpack() throws Exception {
ResolveOptions options = getResolveOptions(new String[] { "*" });
URL url = new File("test/repositories/1/packaging/module1/ivys/ivy-1.0.xml").toURI().toURL();
// normal resolve, the file goes in the cache
ResolveReport report = ivy.resolve(url, options);
assertFalse(report.hasError());
ArtifactDownloadReport adr = report.getAllArtifactsReports()[0];
File cacheDir = ivy.getSettings().getDefaultRepositoryCacheBasedir();
assertEquals(new File(cacheDir, "packaging/module2/jars/module2-1.0.jar"), adr.getLocalFile());
assertEquals(new File(cacheDir, "packaging/module2/jar_unpackeds/module2-1.0"), adr.getUnpackedLocalFile());
File[] jarContents = adr.getUnpackedLocalFile().listFiles();
Arrays.sort(jarContents);
assertEquals(new File(adr.getUnpackedLocalFile(), "META-INF"), jarContents[0]);
assertEquals(new File(adr.getUnpackedLocalFile(), "test.txt"), jarContents[1]);
assertEquals(new File(adr.getUnpackedLocalFile(), "META-INF/MANIFEST.MF"), jarContents[0].listFiles()[0]);
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveMultipleConfsWithLatest.
/**
* Test case for IVY-188.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-188">IVY-188</a>
*/
@Test
public void testResolveMultipleConfsWithLatest() throws Exception {
// mod6.2 has two confs compile and run
// depends on mod6.1 in conf (compile->default)
// depends on mod1.2 latest (which is 2.2) in conf (run->default)
// mod6.1
// depends on mod1.2 2.2
ResolveReport report = ivy.resolve(new File("test/repositories/1/org6/mod6.2/ivys/ivy-0.6.xml"), getResolveOptions(new String[] { "compile", "run" }));
assertNotNull(report);
assertFalse(report.hasError());
ConfigurationResolveReport crr = report.getConfigurationReport("compile");
assertNotNull(crr);
assertEquals(2, crr.getArtifactsNumber());
crr = report.getConfigurationReport("run");
assertNotNull(crr);
assertEquals(1, crr.getArtifactsNumber());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
}
Aggregations