use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testConfigurationMapping3.
/**
* Test case for IVY-84.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-84">IVY-84</a>
*/
@Test
public void testConfigurationMapping3() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/IVY-84/ivysettings.xml"));
ResolveReport report = ivy.resolve(new File("test/repositories/IVY-84/tests/3/ivy.xml"), getResolveOptions(new String[] { "buildtime" }));
ConfigurationResolveReport conf = report.getConfigurationReport("buildtime");
assertContainsArtifact("test", "a", "1.0.2", "a-bt", "txt", "txt", conf);
assertDoesntContainArtifact("test", "a", "1.0.2", "a", "txt", "txt", conf);
assertContainsArtifact("test", "b", "1.0.1", "b-bt", "txt", "txt", conf);
assertDoesntContainArtifact("test", "b", "1.0.1", "b", "txt", "txt", conf);
assertContainsArtifact("test", "c", "1.0.1", "c-bt", "txt", "txt", conf);
assertDoesntContainArtifact("test", "c", "1.0.1", "c", "txt", "txt", conf);
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testIVY1233.
/**
* Test case for IVY-1233.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1233">IVY-1233</a>
*/
@Test
public void testIVY1233() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/IVY-1233/ivysettings.xml"));
ivy.getSettings().setDefaultCache(cache);
ResolveReport rr = ivy.resolve(new File("test/repositories/IVY-1233/ivy.xml"), getResolveOptions(new String[] { "*" }));
ConfigurationResolveReport crr = rr.getConfigurationReport("default");
Set<ModuleRevisionId> modRevIds = crr.getModuleRevisionIds();
assertEquals(3, modRevIds.size());
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("test", "a", "1.0")));
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("test", "b", "2.0")));
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("test", "c", "3.0")));
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveConflict3.
/**
* Test case for IVY-264.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-264">IVY-264</a>
*/
@Test
public void testResolveConflict3() throws Exception {
// a depends on x latest, y latest, z latest
// x and z depends on commons-lang 1.0.1
// y depends on commons-lang 2.0
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/IVY-264/ivysettings.xml"));
ResolveReport report = ivy.resolve(new File("test/repositories/IVY-264/ivy.xml"), getResolveOptions(new String[] { "*" }));
assertFalse(report.hasError());
// dependencies
ConfigurationResolveReport crr = report.getConfigurationReport("default");
assertNotNull(crr);
assertEquals(0, crr.getDownloadReports(ModuleRevisionId.newInstance("myorg", "commons-lang", "1.0.1")).length);
assertEquals(1, crr.getDownloadReports(ModuleRevisionId.newInstance("myorg", "commons-lang", "2.0")).length);
assertFalse(getArchiveFileInCache(ivy, "myorg", "commons-lang", "1.0.1", "commons-lang", "jar", "jar").exists());
assertTrue(getArchiveFileInCache(ivy, "myorg", "commons-lang", "2.0", "commons-lang", "jar", "jar").exists());
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveMergeTransitiveAfterConflict.
@Test
public void testResolveMergeTransitiveAfterConflict() throws Exception {
// mod20.4 -> mod20.3;1.0 mod20.2;1.0
// mod20.3;1.0 -> mod20.1;1.0
// mod20.2;1.0 -> mod20.1;1.1 (transitive false)
// mod20.1;1.0 -> mod1.2;1.0
// mod20.1;1.1 -> mod1.2;1.0
ResolveReport report = ivy.resolve(new File("test/repositories/1/org20/mod20.4/ivys/ivy-1.0.xml"), getResolveOptions(new String[] { "*" }));
// dependencies
ConfigurationResolveReport crr = report.getConfigurationReport("default");
assertNotNull(crr);
assertEquals(1, crr.getDownloadReports(ModuleRevisionId.newInstance("org1", "mod1.2", "1.0")).length);
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.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveMultipleExtendsAndConfs.
/**
* Test case for IVY-240.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-240">IVY-240</a>
*/
@Test
public void testResolveMultipleExtendsAndConfs() throws Exception {
// mod6.3 1.1 has four confs libraries, run (extends libraries), compile (extends run) and
// test (extends libraries)
// mod6.3 depends on mod6.2 2.0 in conf (run->default)
// mod6.3 depends on mod6.1 2.+ in conf (test->default)
// mod6.2 2.0 depends on mod6.1 2.0 in conf (default->standalone)
// mod6.1 2.0 has two confs default and standalone
// mod6.1 2.0 depends on mod1.2 2.2 in conf (default->default)
ResolveReport report = ivy.resolve(new File("test/repositories/2/mod6.3/ivy-1.1.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ConfigurationResolveReport crr = report.getConfigurationReport("libraries");
assertEquals(0, crr.getArtifactsNumber());
crr = report.getConfigurationReport("run");
assertEquals(2, crr.getArtifactsNumber());
assertContainsArtifact("org6", "mod6.2", "2.0", "mod6.2", "jar", "jar", crr);
assertContainsArtifact("org6", "mod6.1", "2.0", "mod6.1", "jar", "jar", crr);
crr = report.getConfigurationReport("compile");
assertEquals(2, crr.getArtifactsNumber());
assertContainsArtifact("org6", "mod6.2", "2.0", "mod6.2", "jar", "jar", crr);
assertContainsArtifact("org6", "mod6.1", "2.0", "mod6.1", "jar", "jar", crr);
crr = report.getConfigurationReport("test");
assertEquals(2, crr.getArtifactsNumber());
assertContainsArtifact("org6", "mod6.1", "2.0", "mod6.1", "jar", "jar", crr);
assertContainsArtifact("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar", crr);
}
Aggregations