use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testLatestMilestone2.
/**
* Test case for IVY-318.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-318">IVY-318</a>
*/
@Test
public void testLatestMilestone2() throws Exception {
// mod9.2 depends on latest.milestone of mod6.2, but there is no milestone
ResolveReport report = ivy.resolve(new File("test/repositories/1/org9/mod9.2/ivys/ivy-1.2.xml"), getResolveOptions(new String[] { "default" }));
// we should have an error since there is no milestone version, it should be considered as a
// non resolved dependency
assertTrue(report.hasError());
// dependencies
ConfigurationResolveReport crr = report.getConfigurationReport("default");
assertNotNull(crr);
assertEquals(0, crr.getArtifactsNumber());
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testEvictWithConfInMultiConf.
@Test
public void testEvictWithConfInMultiConf() throws Exception {
// same as preceding ones but the conflict appears in several root confs
// bug 105 - test #3
// mod6.1 r1.2 conf A and conf B depends on
// mod5.2 r1.0 which depends on mod5.1 r4.0 conf B
// mod5.1 r4.2 conf A
//
// 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.2.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org6", "mod6.1", "1.2");
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());
// all artifacts should be present in both confs
ConfigurationResolveReport crr = report.getConfigurationReport("A");
assertNotNull(crr);
assertEquals(2, crr.getDownloadReports(ModuleRevisionId.newInstance("org5", "mod5.1", "4.2")).length);
crr = report.getConfigurationReport("B");
assertNotNull(crr);
assertEquals(2, crr.getDownloadReports(ModuleRevisionId.newInstance("org5", "mod5.1", "4.2")).length);
// even late eviction should avoid artifact downloading
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.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testThisConfiguration.
@Test
public void testThisConfiguration() throws Exception {
ResolveReport report = ivy.resolve(new File("test/repositories/2/mod14.4/ivy-1.1.xml"), getResolveOptions(new String[] { "compile" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org14", "mod14.4", "1.1");
assertEquals(mrid, md.getModuleRevisionId());
ConfigurationResolveReport crr = report.getConfigurationReport("compile");
assertNotNull(crr);
assertEquals(4, crr.getArtifactsNumber());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org14", "mod14.3", "1.1")).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org14", "mod14.2", "1.1")).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org14", "mod14.1", "1.1")).exists());
assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org8", "mod8.3", "1.0")).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org8", "mod8.1", "1.0")).exists());
CacheCleaner.deleteDir(cache);
createCache();
report = ivy.resolve(new File("test/repositories/2/mod14.4/ivy-1.1.xml"), getResolveOptions(new String[] { "standalone" }));
crr = report.getConfigurationReport("standalone");
assertNotNull(crr);
assertEquals(7, crr.getArtifactsNumber());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org14", "mod14.3", "1.1")).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org14", "mod14.1", "1.1")).exists());
assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org14", "mod14.2", "1.1")).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org14", "mod14.3", "1.1")).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org8", "mod8.3", "1.0")).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org8", "mod8.1", "1.0")).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org8", "mod8.4", "1.1")).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org8", "mod8.2", "1.1")).exists());
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveMultipleExtends.
@Test
public void testResolveMultipleExtends() throws Exception {
// mod6.2 has two confs default and extension
// mod6.2 depends on mod6.1 in conf (default->extension)
// conf extension extends default
// mod6.1 has two confs default and extension
// mod6.1 depends on mod1.2 2.0 in conf (default->default)
// conf extension extends default
ResolveReport report = ivy.resolve(new File("test/repositories/1/org6/mod6.2/ivys/ivy-0.3.xml"), getResolveOptions(new String[] { "default", "extension" }));
assertNotNull(report);
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org6", "mod6.2", "0.3");
assertEquals(mrid, md.getModuleRevisionId());
ConfigurationResolveReport crr = report.getConfigurationReport("default");
assertNotNull(crr);
assertEquals(2, crr.getArtifactsNumber());
crr = report.getConfigurationReport("extension");
assertNotNull(crr);
assertEquals(2, crr.getArtifactsNumber());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org6", "mod6.1", "0.4")).exists());
assertTrue(getArchiveFileInCache("org6", "mod6.1", "0.4", "mod6.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());
}
use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.
the class ResolveTest method testConfigurationMapping7.
/**
* 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 testConfigurationMapping7() 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/7/ivy.xml"), getResolveOptions(new String[] { "buildtime", "default" }));
ConfigurationResolveReport conf = report.getConfigurationReport("default");
assertContainsArtifact("test", "a", "1.0.2", "a", "txt", "txt", conf);
assertDoesntContainArtifact("test", "a", "1.0.2", "a-bt", "txt", "txt", conf);
assertContainsArtifact("test", "b", "1.0.1", "b", "txt", "txt", conf);
assertDoesntContainArtifact("test", "b", "1.0.1", "b-bt", "txt", "txt", conf);
assertContainsArtifact("test", "c", "1.0.1", "c", "txt", "txt", conf);
assertDoesntContainArtifact("test", "c", "1.0.1", "c-bt", "txt", "txt", conf);
}
Aggregations