use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class ResolveTest method testResolveMaven2Snapshot1.
/**
* Test case for IVY-501.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-501">IVY-501</a>
*/
@Test
public void testResolveMaven2Snapshot1() throws Exception {
// here we test maven SNAPSHOT versions handling,
// with m2 snapshotRepository/uniqueVersion set to true
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
ResolveReport report = ivy.resolve(new File("test/repositories/m2/org/apache/test4/1.0/test4-1.0.pom"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
assertFalse(report.hasError());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test-SNAPSHOT1", "2.0.2-SNAPSHOT")).exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test-SNAPSHOT1", "2.0.2-SNAPSHOT", "test-SNAPSHOT1", "jar", "jar").exists());
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class ResolveTest method testBug148.
@Test
public void testBug148() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/bug148/ivysettings.xml"));
ivy.getSettings().setDefaultCache(cache);
ivy.resolve(ResolveTest.class.getResource("ivy-148.xml"), getResolveOptions(new String[] { "*" }));
assertTrue(new File("build/cache/jtv-foo/bar/ivy-1.1.0.0.xml").exists());
assertTrue(new File("build/cache/jtv-foo/bar/jars/bar-1.1.0.0.jar").exists());
assertTrue(new File("build/cache/idautomation/barcode/ivy-4.10.xml").exists());
assertTrue(new File("build/cache/idautomation/barcode/jars/LinearBarCode-4.10.jar").exists());
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class ResolveTest method testExtraAttributesForcedDependencies.
@Test
public void testExtraAttributesForcedDependencies() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/extra-attributes-forceddependencies/ivysettings-filerepo-attribs.xml"));
ivy.getSettings().setDefaultCache(cache);
ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-extra-attrib-forced-dependencies.xml"), getResolveOptions(ivy.getSettings(), new String[] { "*" }).setValidate(false));
assertFalse(report.hasError());
ivy.deliver("1.0.0", deliverDir.getAbsolutePath() + "/ivy-1.0.0.xml", new DeliverOptions().setResolveId(report.getResolveId()).setValidate(false).setPubdate(new Date()));
File deliveredIvyFile = new File(deliverDir, "ivy-1.0.0.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("CAE-Visualization-Components", "SGL", "MAIN", "6.2.34.7"), dds[1].getDependencyRevisionId());
}
use of org.apache.ivy.Ivy 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.Ivy in project ant-ivy by apache.
the class ResolveTest method testResolveVersionRelocationChainedWithGroupRelocation.
@Test
public void testResolveVersionRelocationChainedWithGroupRelocation() throws Exception {
ivy = new Ivy();
ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
ivy.pushContext();
try {
ResolveReport report = ivy.resolve(new File("test/repositories/m2/org/relocated/test3/1.1/test3-1.1.pom"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test2", "1.0")).exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test2", "1.0", "test2", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test", "1.0")).exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test", "1.0", "test", "jar", "jar").exists());
} finally {
ivy.popContext();
}
}
Aggregations