use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolverDirectlyUsingCache.
@Test
public void testResolverDirectlyUsingCache() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(ResolveTest.class.getResource("badcacheconf.xml"));
File depIvyFileInCache = getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"));
// creates a
FileUtil.copy(File.createTempFile("test", "xml"), depIvyFileInCache, null);
// fake
// dependency
// file in cache
ResolveReport report = ivy.resolve(new File("test/repositories/1/org2/mod2.4/ivys/ivy-0.3.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.4", "0.3");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(depIvyFileInCache.exists());
assertFalse(getArchiveFileInCache(ivy, "org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testArtifactOrigin.
@Test
public void testArtifactOrigin() throws Exception {
ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"), getResolveOptions(new String[] { "default" }));
assertNotNull(report);
ArtifactDownloadReport[] dReports = report.getConfigurationReport("default").getDownloadReports(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"));
assertNotNull(dReports);
assertEquals("number of downloaded artifacts not correct", 1, dReports.length);
Artifact artifact = dReports[0].getArtifact();
assertNotNull(artifact);
String expectedLocation = new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar").getAbsolutePath();
// verify the origin in the report
ArtifactOrigin reportOrigin = dReports[0].getArtifactOrigin();
assertNotNull(reportOrigin);
assertTrue("isLocal for artifact not correct", reportOrigin.isLocal());
assertEquals("location for artifact not correct", expectedLocation, reportOrigin.getLocation());
// verify the saved origin on disk
ArtifactOrigin ivyOrigin = getSavedArtifactOrigin(artifact);
assertNotNull(ivyOrigin);
assertTrue("isLocal for artifact not correct", ivyOrigin.isLocal());
assertEquals("location for artifact not correct", expectedLocation, ivyOrigin.getLocation());
// now resolve the same artifact again and verify the origin of the (not-downloaded)
// artifact
report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"), getResolveOptions(new String[] { "default" }));
assertNotNull(report);
dReports = report.getConfigurationReport("default").getDownloadReports(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"));
assertNotNull(dReports);
assertEquals("number of downloaded artifacts not correct", 1, dReports.length);
assertEquals("download status not correct", DownloadStatus.NO, dReports[0].getDownloadStatus());
reportOrigin = dReports[0].getArtifactOrigin();
assertNotNull(reportOrigin);
assertTrue("isLocal for artifact not correct", reportOrigin.isLocal());
assertEquals("location for artifact not correct", expectedLocation, reportOrigin.getLocation());
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testTransitiveSetting2.
/**
* Test case for IVY-105.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-105">IVY-105</a>
*/
@Test
public void testTransitiveSetting2() throws Exception {
// mod2.7 depends on mod1.1 and mod2.4
// mod2.4 depends on mod1.1 with transitive set to false
// mod1.1 depends on mod1.2
ResolveReport report = ivy.resolve(new File("test/repositories/1/org2/mod2.7/ivys/ivy-0.6.xml"), getResolveOptions(new String[] { "*" }));
assertFalse(report.hasError());
// 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", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testEvictWithConfInMultiConf2.
@Test
public void testEvictWithConfInMultiConf2() throws Exception {
// same as preceding one but the conflict appears in a root conf and not in another
// which should keep the evicted
// bug 105 - test #4
// mod6.1 r1.3 conf A depends on
// mod5.2 r1.0 which depends on mod5.1 r4.0 conf B
//
// mod6.1 r1.3 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.3.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org6", "mod6.1", "1.3");
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.1", "4.0")).exists());
assertTrue(getArchiveFileInCache("org5", "mod5.1", "4.0", "art51A", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("org5", "mod5.1", "4.0", "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());
// 4.2 artifacts should be present in conf B only
ConfigurationResolveReport crr = report.getConfigurationReport("A");
assertNotNull(crr);
assertEquals(0, 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);
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testMultipleEviction.
/**
* Test case for IVY-644.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-644">IVY-644</a>
*/
@Test
public void testMultipleEviction() throws Exception {
ResolveReport report = ivy.resolve(new File("test/repositories/1/IVY-644/M1/ivys/ivy-1.0.xml"), getResolveOptions(new String[] { "test", // NB the order impact the bug
"runtime" }));
assertFalse(report.hasError());
}
Aggregations