You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by xa...@apache.org on 2007/06/05 12:02:43 UTC
svn commit: r544459 [30/36] - in /incubator/ivy/core/trunk:
src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/
src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/cache/
src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/deliver...
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Tue Jun 5 05:02:27 2007
@@ -58,15 +58,17 @@
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
-
/**
*
*/
public class ResolveTest extends TestCase {
- private Ivy _ivy;
- private IvySettings _settings;
+ private Ivy _ivy;
+
+ private IvySettings _settings;
+
private File _cache;
- private CacheManager _cacheManager;
+
+ private CacheManager _cacheManager;
public ResolveTest() {
}
@@ -83,7 +85,7 @@
private void createCache() {
_cache.mkdirs();
}
-
+
protected void tearDown() throws Exception {
cleanCache();
}
@@ -94,240 +96,274 @@
del.setDir(_cache);
del.execute();
}
-
+
public void testResolveWithRetainingArtifactName() throws Exception {
- _settings.setCacheArtifactPattern(_ivy.substitute("[module]/[originalname].[ext]"));
- ResolveReport report = _ivy.resolve(new File("test/repositories/2/mod15.2/ivy-1.1.xml").toURL(),
- getResolveOptions(new String[] {"default"}));
+ _settings.setCacheArtifactPattern(_ivy.substitute("[module]/[originalname].[ext]"));
+ ResolveReport report = _ivy.resolve(new File("test/repositories/2/mod15.2/ivy-1.1.xml")
+ .toURL(), getResolveOptions(new String[] {"default"}));
assertNotNull(report);
-
- ArtifactDownloadReport[] dReports = report.getConfigurationReport("default").getDownloadReports(ModuleRevisionId.newInstance("org15", "mod15.1", "1.1"));
+
+ ArtifactDownloadReport[] dReports = report.getConfigurationReport("default")
+ .getDownloadReports(ModuleRevisionId.newInstance("org15", "mod15.1", "1.1"));
assertNotNull(dReports);
assertEquals("number of downloaded artifacts not correct", 1, dReports.length);
-
+
Artifact artifact = dReports[0].getArtifact();
assertNotNull(artifact);
-
+
String cachePath = _cacheManager.getArchivePathInCache(artifact);
- assertTrue("artifact name has not been retained: " + cachePath, cachePath.endsWith("library.jar"));
-
- dReports = report.getConfigurationReport("default").getDownloadReports(ModuleRevisionId.newInstance("org14", "mod14.1", "1.1"));
+ assertTrue("artifact name has not been retained: " + cachePath, cachePath
+ .endsWith("library.jar"));
+
+ dReports = report.getConfigurationReport("default").getDownloadReports(
+ ModuleRevisionId.newInstance("org14", "mod14.1", "1.1"));
assertNotNull(dReports);
assertEquals("number of downloaded artifacts not correct", 1, dReports.length);
-
+
artifact = dReports[0].getArtifact();
assertNotNull(artifact);
-
+
cachePath = _cacheManager.getArchivePathInCache(artifact);
- assertTrue("artifact name has not been retained: " + cachePath, cachePath.endsWith("mod14.1-1.1.jar"));
+ assertTrue("artifact name has not been retained: " + cachePath, cachePath
+ .endsWith("mod14.1-1.1.jar"));
}
- public void testArtifactOrigin() throws Exception {
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
- getResolveOptions(new String[] {"default"}));
+ public void testArtifactOrigin() throws Exception {
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
+ getResolveOptions(new String[] {"default"}));
assertNotNull(report);
- ArtifactDownloadReport[] dReports = report.getConfigurationReport("default").getDownloadReports(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"));
+ 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();
+
+ 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);
assertEquals("isLocal for artifact not correct", true, reportOrigin.isLocal());
- assertEquals("location for artifact not correct", expectedLocation, reportOrigin.getLocation());
-
+ assertEquals("location for artifact not correct", expectedLocation, reportOrigin
+ .getLocation());
+
// verify the saved origin on disk
ArtifactOrigin ivyOrigin = _cacheManager.getSavedArtifactOrigin(artifact);
assertNotNull(ivyOrigin);
assertEquals("isLocal for artifact not correct", true, 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
+
+ // 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").toURL(),
- getResolveOptions(new String[] {"default"}));
+ getResolveOptions(new String[] {"default"}));
assertNotNull(report);
- dReports = report.getConfigurationReport("default").getDownloadReports(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"));
+ 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());
+ assertEquals("download status not correct", DownloadStatus.NO, dReports[0]
+ .getDownloadStatus());
reportOrigin = dReports[0].getArtifactOrigin();
assertNotNull(reportOrigin);
assertEquals("isLocal for artifact not correct", true, reportOrigin.isLocal());
- assertEquals("location for artifact not correct", expectedLocation, reportOrigin.getLocation());
+ assertEquals("location for artifact not correct", expectedLocation, reportOrigin
+ .getLocation());
}
public void testUseOrigin() throws Exception {
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
- getResolveOptions(new String[] {"default"}).setUseOrigin(true));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(), getResolveOptions(
+ new String[] {"default"}).setUseOrigin(true));
assertNotNull(report);
- ArtifactDownloadReport[] dReports = report.getConfigurationReport("default").getDownloadReports(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"));
+ 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);
- assertEquals("download status not correct: should not download the artifact in useOrigin mode.", DownloadStatus.NO, dReports[0].getDownloadStatus());
-
+ assertEquals(
+ "download status not correct: should not download the artifact in useOrigin mode.",
+ DownloadStatus.NO, dReports[0].getDownloadStatus());
+
Artifact artifact = dReports[0].getArtifact();
assertNotNull(artifact);
-
- String expectedLocation = new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar").getAbsolutePath();
+
+ String expectedLocation = new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar")
+ .getAbsolutePath();
ArtifactOrigin origin = _cacheManager.getSavedArtifactOrigin(artifact);
File artInCache = new File(_cache, _cacheManager.getArchivePathInCache(artifact, origin));
assertFalse("should not download artifact in useOrigin mode.", artInCache.exists());
- assertEquals("location for artifact not correct.", expectedLocation, _cacheManager.getArchiveFileInCache(artifact).getAbsolutePath());
+ assertEquals("location for artifact not correct.", expectedLocation, _cacheManager
+ .getArchiveFileInCache(artifact).getAbsolutePath());
}
public void testResolveSimple() throws Exception {
// mod1.1 depends on mod1.2
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
public void testResolveBadStatus() throws Exception {
// mod1.4 depends on modfailure, modfailure has a bad status
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.1.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org1/mod1.4/ivys/ivy-1.1.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
assertTrue(report.hasError());
}
public void testResolveNoRevisionInPattern() throws Exception {
- // module1 depends on latest version of module2, for which there is no revision in the pattern
+ // module1 depends on latest version of module2, for which there is no revision in the
+ // pattern
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/norev/ivysettings.xml").toURL());
ResolveReport report = ivy.resolve(new File("test/repositories/norev/ivy.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
assertFalse(report.hasError());
}
public void testResolveNoRevisionInDep() throws Exception {
// mod1.4 depends on mod1.6, in which the ivy file has no revision
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.2.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org1/mod1.4/ivys/ivy-1.2.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
assertTrue(report.hasError());
}
public void testResolveNoRevisionNowhere() throws Exception {
// test case for IVY-258
- // module1 depends on latest version of module2, which contains no revision in its ivy file, nor in the pattern
+ // module1 depends on latest version of module2, which contains no revision in its ivy file,
+ // nor in the pattern
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/IVY-258/ivysettings.xml").toURL());
ResolveReport report = ivy.resolve(new File("test/repositories/IVY-258/ivy.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
- ((BasicResolver)ivy.getSettings().getResolver("myresolver")).setCheckconsistency(false);
+
+ ((BasicResolver) ivy.getSettings().getResolver("myresolver")).setCheckconsistency(false);
report = ivy.resolve(new File("test/repositories/IVY-258/ivy.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
}
public void testResolveWithConflictManagerPerModule() throws Exception {
// test case for IVY-448
- // all modules from myorg
- // module1
- // -> module2-1.0
- // -> module3-2.0
- // module2
- // -> module3-1.0
- // settings use 'all' as default conflict manager, and latest-revision for modules from myorg
+ // all modules from myorg
+ // module1
+ // -> module2-1.0
+ // -> module3-2.0
+ // module2
+ // -> module3-1.0
+ // settings use 'all' as default conflict manager, and latest-revision for modules from
+ // myorg
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/IVY-448/ivysettings.xml").toURL());
ResolveReport report = ivy.resolve(new File("test/repositories/IVY-448/ivy.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
+
// rev 1.0 should have been evicted by latest-revision conflict manager
- assertTrue(getArchiveFileInCache("myorg", "module3", "2.0", "module3", "jar", "jar").exists());
- assertFalse(getArchiveFileInCache("myorg", "module3", "1.0", "module3", "jar", "jar").exists());
+ assertTrue(getArchiveFileInCache("myorg", "module3", "2.0", "module3", "jar", "jar")
+ .exists());
+ assertFalse(getArchiveFileInCache("myorg", "module3", "1.0", "module3", "jar", "jar")
+ .exists());
}
public void testResolveRequiresIvyFile() throws Exception {
// mod1.1 depends on mod1.2, mod1.2 has no ivy file
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/ivysettings.xml"));
- ((FileSystemResolver)ivy.getSettings().getResolver("1")).setAllownomd(false);
- ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ ((FileSystemResolver) ivy.getSettings().getResolver("1")).setAllownomd(false);
+ ResolveReport report = ivy.resolve(new File(
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
assertTrue(report.hasError());
}
public void testResolveOtherConfiguration() throws Exception {
- ResolveReport report = _ivy.resolve(ResolveTest.class.getResource("ivy-other.xml"),
- getResolveOptions(new String[] {"test"}));
-
+ ResolveReport report = _ivy.resolve(ResolveTest.class.getResource("ivy-other.xml"),
+ getResolveOptions(new String[] {"test"}));
+
assertNotNull(report);
assertFalse(report.hasError());
-
- assertEquals("Number of artifacts not correct", 1, report.getConfigurationReport("test").getArtifactsNumber());
+
+ assertEquals("Number of artifacts not correct", 1, report.getConfigurationReport("test")
+ .getArtifactsNumber());
}
public void testResolveWithSlashes() throws Exception {
// test case for IVY-198
// module depends on mod1.2
ResolveReport report = _ivy.resolve(ResolveTest.class.getResource("ivy-198.xml"),
- getResolveOptions(new String[] {"*"}));
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("myorg/mydep", "system/module", "1.0");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("yourorg/yourdep", "yoursys/yourmod", "1.0")).exists());
- assertTrue(getArchiveFileInCache("yourorg/yourdep", "yoursys/yourmod", "1.0", "yourmod", "jar", "jar").exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("yourorg/yourdep", "yoursys/yourmod", "1.0")).exists());
+ assertTrue(getArchiveFileInCache("yourorg/yourdep", "yoursys/yourmod", "1.0", "yourmod",
+ "jar", "jar").exists());
}
- public void testFromCache() throws Exception {
+ public void testFromCache() throws Exception {
// mod1.1 depends on mod1.2
-
+
// we first do a simple resolve so that module is in cache
_ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ getResolveOptions(new String[] {"*"}));
// we now use a badly configured ivy, so that it can't find module in repository
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/bugIVY-56/ivysettings.xml"));
-
- ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
- getResolveOptions(ivy.getSettings(), new String[] {"*"}));
+
+ ResolveReport report = ivy.resolve(new File(
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(), getResolveOptions(ivy
+ .getSettings(), new String[] {"*"}));
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
@@ -348,14 +384,15 @@
resolver.add(r);
ivy.getSettings().addResolver(resolver);
ivy.getSettings().setDefaultResolver("dual");
-
+
// set up repository
File art = new File("build/testCache2/mod1.2-2.0.jar");
FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), art, null);
// we first do a simple resolve so that module is in cache
- ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ ResolveReport report = ivy.resolve(new File(
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
// now we clean the repository to simulate repo not available (network pb for instance)
@@ -363,41 +400,46 @@
del.setProject(new Project());
del.setDir(new File("build/testCache2"));
del.execute();
-
+
// now do a new resolve: it should use cached data
report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
public void testFromCacheOnly() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/bugIVY-56/ivysettings.xml"));
-
-// ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
-// getResolveOptions(new String[] {"*"}));
-// // should have an error, the conf is bad and the dependency should not be found
-// assertTrue(report.hasError());
+
+ // ResolveReport report = ivy.resolve(new
+ // File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
+ // getResolveOptions(new String[] {"*"}));
+ // // should have an error, the conf is bad and the dependency should not be found
+ // assertTrue(report.hasError());
// put necessary stuff in cache, and it should now be ok
- File ivyfile = ivy.getCacheManager(_cache).getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"));
- File art = TestHelper.getArchiveFileInCache(ivy, _cache, "org1", "mod1.2", "2.0", "mod1.2", "jar", "jar");
+ File ivyfile = ivy.getCacheManager(_cache).getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"));
+ File art = TestHelper.getArchiveFileInCache(ivy, _cache, "org1", "mod1.2", "2.0", "mod1.2",
+ "jar", "jar");
FileUtil.copy(ResolveTest.class.getResource("ivy-mod1.2.xml"), ivyfile, null);
FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), art, null);
- ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
- getResolveOptions(ivy.getSettings(), new String[] {"*"}));
+ ResolveReport report = ivy.resolve(new File(
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(), getResolveOptions(ivy
+ .getSettings(), new String[] {"*"}));
assertFalse(report.hasError());
}
@@ -408,61 +450,69 @@
ivy.getSettings().setCacheArtifactPattern("[artifact].[ext]");
// mod1.1 depends on mod1.2
- ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
- getResolveOptions(ivy.getSettings(), new String[] {"*"}));
+ ResolveReport report = ivy.resolve(new File(
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(), getResolveOptions(ivy
+ .getSettings(), new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(ivy.getCacheManager(_cache).getResolvedIvyFileInCache(mrid).exists());
-
+
// dependencies
- assertTrue(ivy.getCacheManager(_cache).getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(ivy.getCacheManager(_cache).getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(new File(_cache, "mod1.2/ivy.xml").exists());
- assertTrue(TestHelper.getArchiveFileInCache(ivy, _cache, "org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
+ assertTrue(TestHelper.getArchiveFileInCache(ivy, _cache, "org1", "mod1.2", "2.0", "mod1.2",
+ "jar", "jar").exists());
assertTrue(new File(_cache, "mod1.2.jar").exists());
}
public void testResolveExtends() throws Exception {
// mod6.1 depends on mod1.2 2.0 in conf default, and conf extension extends default
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org6/mod6.1/ivys/ivy-0.3.xml").toURL(),
- getResolveOptions(new String[] {"extension"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org6/mod6.1/ivys/ivy-0.3.xml").toURL(),
+ getResolveOptions(new String[] {"extension"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org6", "mod6.1", "0.3");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
+
// dependencies from default
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
public void testResolveExtended() throws Exception {
// mod6.1 depends on mod1.2 2.0 in conf default, and conf extension extends default
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org6/mod6.1/ivys/ivy-0.3.xml").toURL(),
- getResolveOptions(new String[] {"default"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org6/mod6.1/ivys/ivy-0.3.xml").toURL(),
+ getResolveOptions(new String[] {"default"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org6", "mod6.1", "0.3");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
+
// dependencies from default
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
public void testResolveExtendedAndExtends() throws Exception {
// mod6.1 depends on mod1.2 2.0 in conf default, and conf extension extends default
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org6/mod6.1/ivys/ivy-0.3.xml").toURL(),
- getResolveOptions(new String[] {"default", "extension"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org6/mod6.1/ivys/ivy-0.3.xml").toURL(),
+ getResolveOptions(new String[] {"default", "extension"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
@@ -474,22 +524,24 @@
crr = report.getConfigurationReport("extension");
assertNotNull(crr);
assertEquals(1, crr.getArtifactsNumber());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
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.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").toURL(),
- getResolveOptions(new String[] {"default", "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").toURL(),
+ getResolveOptions(new String[] {"default", "extension"}));
assertNotNull(report);
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
@@ -502,44 +554,47 @@
crr = report.getConfigurationReport("extension");
assertNotNull(crr);
assertEquals(2, crr.getArtifactsNumber());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org6", "mod6.1", "0.4")).exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org6", "mod6.1", "0.4")).exists());
assertTrue(getArchiveFileInCache("org6", "mod6.1", "0.4", "mod6.1", "jar", "jar").exists());
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
public void testResolveMultipleExtendsAndConfs() throws Exception {
// Test case for IVY-240
//
- // 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.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").toURL(),
- getResolveOptions(new String[] {"*"}));
+ // 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")
+ .toURL(), 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);
@@ -549,13 +604,14 @@
public void testResolveMultipleConfsWithLatest() throws Exception {
// Test case for IVY-188
//
- // 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").toURL(),
- getResolveOptions(new String[] {"compile", "run"}));
+ // 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").toURL(),
+ getResolveOptions(new String[] {"compile", "run"}));
assertNotNull(report);
assertFalse(report.hasError());
@@ -566,23 +622,25 @@
assertNotNull(crr);
assertEquals(1, crr.getArtifactsNumber());
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.2")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
}
public void testResolveMultipleConfsWithConflicts() throws Exception {
// Test case for IVY-173
//
- // mod6.2 has two confs compile and run
- // depends on mod1.2 2.1 in conf (compile->default)
- // depends on mod1.1 1.0 in conf (*->default)
- // depends on mod6.1 in conf (*->default)
- // mod6.1
- // depends on mod1.2 2.1
- // mod1.1
- // depends on mod1.2 2.0
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org6/mod6.2/ivys/ivy-0.5.xml").toURL(),
- getResolveOptions(new String[] {"compile", "run"}));
+ // mod6.2 has two confs compile and run
+ // depends on mod1.2 2.1 in conf (compile->default)
+ // depends on mod1.1 1.0 in conf (*->default)
+ // depends on mod6.1 in conf (*->default)
+ // mod6.1
+ // depends on mod1.2 2.1
+ // mod1.1
+ // depends on mod1.2 2.0
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org6/mod6.2/ivys/ivy-0.5.xml").toURL(),
+ getResolveOptions(new String[] {"compile", "run"}));
assertNotNull(report);
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
@@ -595,27 +653,32 @@
crr = report.getConfigurationReport("run");
assertNotNull(crr);
assertEquals(3, crr.getArtifactsNumber());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org6", "mod6.1", "0.5")).exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org6", "mod6.1", "0.5")).exists());
assertTrue(getArchiveFileInCache("org6", "mod6.1", "0.5", "mod6.1", "jar", "jar").exists());
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
- assertFalse(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertFalse(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
public void testResolveMultipleExtends2() throws Exception {
// same as before, except that mod6.2 depends on mod1.2 2.1 extension->default
// so mod1.2 2.0 should be evicted in conf extension
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org6/mod6.2/ivys/ivy-0.4.xml").toURL(),
- getResolveOptions(new String[] {"default", "extension"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org6/mod6.2/ivys/ivy-0.4.xml").toURL(),
+ getResolveOptions(new String[] {"default", "extension"}));
assertNotNull(report);
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
@@ -637,549 +700,616 @@
node = crr.getDependency(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1"));
assertNotNull(node);
assertFalse(node.isEvicted("extension"));
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org6", "mod6.1", "0.4")).exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org6", "mod6.1", "0.4")).exists());
assertTrue(getArchiveFileInCache("org6", "mod6.1", "0.4", "mod6.1", "jar", "jar").exists());
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
}
public void testResolveSeveralDefaultWithArtifacts() throws Exception {
- // test case for IVY-261
- // mod1.6 depends on
- // mod1.4, which depends on mod1.3 and selects one of its artifacts
- // mod1.3 and selects two of its artifacts
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org1/mod1.6/ivys/ivy-1.0.3.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ // test case for IVY-261
+ // mod1.6 depends on
+ // mod1.4, which depends on mod1.3 and selects one of its artifacts
+ // mod1.3 and selects two of its artifacts
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org1/mod1.6/ivys/ivy-1.0.3.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
+
// dependencies
- assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-B", "jar", "jar").exists());
+ assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-B", "jar", "jar")
+ .exists());
}
public void testResolveSeveralDefaultWithArtifactsAndConfs() throws Exception {
- // test case for IVY-283
+ // test case for IVY-283
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").toURL(),
- getResolveOptions(new String[] {"*"}));
+ 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);
+ assertEquals(3,
+ crr.getDownloadReports(ModuleRevisionId.newInstance("medicel", "C", "1.0")).length);
assertTrue(getArchiveFileInCache("medicel", "C", "1.0", "lib_c_a", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("medicel", "C", "1.0", "lib_c_b", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("medicel", "C", "1.0", "lib_c_d", "jar", "jar").exists());
}
-
+
public void testResolveSeveralDefaultWithArtifactsAndConfs2() throws Exception {
- // second test case for IVY-283
+ // second test case for IVY-283
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-d.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
+
// dependencies
ConfigurationResolveReport crr = report.getConfigurationReport("build");
assertNotNull(crr);
- assertEquals(9, crr.getDownloadReports(ModuleRevisionId.newInstance("medicel", "module_a", "local")).length);
+ assertEquals(9, crr.getDownloadReports(ModuleRevisionId.newInstance("medicel", "module_a",
+ "local")).length);
- assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_a", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_b", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_c", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_d", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_e", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_f", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_g", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_h", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_i", "jar", "jar").exists());
+ assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_a", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_b", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_c", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_d", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_e", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_f", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_g", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_h", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache("medicel", "module_a", "local", "lib_a_i", "jar", "jar")
+ .exists());
}
-
-
public void testResolveDefaultWithArtifactsConf1() throws Exception {
// mod2.2 depends on mod1.3 and selects its artifacts
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.2/ivys/ivy-0.5.xml").toURL(),
- getResolveOptions(new String[] {"myconf1"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.2/ivys/ivy-0.5.xml").toURL(),
+ getResolveOptions(new String[] {"myconf1"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.2", "0.5");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.3", "3.0")).exists());
- assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-B", "jar", "jar").exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.3", "3.0")).exists());
+ assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-B", "jar", "jar")
+ .exists());
assertTrue(!getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3", "jar", "jar").exists());
}
-
+
public void testResolveDefaultWithArtifactsConf2() throws Exception {
// mod2.2 depends on mod1.3 and selects its artifacts
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.2/ivys/ivy-0.5.xml").toURL(),
- getResolveOptions(new String[] {"myconf2"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.2/ivys/ivy-0.5.xml").toURL(),
+ getResolveOptions(new String[] {"myconf2"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.2", "0.5");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.3", "3.0")).exists());
- assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar").exists());
- assertTrue(!getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-B", "jar", "jar").exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.3", "3.0")).exists());
+ assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar")
+ .exists());
+ assertTrue(!getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-B", "jar", "jar")
+ .exists());
assertTrue(!getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3", "jar", "jar").exists());
}
-
+
public void testResolveDefaultWithArtifactsAndConfMapping() throws Exception {
// mod2.2 depends on mod1.3 and specify its artifacts and a conf mapping
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.2/ivys/ivy-0.5.1.xml").toURL(),
- getResolveOptions(new String[] {"myconf1"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.2/ivys/ivy-0.5.1.xml").toURL(),
+ getResolveOptions(new String[] {"myconf1"}));
assertNotNull(report);
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.2", "0.5.1");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.3", "3.0")).exists());
- assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-B", "jar", "jar").exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.3", "3.0")).exists());
+ assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-B", "jar", "jar")
+ .exists());
assertTrue(!getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3", "jar", "jar").exists());
}
-
-
+
public void testResolveWithIncludeArtifactsConf1() throws Exception {
// mod2.3 depends on mod2.1 and selects its artifacts in myconf1
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.3/ivys/ivy-0.4.xml").toURL(),
- getResolveOptions(new String[] {"myconf1"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.3/ivys/ivy-0.4.xml").toURL(),
+ getResolveOptions(new String[] {"myconf1"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.3", "0.4");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21A", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "art21B", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "mod2.1", "jar", "jar").exists());
}
-
+
public void testResolveWithIncludeArtifactsConf2() throws Exception {
// mod2.3 depends on mod2.1 and selects its artifacts in myconf1
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.3/ivys/ivy-0.4.xml").toURL(),
- getResolveOptions(new String[] {"myconf2"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.3/ivys/ivy-0.4.xml").toURL(),
+ getResolveOptions(new String[] {"myconf2"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.3", "0.4");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21A", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21B", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "mod2.1", "jar", "jar").exists());
}
-
+
public void testResolveWithIncludeArtifactsWithoutConf() throws Exception {
// mod2.3 depends on mod2.1 and selects its artifacts
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.3/ivys/ivy-0.5.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.3/ivys/ivy-0.5.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.3", "0.5");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21A", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "art21B", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "mod2.1", "jar", "jar").exists());
}
-
+
public void testResolveWithExcludesArtifacts() throws Exception {
// mod2.3 depends on mod2.1 and selects its artifacts
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.3/ivys/ivy-0.6.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.3/ivys/ivy-0.6.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.3", "0.6");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21A", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "art21B", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "mod2.1", "jar", "jar").exists());
}
-
+
public void testResolveWithExcludesArtifacts2() throws Exception {
// mod2.3 depends on mod2.1 and badly excludes artifacts with incorrect matcher
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.3/ivys/ivy-0.6.2.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.3/ivys/ivy-0.6.2.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.3", "0.6.2");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21A", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21B", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "mod2.1", "jar", "jar").exists());
}
-
+
public void testResolveWithExcludesArtifacts3() throws Exception {
// mod2.3 depends on mod2.1 and excludes artifacts with exact matcher
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.3/ivys/ivy-0.6.3.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.3/ivys/ivy-0.6.3.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.3", "0.6.3");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21A", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "art21B", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "mod2.1", "jar", "jar").exists());
}
-
+
public void testResolveWithExcludesArtifacts4() throws Exception {
// mod2.3 depends on mod2.1 and excludes artifacts with regexp matcher
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.3/ivys/ivy-0.6.4.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.3/ivys/ivy-0.6.4.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.3", "0.6.4");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21A", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "art21B", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "mod2.1", "jar", "jar").exists());
}
-
+
public void testResolveWithExcludesArtifacts5() throws Exception {
// mod2.3 depends on mod2.1 and excludes artifacts with glob matcher
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.3/ivys/ivy-0.6.5.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.3/ivys/ivy-0.6.5.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.3", "0.6.5");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21A", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "art21B", "jar", "jar").exists());
assertTrue(!getArchiveFileInCache("org2", "mod2.1", "0.3", "mod2.1", "jar", "jar").exists());
}
-
+
public void testResolveTransitiveDependencies() throws Exception {
// mod2.1 depends on mod1.1 which depends on mod1.2
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.1/ivys/ivy-0.3.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.1", "0.3");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
-
+
public void testResolveTransitiveDisabled() throws Exception {
// mod2.1 depends on mod1.1 which depends on mod1.2
- ResolveReport report = _ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.xml").toURL(),
- getResolveOptions(new String[] {"*"}).setTransitive(false));
+ ResolveReport report = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.1/ivys/ivy-0.3.xml").toURL(), getResolveOptions(
+ new String[] {"*"}).setTransitive(false));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.1", "0.3");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
- assertFalse(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertFalse(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
-
+
public void testDependenciesOrder() throws Exception {
ResolveReport report = _ivy.resolve(ResolveTest.class.getResource("ivy-225.xml"),
- getResolveOptions(new String[] {"default"}));
-
+ getResolveOptions(new String[] {"default"}));
+
Set revisions = report.getConfigurationReport("default").getModuleRevisionIds();
assertTrue("number of revisions is not correct", revisions.size() >= 3);
-
+
// verify the first 3 modules against the ones in the ivy file
Iterator it = revisions.iterator();
ModuleRevisionId revId1 = (ModuleRevisionId) it.next();
assertEquals("mod1.2", revId1.getName());
assertEquals("1.1", revId1.getRevision());
-
+
ModuleRevisionId revId2 = (ModuleRevisionId) it.next();
assertEquals("mod3.2", revId2.getName());
assertEquals("1.4", revId2.getRevision());
-
+
ModuleRevisionId revId3 = (ModuleRevisionId) it.next();
assertEquals("mod5.1", revId3.getName());
assertEquals("4.2", revId3.getRevision());
}
-
+
public void testDisableTransitivityPerConfiguration() throws Exception {
// mod2.1 (compile, runtime) depends on mod1.1 which depends on mod1.2
// compile conf is not transitive
-
+
// first we resolve compile conf only
_ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.1.xml").toURL(),
- getResolveOptions(new String[] {"compile"}));
-
+ getResolveOptions(new String[] {"compile"}));
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
- assertFalse(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertFalse(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
// then we resolve runtime conf
_ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.1.xml").toURL(),
- getResolveOptions(new String[] {"runtime"}));
-
+ getResolveOptions(new String[] {"runtime"}));
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
- // same as before, but resolve both confs in one call
- ResolveReport r = _ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.1.xml").toURL(),
- getResolveOptions(new String[] {"runtime", "compile"}));
- assertFalse(r.hasError());
+ // same as before, but resolve both confs in one call
+ ResolveReport r = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.1/ivys/ivy-0.3.1.xml").toURL(),
+ getResolveOptions(new String[] {"runtime", "compile"}));
+ assertFalse(r.hasError());
assertEquals(1, r.getConfigurationReport("compile").getArtifactsNumber());
assertEquals(2, r.getConfigurationReport("runtime").getArtifactsNumber());
}
-
+
public void testDisableTransitivityPerConfiguration2() throws Exception {
// mod2.1 (compile, runtime) depends on mod1.1 which depends on mod1.2
// compile conf is not transitive
- // compile extends runtime
-
+ // compile extends runtime
+
// first we resolve compile conf only
_ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.2.xml").toURL(),
- getResolveOptions(new String[] {"compile"}));
-
+ getResolveOptions(new String[] {"compile"}));
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
- assertFalse(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertFalse(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
// then we resolve runtime conf
_ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.2.xml").toURL(),
- getResolveOptions(new String[] {"runtime"}));
-
+ getResolveOptions(new String[] {"runtime"}));
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
- // same as before, but resolve both confs in one call
- ResolveReport r = _ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.2.xml").toURL(),
- getResolveOptions(new String[] {"runtime", "compile"}));
- assertFalse(r.hasError());
+ // same as before, but resolve both confs in one call
+ ResolveReport r = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.1/ivys/ivy-0.3.2.xml").toURL(),
+ getResolveOptions(new String[] {"runtime", "compile"}));
+ assertFalse(r.hasError());
assertEquals(1, r.getConfigurationReport("compile").getArtifactsNumber());
assertEquals(2, r.getConfigurationReport("runtime").getArtifactsNumber());
}
-
+
public void testDisableTransitivityPerConfiguration3() throws Exception {
// mod2.1 (compile, runtime) depends on mod1.1 which depends on mod1.2
// compile conf is not transitive
- // runtime extends compile
-
+ // runtime extends compile
+
// first we resolve compile conf only
_ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.3.xml").toURL(),
- getResolveOptions(new String[] {"compile"}));
-
+ getResolveOptions(new String[] {"compile"}));
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
- assertFalse(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertFalse(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
// then we resolve runtime conf
_ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.3.xml").toURL(),
- getResolveOptions(new String[] {"runtime"}));
-
+ getResolveOptions(new String[] {"runtime"}));
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
- // same as before, but resolve both confs in one call
- ResolveReport r = _ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.3.xml").toURL(),
- getResolveOptions(new String[] {"runtime", "compile"}));
- assertFalse(r.hasError());
+ // same as before, but resolve both confs in one call
+ ResolveReport r = _ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.1/ivys/ivy-0.3.3.xml").toURL(),
+ getResolveOptions(new String[] {"runtime", "compile"}));
+ assertFalse(r.hasError());
assertEquals(1, r.getConfigurationReport("compile").getArtifactsNumber());
assertEquals(2, r.getConfigurationReport("runtime").getArtifactsNumber());
}
-
+
public void testDisableTransitivityPerConfiguration4() throws Exception {
- // mod2.2 (A,B,compile) depends on mod 2.1 (A->runtime;B->compile)
- // compile is not transitive and extends A and B
- //
+ // mod2.2 (A,B,compile) depends on mod 2.1 (A->runtime;B->compile)
+ // compile is not transitive and extends A and B
+ //
// mod2.1 (compile, runtime) depends on mod1.1 which depends on mod1.2
- // compile conf is not transitive and extends runtime
-
- ResolveReport r = _ivy.resolve(new File("test/repositories/1/org2/mod2.2/ivys/ivy-0.6.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
- assertFalse(r.hasError());
+ // compile conf is not transitive and extends runtime
+
+ ResolveReport r = _ivy.resolve(new File("test/repositories/1/org2/mod2.2/ivys/ivy-0.6.xml")
+ .toURL(), getResolveOptions(new String[] {"*"}));
+ assertFalse(r.hasError());
- // here we should get all three recursive dependencies
+ // here we should get all three recursive dependencies
assertEquals(new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"),
- })), r.getConfigurationReport("A").getModuleRevisionIds());
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"),})), r
+ .getConfigurationReport("A").getModuleRevisionIds());
// here we should get only mod2.1 and mod1.1 cause compile is not transitive in mod2.1
assertEquals(new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
- })), r.getConfigurationReport("B").getModuleRevisionIds());
-
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),})), r
+ .getConfigurationReport("B").getModuleRevisionIds());
+
// here we should get only mod2.1 cause compile is not transitive
- assertEquals(new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
- })), r.getConfigurationReport("compile").getModuleRevisionIds());
+ assertEquals(new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId
+ .newInstance("org2", "mod2.1", "0.3.2"),})), r.getConfigurationReport("compile")
+ .getModuleRevisionIds());
}
-
+
public void testDisableTransitivityPerConfiguration5() throws Exception {
- // mod2.2 (A,B,compile) depends on
- // mod 2.1 (A->runtime;B->compile)
- // mod1.1 (A->*) ]0.9.9,1.0] (which resolves to 1.0)
- // compile is not transitive and extends A and B
- //
+ // mod2.2 (A,B,compile) depends on
+ // mod 2.1 (A->runtime;B->compile)
+ // mod1.1 (A->*) ]0.9.9,1.0] (which resolves to 1.0)
+ // compile is not transitive and extends A and B
+ //
// mod2.1 (compile, runtime) depends on mod1.1 1.0 which depends on mod1.2 2.0
- // compile conf is not transitive and extends runtime
-
- ResolveReport r = _ivy.resolve(new File("test/repositories/1/org2/mod2.2/ivys/ivy-0.7.xml").toURL(),
- getResolveOptions(new String[] {"A","B","compile"}));
- assertFalse(r.hasError());
-
- // here we should get all three recursive dependencies
+ // compile conf is not transitive and extends runtime
+
+ ResolveReport r = _ivy.resolve(new File("test/repositories/1/org2/mod2.2/ivys/ivy-0.7.xml")
+ .toURL(), getResolveOptions(new String[] {"A", "B", "compile"}));
+ assertFalse(r.hasError());
+
+ // here we should get all three recursive dependencies
assertEquals(new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"),
- })), r.getConfigurationReport("A").getModuleRevisionIds());
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"),})), r
+ .getConfigurationReport("A").getModuleRevisionIds());
// here we should get only mod2.1 and mod1.1 cause compile is not transitive in mod2.1
assertEquals(new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
- })), r.getConfigurationReport("B").getModuleRevisionIds());
-
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),})), r
+ .getConfigurationReport("B").getModuleRevisionIds());
+
// here we should get only mod2.1 cause compile is not transitive
assertEquals(new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
- })), r.getConfigurationReport("compile").getModuleRevisionIds());
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),})), r
+ .getConfigurationReport("compile").getModuleRevisionIds());
}
-
+
public void testResolveDiamond() throws Exception {
- // mod4.1 depends on
- // - mod1.1 which depends on mod1.2
- // - mod3.1 which depends on mod1.2
- ResolveReport report = _ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.0.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ // mod4.1 depends on
+ // - mod1.1 which depends on mod1.2
+ // - mod3.1 which depends on mod1.2
+ ResolveReport report = _ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.0.xml")
+ .toURL(), getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org4", "mod4.1", "4.0");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
+
// dependencies
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org3", "mod3.1", "1.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org3", "mod3.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org3", "mod3.1", "1.0", "mod3.1", "jar", "jar").exists());
}
public void testResolveConflict() throws Exception {
- // mod4.1 v 4.1 depends on
- // - mod1.1 v 1.0 which depends on mod1.2 v 2.0
- // - mod3.1 v 1.1 which depends on mod1.2 v 2.1
- ResolveReport report = _ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.1.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
+ // mod4.1 v 4.1 depends on
+ // - mod1.1 v 1.0 which depends on mod1.2 v 2.0
+ // - mod3.1 v 1.1 which depends on mod1.2 v 2.1
+ ResolveReport report = _ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.1.xml")
+ .toURL(), getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org4", "mod4.1", "4.1");
assertEquals(mrid, md.getModuleRevisionId());
-
+
assertTrue(_cacheManager.getResolvedIvyFileInCache(mrid).exists());
-
+
// dependencies
ConfigurationResolveReport crr = report.getConfigurationReport("default");
assertNotNull(crr);
- assertEquals(0, crr.getDownloadReports(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).length);
- assertEquals(1, crr.getDownloadReports(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).length);
-
- File r = _cacheManager.getConfigurationResolveReportInCache(ResolveOptions.getDefaultResolveId(md), "default");
+ assertEquals(0, crr.getDownloadReports(ModuleRevisionId
+ .newInstance("org1", "mod1.2", "2.0")).length);
+ assertEquals(1, crr.getDownloadReports(ModuleRevisionId
+ .newInstance("org1", "mod1.2", "2.1")).length);
+
+ File r = _cacheManager.getConfigurationResolveReportInCache(ResolveOptions
+ .getDefaultResolveId(md), "default");
assertTrue(r.exists());
final boolean[] found = new boolean[] {false};
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
saxParser.parse(r, new DefaultHandler() {
- public void startElement(String uri,String localName,String qName,org.xml.sax.Attributes attributes) throws SAXException {
+ public void startElement(String uri, String localName, String qName,
+ org.xml.sax.Attributes attributes) throws SAXException {
if ("revision".equals(qName) && "2.0".equals(attributes.getValue("name"))) {
found[0] = true;
}
@@ -1187,39 +1317,46 @@
});
assertTrue(found[0]); // the report should contain the evicted revision
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org3", "mod3.1", "1.1")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org3", "mod3.1", "1.1")).exists());
assertTrue(getArchiveFileInCache("org3", "mod3.1", "1.1", "mod3.1", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
- assertTrue(_cacheManager.getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).exists());
+ assertTrue(_cacheManager.getIvyFileInCache(
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
}
-
+
public void testResolveConflict2() throws Exception {
- // mod4.1 v 4.14 depends on
- // - mod1.1 v 1.0 which depends on mod1.2 v 2.0
- // - mod3.1 v 1.1 which depends on mod1.2 v 2.1
- // - mod6.1 v 0.3 which depends on mod1.2 v 2.0
- ResolveReport report = _ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.14.xml").toURL(),
- getResolveOptions(new String[] {"*"}));
-
+ // mod4.1 v 4.14 depends on
[... 2653 lines stripped ...]