You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jl...@apache.org on 2014/01/14 09:27:43 UTC
svn commit: r1557968 [20/26] - in /ant/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/
src...
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Tue Jan 14 08:27:37 2014
@@ -80,7 +80,9 @@ public class ResolveTest extends TestCas
private Ivy ivy;
private File cache;
+
private File deliverDir;
+
private File workDir;
public ResolveTest() {
@@ -90,7 +92,7 @@ public class ResolveTest extends TestCas
cache = new File("build/cache");
System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
createCache();
-
+
deliverDir = new File("build/test/deliver");
deliverDir.mkdirs();
@@ -110,12 +112,12 @@ public class ResolveTest extends TestCas
FileUtil.forceDelete(deliverDir);
FileUtil.forceDelete(workDir);
}
-
+
public void testResolveWithRetainingArtifactName() throws Exception {
((DefaultRepositoryCacheManager) ivy.getSettings().getDefaultRepositoryCacheManager())
.setArtifactPattern(ivy.substitute("[module]/[originalname].[ext]"));
- ResolveReport report = ivy.resolve(new File("test/repositories/2/mod15.2/ivy-1.1.xml")
- , getResolveOptions(new String[] {"default"}));
+ ResolveReport report = ivy.resolve(new File("test/repositories/2/mod15.2/ivy-1.1.xml"),
+ getResolveOptions(new String[] {"default"}));
assertNotNull(report);
ArtifactDownloadReport[] dReports = report.getConfigurationReport("default")
@@ -127,11 +129,11 @@ public class ResolveTest extends TestCas
assertNotNull(artifact);
String cachePath = getArchivePathInCache(artifact);
- assertTrue("artifact name has not been retained: " + cachePath, cachePath
- .endsWith("library.jar"));
+ assertTrue("artifact name has not been retained: " + cachePath,
+ cachePath.endsWith("library.jar"));
dReports = report.getConfigurationReport("default").getDownloadReports(
- ModuleRevisionId.newInstance("org14", "mod14.1", "1.1"));
+ ModuleRevisionId.newInstance("org14", "mod14.1", "1.1"));
assertNotNull(dReports);
assertEquals("number of downloaded artifacts not correct", 1, dReports.length);
@@ -139,15 +141,15 @@ public class ResolveTest extends TestCas
assertNotNull(artifact);
cachePath = 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 testResolveWithRetainingArtifactNameAndExtraAttributes() throws Exception {
((DefaultRepositoryCacheManager) ivy.getSettings().getDefaultRepositoryCacheManager())
.setArtifactPattern(ivy.substitute("[module]/[originalname].[ext]"));
- ResolveReport report = ivy.resolve(new File("test/repositories/2/mod15.4/ivy-1.1.xml")
- , getResolveOptions(new String[] {"default"}).setValidate(false));
+ ResolveReport report = ivy.resolve(new File("test/repositories/2/mod15.4/ivy-1.1.xml"),
+ getResolveOptions(new String[] {"default"}).setValidate(false));
assertNotNull(report);
Map extra = new HashMap();
@@ -161,11 +163,11 @@ public class ResolveTest extends TestCas
assertNotNull(artifact);
String cachePath = getArchivePathInCache(artifact);
- assertTrue("artifact name has not been retained: " + cachePath, cachePath
- .endsWith("library.jar"));
+ assertTrue("artifact name has not been retained: " + cachePath,
+ cachePath.endsWith("library.jar"));
dReports = report.getConfigurationReport("default").getDownloadReports(
- ModuleRevisionId.newInstance("org14", "mod14.1", "1.1"));
+ ModuleRevisionId.newInstance("org14", "mod14.1", "1.1"));
assertNotNull(dReports);
assertEquals("number of downloaded artifacts not correct", 1, dReports.length);
@@ -173,8 +175,8 @@ public class ResolveTest extends TestCas
assertNotNull(artifact);
cachePath = 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 {
@@ -198,8 +200,8 @@ public class ResolveTest extends TestCas
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 = getSavedArtifactOrigin(artifact);
@@ -217,22 +219,22 @@ public class ResolveTest extends TestCas
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 {
((DefaultRepositoryCacheManager) ivy.getSettings().getDefaultRepositoryCacheManager())
- .setUseOrigin(true);
-
+ .setUseOrigin(true);
+
ResolveReport report = ivy.resolve(new File(
- "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"), getResolveOptions(
- new String[] {"default"}));
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
+ getResolveOptions(new String[] {"default"}));
assertNotNull(report);
ArtifactDownloadReport[] dReports = report.getConfigurationReport("default")
@@ -252,8 +254,8 @@ public class ResolveTest extends TestCas
ArtifactOrigin origin = getSavedArtifactOrigin(artifact);
File artInCache = new File(cache, getArchivePathInCache(artifact, origin));
assertFalse("should not download artifact in useOrigin mode.", artInCache.exists());
- assertEquals("location for artifact not correct.", expectedLocation,
- getArchiveFileInCache(artifact).getAbsolutePath());
+ assertEquals("location for artifact not correct.", expectedLocation,
+ getArchiveFileInCache(artifact).getAbsolutePath());
}
public void testResolveSimple() throws Exception {
@@ -270,8 +272,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
@@ -293,7 +295,7 @@ public class ResolveTest extends TestCas
getResolveOptions(new String[] {"*"}));
assertNotNull(report);
assertFalse(report.hasError());
- } catch(Throwable e) {
+ } catch (Throwable e) {
th = e;
}
assertNull(th);
@@ -317,7 +319,7 @@ public class ResolveTest extends TestCas
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
@@ -371,15 +373,15 @@ public class ResolveTest extends TestCas
// test case for IVY-465
// #M1;1.0 -> #M2;1.0
// #M2;1.0 -> {org1#mod1.2;1.1 org1#mod1.2;2.0} with
- // <conflict org="org1" module="mod1.2" rev="1.1,2.0" />
-
- ResolveReport report = ivy.resolve(
- new File("test/repositories/1/IVY-465/M1/ivys/ivy-1.0.xml"),
+ // <conflict org="org1" module="mod1.2" rev="1.1,2.0" />
+
+ ResolveReport report = ivy.resolve(new File(
+ "test/repositories/1/IVY-465/M1/ivys/ivy-1.0.xml"),
getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
- ArtifactDownloadReport[] adrs =
- report.getConfigurationReport("default").getDownloadedArtifactsReports();
+
+ ArtifactDownloadReport[] adrs = report.getConfigurationReport("default")
+ .getDownloadedArtifactsReports();
assertEquals(2, adrs.length);
assertEquals("1.1", adrs[0].getArtifact().getId().getRevision());
assertEquals("2.0", adrs[1].getArtifact().getId().getRevision());
@@ -390,7 +392,7 @@ public class ResolveTest extends TestCas
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/ivysettings.xml"));
((FileSystemResolver) ivy.getSettings().getResolver("1"))
- .setDescriptor(FileSystemResolver.DESCRIPTOR_REQUIRED);
+ .setDescriptor(FileSystemResolver.DESCRIPTOR_REQUIRED);
ResolveReport report = ivy.resolve(new File(
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
getResolveOptions(new String[] {"*"}));
@@ -423,8 +425,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
assertTrue(getIvyFileInCache(
@@ -447,8 +449,8 @@ public class ResolveTest extends TestCas
ivy.getSettings().validate();
ResolveReport report = ivy.resolve(new File(
- "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"), getResolveOptions(ivy
- .getSettings(), new String[] {"*"}));
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
+ getResolveOptions(ivy.getSettings(), new String[] {"*"}));
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
@@ -459,8 +461,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(ivy, mrid).exists());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
@@ -496,8 +498,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(ivy, mrid).exists());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
@@ -509,9 +511,8 @@ public class ResolveTest extends TestCas
// set up repository
FileUtil.forceDelete(new File("build/testCache2"));
- FileUtil.copy(
- new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"),
- new File("build/testCache2/mod1.2-1.5.jar"), null);
+ FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), new File(
+ "build/testCache2/mod1.2-1.5.jar"), null);
// we first do a simple resolve so that module is in cache
ResolveReport report = ivy.resolve(new File(
@@ -520,9 +521,9 @@ public class ResolveTest extends TestCas
assertFalse(report.hasError());
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.5")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
// now we clean the repository to simulate repo not available (network pb for instance)
FileUtil.forceDelete(new File("build/testCache2"));
@@ -531,11 +532,11 @@ public class ResolveTest extends TestCas
report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
+
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.5")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
}
public void testDynamicFromCacheWithMD() throws Exception {
@@ -547,12 +548,10 @@ public class ResolveTest extends TestCas
// set up repository
FileUtil.forceDelete(new File("build/testCache2"));
- FileUtil.copy(
- ResolveTest.class.getResourceAsStream("ivy-mod1.2-1.5.xml"),
- new File("build/testCache2/ivy-mod1.2-1.5.xml"), null);
- FileUtil.copy(
- new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"),
- new File("build/testCache2/mod1.2-1.5.jar"), null);
+ FileUtil.copy(ResolveTest.class.getResourceAsStream("ivy-mod1.2-1.5.xml"), new File(
+ "build/testCache2/ivy-mod1.2-1.5.xml"), null);
+ FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), new File(
+ "build/testCache2/mod1.2-1.5.jar"), null);
// we first do a simple resolve so that module is in cache
ResolveReport report = ivy.resolve(new File(
@@ -561,9 +560,9 @@ public class ResolveTest extends TestCas
assertFalse(report.hasError());
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.5")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
// now we clean the repository to simulate repo not available (network pb for instance)
FileUtil.forceDelete(new File("build/testCache2"));
@@ -572,11 +571,11 @@ public class ResolveTest extends TestCas
report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
+
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.5")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
}
public void testDynamicFromCacheWithMDAfterOneTTLExpiration() throws Exception {
@@ -589,12 +588,10 @@ public class ResolveTest extends TestCas
// set up repository
FileUtil.forceDelete(new File("build/testCache2"));
- FileUtil.copy(
- ResolveTest.class.getResourceAsStream("ivy-mod1.2-1.5.xml"),
- new File("build/testCache2/ivy-mod1.2-1.5.xml"), null);
- FileUtil.copy(
- new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"),
- new File("build/testCache2/mod1.2-1.5.jar"), null);
+ FileUtil.copy(ResolveTest.class.getResourceAsStream("ivy-mod1.2-1.5.xml"), new File(
+ "build/testCache2/ivy-mod1.2-1.5.xml"), null);
+ FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), new File(
+ "build/testCache2/mod1.2-1.5.jar"), null);
// we first do a simple resolve so that module is in cache
ResolveReport report = ivy.resolve(new File(
@@ -603,23 +600,23 @@ public class ResolveTest extends TestCas
assertFalse(report.hasError());
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.5")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
// now we wait for ttl expiration
Thread.sleep(700);
-
+
// we resolve again, it should work fine
report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
+
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.5")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
-
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
+
// now we clean the repository to simulate repo not available (network pb for instance)
FileUtil.forceDelete(new File("build/testCache2"));
@@ -627,11 +624,11 @@ public class ResolveTest extends TestCas
report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
+
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.5")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
}
public void testDynamicFromCacheWithTTL0() throws Exception {
@@ -642,9 +639,8 @@ public class ResolveTest extends TestCas
// set up repository
FileUtil.forceDelete(new File("build/testCache2"));
- FileUtil.copy(
- new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"),
- new File("build/testCache2/mod1.2-1.5.jar"), null);
+ FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), new File(
+ "build/testCache2/mod1.2-1.5.jar"), null);
// we first do a simple resolve so that module is in cache
ResolveReport report = ivy.resolve(new File(
@@ -653,24 +649,23 @@ public class ResolveTest extends TestCas
assertFalse(report.hasError());
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.5")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
// now we update the repository
- FileUtil.copy(
- new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"),
- new File("build/testCache2/mod1.2-1.6.jar"), null);
+ FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), new File(
+ "build/testCache2/mod1.2-1.6.jar"), null);
// now do a new resolve: it should not use cached data
report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
+
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.6")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.6")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
}
public void testDynamicFromCacheWithTTL() throws Exception {
@@ -678,14 +673,13 @@ public class ResolveTest extends TestCas
Ivy ivy = ivyTestCache();
ivy.getSettings().setVariable("ivy.cache.ttl.default", "10s", true);
((DefaultRepositoryCacheManager) ivy.getSettings().getDefaultRepositoryCacheManager())
- .addTTL(ModuleRevisionId.newInstance("org1", "*", "*").getAttributes(),
- ExactPatternMatcher.INSTANCE, 500);
+ .addTTL(ModuleRevisionId.newInstance("org1", "*", "*").getAttributes(),
+ ExactPatternMatcher.INSTANCE, 500);
// set up repository
FileUtil.forceDelete(new File("build/testCache2"));
- FileUtil.copy(
- new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"),
- new File("build/testCache2/mod1.2-1.5.jar"), null);
+ FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), new File(
+ "build/testCache2/mod1.2-1.5.jar"), null);
// we first do a simple resolve so that module is in cache
ResolveReport report = ivy.resolve(new File(
@@ -694,20 +688,19 @@ public class ResolveTest extends TestCas
assertFalse(report.hasError());
// now we update the repository
- FileUtil.copy(
- new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"),
- new File("build/testCache2/mod1.2-1.6.jar"), null);
+ FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), new File(
+ "build/testCache2/mod1.2-1.6.jar"), null);
// now do a new resolve: it should use cached data
report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
+
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.5")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
-
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
+
// wait for org1 TTL to expire
Thread.sleep(700);
@@ -715,14 +708,13 @@ public class ResolveTest extends TestCas
report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
+
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.6")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.6")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
}
-
public void testRefreshDynamicFromCache() throws Exception {
// mod1.4;1.0.2 depends on mod1.2;[1.0,2.0[
Ivy ivy = ivyTestCache();
@@ -730,9 +722,8 @@ public class ResolveTest extends TestCas
// set up repository
FileUtil.forceDelete(new File("build/testCache2"));
- FileUtil.copy(
- new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"),
- new File("build/testCache2/mod1.2-1.5.jar"), null);
+ FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), new File(
+ "build/testCache2/mod1.2-1.5.jar"), null);
// we first do a simple resolve so that module is in cache
ResolveReport report = ivy.resolve(new File(
@@ -741,30 +732,29 @@ public class ResolveTest extends TestCas
assertFalse(report.hasError());
// now we update the repository
- FileUtil.copy(
- new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"),
- new File("build/testCache2/mod1.2-1.6.jar"), null);
+ FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), new File(
+ "build/testCache2/mod1.2-1.6.jar"), null);
// now do a new resolve: it should use cached data
report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
-
+
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.5")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
// resolve again with refresh: it should find the new version
report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
getResolveOptions(new String[] {"*"}).setRefresh(true));
assertFalse(report.hasError());
-
+
assertEquals(
- new HashSet(Arrays.asList(new ModuleRevisionId[] {
- ModuleRevisionId.newInstance("org1", "mod1.2", "1.6")})),
- report.getConfigurationReport("default").getModuleRevisionIds());
-
+ new HashSet(Arrays.asList(new ModuleRevisionId[] {ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.6")})), report.getConfigurationReport("default")
+ .getModuleRevisionIds());
+
FileUtil.forceDelete(new File("build/testCache2"));
}
@@ -781,13 +771,13 @@ public class ResolveTest extends TestCas
resolver.setName("dual");
FileSystemResolver r = new FileSystemResolver();
r.setName("1");
- r.addIvyPattern(ivy.getSettings().getBaseDir().getPath()
- + "/build/testCache2/ivy-[module]-[revision].xml");
+ r.addIvyPattern(ivy.getSettings().getBaseDir().getPath()
+ + "/build/testCache2/ivy-[module]-[revision].xml");
resolver.add(r);
r = new FileSystemResolver();
r.setName("2");
- r.addArtifactPattern(ivy.getSettings().getBaseDir().getPath()
- + "/build/testCache2/[artifact]-[revision].[ext]");
+ r.addArtifactPattern(ivy.getSettings().getBaseDir().getPath()
+ + "/build/testCache2/[artifact]-[revision].[ext]");
resolver.add(r);
ivy.getSettings().addResolver(resolver);
ivy.getSettings().setDefaultResolver("dual");
@@ -806,31 +796,30 @@ public class ResolveTest extends TestCas
// assertTrue(report.hasError());
// put necessary stuff in cache, and it should now be ok
- File ivyfile = getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"));
+ File ivyfile = getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"));
File art = getArchiveFileInCache(ivy, "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"), getResolveOptions(ivy
- .getSettings(), new String[] {"*"}));
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
+ getResolveOptions(ivy.getSettings(), new String[] {"*"}));
assertFalse(report.hasError());
}
public void testChangeCacheLayout() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/ivysettings.xml"));
- DefaultRepositoryCacheManager cacheMgr =
- (DefaultRepositoryCacheManager) ivy.getSettings().getDefaultRepositoryCacheManager();
+ DefaultRepositoryCacheManager cacheMgr = (DefaultRepositoryCacheManager) ivy.getSettings()
+ .getDefaultRepositoryCacheManager();
cacheMgr.setIvyPattern("[module]/ivy.xml");
cacheMgr.setArtifactPattern("[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"), getResolveOptions(ivy
- .getSettings(), new String[] {"*"}));
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
+ getResolveOptions(ivy.getSettings(), new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
@@ -840,11 +829,11 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(ivy, mrid).exists());
// dependencies
- assertTrue(getIvyFileInCache(ivy,
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(getIvyFileInCache(ivy, ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(new File(cache, "mod1.2/ivy.xml").exists());
- assertTrue(getArchiveFileInCache(
- ivy, "org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
+ assertTrue(getArchiveFileInCache(ivy, "org1", "mod1.2", "2.0", "mod1.2", "jar", "jar")
+ .exists());
assertTrue(new File(cache, "mod1.2.jar").exists());
}
@@ -856,36 +845,35 @@ public class ResolveTest extends TestCas
ivy.getSettings().setDefaultResolutionCacheBasedir(
new File(ivy.getSettings().getDefaultCache(), "workspace").getAbsolutePath());
ivy.getSettings().validate();
- DefaultRepositoryCacheManager cacheMgr =
- (DefaultRepositoryCacheManager) ivy.getSettings().getDefaultRepositoryCacheManager();
+ DefaultRepositoryCacheManager cacheMgr = (DefaultRepositoryCacheManager) ivy.getSettings()
+ .getDefaultRepositoryCacheManager();
cacheMgr.setIvyPattern("[module]/ivy.xml");
cacheMgr.setArtifactPattern("[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"), getResolveOptions(ivy
- .getSettings(), new String[] {"*"}));
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
+ getResolveOptions(ivy.getSettings(), new String[] {"*"}));
assertNotNull(report);
assertFalse(report.hasError());
-
+
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
assertEquals(mrid, md.getModuleRevisionId());
- assertTrue(getResolvedIvyFileInCache(ivy, mrid)
- .toString().indexOf("workspace") != -1);
+ assertTrue(getResolvedIvyFileInCache(ivy, mrid).toString().indexOf("workspace") != -1);
assertTrue(getResolvedIvyFileInCache(ivy, mrid).exists());
- assertTrue(getConfigurationResolveReportInCache(ivy,
- report.getResolveId(), "default").exists());
+ assertTrue(getConfigurationResolveReportInCache(ivy, report.getResolveId(), "default")
+ .exists());
// dependencies
- assertTrue(getIvyFileInCache(ivy,
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(getIvyFileInCache(ivy, ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(new File(cache, "repository/mod1.2/ivy.xml").exists());
- assertTrue(getArchiveFileInCache(
- ivy, "org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
+ assertTrue(getArchiveFileInCache(ivy, "org1", "mod1.2", "2.0", "mod1.2", "jar", "jar")
+ .exists());
assertTrue(new File(cache, "repository/mod1.2.jar").exists());
}
@@ -894,31 +882,31 @@ public class ResolveTest extends TestCas
ivy.configure(new File("test/repositories/ivysettings-multicache.xml"));
// 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"),
+ ResolveReport report = ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.1/ivys/ivy-0.3.xml"),
getResolveOptions(new String[] {"*"}));
assertNotNull(report);
assertFalse(report.hasError());
-
+
// dependencies
- DefaultArtifact depArtifact =
- TestHelper.newArtifact("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar");
+ DefaultArtifact depArtifact = TestHelper.newArtifact("org1", "mod1.1", "1.0", "mod1.1",
+ "jar", "jar");
ModuleRevisionId depMrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
- DefaultRepositoryCacheManager cacheMgr1 =
- (DefaultRepositoryCacheManager)ivy.getSettings().getDefaultRepositoryCacheManager();
- DefaultRepositoryCacheManager cacheMgr2 =
- (DefaultRepositoryCacheManager)ivy.getSettings().getRepositoryCacheManager("cache2");
+ DefaultRepositoryCacheManager cacheMgr1 = (DefaultRepositoryCacheManager) ivy.getSettings()
+ .getDefaultRepositoryCacheManager();
+ DefaultRepositoryCacheManager cacheMgr2 = (DefaultRepositoryCacheManager) ivy.getSettings()
+ .getRepositoryCacheManager("cache2");
// ivy file should be cached in default cache, and artifact in cache2
assertTrue(cacheMgr1.getIvyFileInCache(depMrid).exists());
assertFalse(cacheMgr1.getArchiveFileInCache(depArtifact).exists());
- assertEquals(new File(cache, "repo1/mod1.1/ivy-1.0.xml").getCanonicalFile(),
- cacheMgr1.getIvyFileInCache(depMrid).getCanonicalFile());
-
+ assertEquals(new File(cache, "repo1/mod1.1/ivy-1.0.xml").getCanonicalFile(), cacheMgr1
+ .getIvyFileInCache(depMrid).getCanonicalFile());
+
assertFalse(cacheMgr2.getIvyFileInCache(depMrid).exists());
assertTrue(cacheMgr2.getArchiveFileInCache(depArtifact).exists());
- assertEquals(new File(cache, "repo2/mod1.1-1.0/mod1.1.jar").getCanonicalFile(),
- cacheMgr2.getArchiveFileInCache(depArtifact).getCanonicalFile());
+ assertEquals(new File(cache, "repo2/mod1.1-1.0/mod1.1.jar").getCanonicalFile(), cacheMgr2
+ .getArchiveFileInCache(depArtifact).getCanonicalFile());
}
public void testForceLocal() throws Exception {
@@ -932,20 +920,20 @@ public class ResolveTest extends TestCas
assertFalse(report.hasError());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ 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", "local-20080708091023")).exists());
- assertTrue(getArchiveFileInCache("org1", "mod1.2", "local-20080708091023",
- "mod1.2", "jar", "jar").exists());
+ assertTrue(getArchiveFileInCache("org1", "mod1.2", "local-20080708091023", "mod1.2", "jar",
+ "jar").exists());
assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar")
- .exists());
+ .exists());
- assertFalse(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
@@ -962,25 +950,25 @@ public class ResolveTest extends TestCas
// dependencies
assertTrue(getIvyFileInCache(
ModuleRevisionId.newInstance("org2", "mod2.1", "0.3-local-20050213110000")).exists());
- assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3-local-20050213110000",
- "mod2.1", "jar", "jar").exists());
+ assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3-local-20050213110000", "mod2.1",
+ "jar", "jar").exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.1")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.1"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.1", "mod1.1", "jar", "jar").exists());
assertTrue(getIvyFileInCache(
ModuleRevisionId.newInstance("org1", "mod1.2", "local-20080708091023")).exists());
- assertTrue(getArchiveFileInCache("org1", "mod1.2", "local-20080708091023",
- "mod1.2", "jar", "jar").exists());
+ assertTrue(getArchiveFileInCache("org1", "mod1.2", "local-20080708091023", "mod1.2", "jar",
+ "jar").exists());
assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar")
- .exists());
+ .exists());
- assertFalse(getIvyFileInCache(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.4")).exists());
- assertFalse(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.1", "0.4"))
+ .exists());
+ assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
@@ -988,14 +976,13 @@ public class ResolveTest extends TestCas
// mod2.1 depends on mod1.1 which depends on mod1.2
// a local build for mod1.2 is available
// we do a first resolve without local build so that cache contains mod1.2;2.0 module
- ivy.resolve(new File(
- "test/repositories/1/org2/mod2.1/ivys/ivy-0.3.xml"),
+ ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.xml"),
getResolveOptions(new String[] {"*"}));
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
-
+
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/ivysettings-local.xml"));
ResolveReport report = ivy.resolve(new File(
@@ -1004,17 +991,17 @@ public class ResolveTest extends TestCas
assertFalse(report.hasError());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ 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", "local-20080708091023")).exists());
- assertTrue(getArchiveFileInCache("org1", "mod1.2", "local-20080708091023",
- "mod1.2", "jar", "jar").exists());
+ assertTrue(getArchiveFileInCache("org1", "mod1.2", "local-20080708091023", "mod1.2", "jar",
+ "jar").exists());
assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar")
- .exists());
+ .exists());
}
public void testResolveExtends() throws Exception {
@@ -1031,8 +1018,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies from default
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
@@ -1050,8 +1037,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies from default
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
@@ -1074,8 +1061,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
@@ -1104,12 +1091,12 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org6", "mod6.1", "0.4")).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(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
@@ -1123,8 +1110,8 @@ public class ResolveTest extends TestCas
// 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[] {"*"}));
+ 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();
@@ -1169,8 +1156,8 @@ public class ResolveTest extends TestCas
assertNotNull(crr);
assertEquals(1, crr.getArtifactsNumber());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.2")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
}
@@ -1203,16 +1190,16 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org6", "mod6.1", "0.5")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org6", "mod6.1", "0.5"))
+ .exists());
assertTrue(getArchiveFileInCache("org6", "mod6.1", "0.5", "mod6.1", "jar", "jar").exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ 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.1")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
@@ -1248,16 +1235,16 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org6", "mod6.1", "0.4")).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(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
}
@@ -1283,7 +1270,7 @@ public class ResolveTest extends TestCas
// #mod2.6;0.12 -> {#mod1.6;1.0.4 #mod2.5;0.6.2 }
// #mod1.6;1.0.4 -> #mod1.3;3.0 artifacts A and B
// #mod2.5;0.6.2 -> #mod1.3;3.1 artifact C
- // #mod1.3;3.1 has only A and C artifacts, not B.
+ // #mod1.3;3.1 has only A and C artifacts, not B.
// Both A and C should be downloaded, and a message should tell that B was not available.
ResolveReport report = ivy.resolve(new File(
"test/repositories/1/org2/mod2.6/ivys/ivy-0.12.xml"),
@@ -1311,9 +1298,12 @@ public class ResolveTest extends TestCas
assertEquals(3,
crr.getDownloadReports(ModuleRevisionId.newInstance("medicel", "C", "1.0")).length);
- assertTrue(getArchiveFileInCache(ivy, "medicel", "C", "1.0", "lib_c_a", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache(ivy, "medicel", "C", "1.0", "lib_c_b", "jar", "jar").exists());
- assertTrue(getArchiveFileInCache(ivy, "medicel", "C", "1.0", "lib_c_d", "jar", "jar").exists());
+ assertTrue(getArchiveFileInCache(ivy, "medicel", "C", "1.0", "lib_c_a", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache(ivy, "medicel", "C", "1.0", "lib_c_b", "jar", "jar")
+ .exists());
+ assertTrue(getArchiveFileInCache(ivy, "medicel", "C", "1.0", "lib_c_d", "jar", "jar")
+ .exists());
}
public void testResolveSeveralDefaultWithArtifactsAndConfs2() throws Exception {
@@ -1327,30 +1317,30 @@ public class ResolveTest extends TestCas
// 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(ivy, "medicel", "module_a", "local", "lib_a_a", "jar", "jar")
- .exists());
- assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_b", "jar", "jar")
- .exists());
- assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_c", "jar", "jar")
- .exists());
- assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_d", "jar", "jar")
- .exists());
- assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_e", "jar", "jar")
- .exists());
- assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_f", "jar", "jar")
- .exists());
- assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_g", "jar", "jar")
- .exists());
- assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_h", "jar", "jar")
- .exists());
- assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_i", "jar", "jar")
- .exists());
+ assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_a", "jar",
+ "jar").exists());
+ assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_b", "jar",
+ "jar").exists());
+ assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_c", "jar",
+ "jar").exists());
+ assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_d", "jar",
+ "jar").exists());
+ assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_e", "jar",
+ "jar").exists());
+ assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_f", "jar",
+ "jar").exists());
+ assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_g", "jar",
+ "jar").exists());
+ assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_h", "jar",
+ "jar").exists());
+ assertTrue(getArchiveFileInCache(ivy, "medicel", "module_a", "local", "lib_a_i", "jar",
+ "jar").exists());
}
-
public void testResolveWithStartPublicConf() throws Exception {
// mod2.2 depends on mod1.3 and selects its artifacts
ResolveReport report = ivy.resolve(new File(
@@ -1365,14 +1355,13 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.3", "3.0")).exists());
+ assertTrue(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());
+ assertTrue(!getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3", "jar", "jar").exists());
}
public void testResolveWithPrivateConf() throws Exception {
@@ -1388,17 +1377,15 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.3", "3.0")).exists());
+ assertTrue(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());
+ assertTrue(!getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3", "jar", "jar").exists());
}
-
-
+
public void testResolveDefaultWithArtifactsConf1() throws Exception {
// mod2.2 depends on mod1.3 and selects its artifacts
ResolveReport report = ivy.resolve(new File(
@@ -1413,8 +1400,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.3", "3.0")).exists());
+ assertTrue(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")
@@ -1435,8 +1422,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.3", "3.0")).exists());
+ assertTrue(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")
@@ -1444,9 +1431,6 @@ public class ResolveTest extends TestCas
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(
@@ -1461,8 +1445,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.3", "3.0")).exists());
+ assertTrue(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")
@@ -1483,8 +1467,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+ assertTrue(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());
@@ -1503,8 +1487,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+ assertTrue(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());
@@ -1523,8 +1507,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+ assertTrue(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());
@@ -1539,8 +1523,8 @@ public class ResolveTest extends TestCas
getResolveOptions(new String[] {"*"}));
assertFalse(report.hasError());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+ assertTrue(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());
}
@@ -1558,8 +1542,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+ assertTrue(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());
@@ -1578,8 +1562,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+ assertTrue(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());
@@ -1598,8 +1582,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+ assertTrue(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());
@@ -1618,8 +1602,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+ assertTrue(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());
@@ -1638,8 +1622,8 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
+ assertTrue(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());
@@ -1659,12 +1643,12 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ 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(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
@@ -1682,23 +1666,25 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ 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", "1.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "1.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "1.0", "mod1.2", "jar", "jar").exists());
}
/**
* Testcase for IVY-1131.
*/
- public void testResolveTransitiveDependenciesWithOverrideAndDynamicResolveMode() throws Exception {
+ public void testResolveTransitiveDependenciesWithOverrideAndDynamicResolveMode()
+ 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.6.xml"),
- getResolveOptions(new String[] {"*"}).setResolveMode(ResolveOptions.RESOLVEMODE_DYNAMIC));
+ getResolveOptions(new String[] {"*"})
+ .setResolveMode(ResolveOptions.RESOLVEMODE_DYNAMIC));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
@@ -1708,20 +1694,20 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ 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", "1.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "1.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "1.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"), getResolveOptions(
- new String[] {"*"}).setTransitive(false));
+ "test/repositories/1/org2/mod2.1/ivys/ivy-0.3.xml"),
+ getResolveOptions(new String[] {"*"}).setTransitive(false));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
@@ -1731,12 +1717,12 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
- assertFalse(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
@@ -1744,7 +1730,8 @@ public class ResolveTest extends TestCas
ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-225.xml"),
getResolveOptions(new String[] {"default"}));
- List revisions = new ArrayList(report.getConfigurationReport("default").getModuleRevisionIds());
+ List revisions = new ArrayList(report.getConfigurationReport("default")
+ .getModuleRevisionIds());
assertTrue("number of revisions is not correct", revisions.size() >= 3);
int mod12Index = revisions.indexOf(ModuleRevisionId.newInstance("org1", "mod1.2", "1.1"));
@@ -1753,8 +1740,10 @@ public class ResolveTest extends TestCas
// verify the order of the modules in the ivy file
assertTrue("[ org1 | mod1.2 | 1.1 ] was not found", mod12Index > -1);
- assertTrue("[ org1 | mod1.2 | 1.1 ] must come before [ org3 | mod3.2 | 1.4 ]", mod12Index < mod32Index);
- assertTrue("[ org3 | mod3.2 | 1.4 ] must come before [ org5 | mod5.1 | 4.2 ]", mod32Index < mod51Index);
+ assertTrue("[ org1 | mod1.2 | 1.1 ] must come before [ org3 | mod3.2 | 1.4 ]",
+ mod12Index < mod32Index);
+ assertTrue("[ org3 | mod3.2 | 1.4 ] must come before [ org5 | mod5.1 | 4.2 ]",
+ mod32Index < mod51Index);
}
public void testDisableTransitivityPerConfiguration() throws Exception {
@@ -1766,12 +1755,12 @@ public class ResolveTest extends TestCas
getResolveOptions(new String[] {"compile"}));
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
- assertFalse(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertFalse(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
@@ -1779,13 +1768,13 @@ public class ResolveTest extends TestCas
getResolveOptions(new String[] {"runtime"}));
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(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"),
+ ResolveReport r = ivy.resolve(
+ new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.1.xml"),
getResolveOptions(new String[] {"runtime", "compile"}));
assertFalse(r.hasError());
assertEquals(1, r.getConfigurationReport("compile").getArtifactsNumber());
@@ -1802,12 +1791,12 @@ public class ResolveTest extends TestCas
getResolveOptions(new String[] {"compile"}));
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
- assertFalse(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertFalse(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
@@ -1815,13 +1804,13 @@ public class ResolveTest extends TestCas
getResolveOptions(new String[] {"runtime"}));
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(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"),
+ ResolveReport r = ivy.resolve(
+ new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.2.xml"),
getResolveOptions(new String[] {"runtime", "compile"}));
assertFalse(r.hasError());
assertEquals(1, r.getConfigurationReport("compile").getArtifactsNumber());
@@ -1838,12 +1827,12 @@ public class ResolveTest extends TestCas
getResolveOptions(new String[] {"compile"}));
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
- assertFalse(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertFalse(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
@@ -1851,13 +1840,13 @@ public class ResolveTest extends TestCas
getResolveOptions(new String[] {"runtime"}));
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertTrue(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"),
+ ResolveReport r = ivy.resolve(
+ new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.3.xml"),
getResolveOptions(new String[] {"runtime", "compile"}));
assertFalse(r.hasError());
assertEquals(1, r.getConfigurationReport("compile").getArtifactsNumber());
@@ -1871,27 +1860,29 @@ public class ResolveTest extends TestCas
// 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")
- , getResolveOptions(new String[] {"*"}));
+ ResolveReport r = ivy.resolve(new File("test/repositories/1/org2/mod2.2/ivys/ivy-0.6.xml"),
+ getResolveOptions(new String[] {"*"}));
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());
+ 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());
// 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());
+ 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());
// 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 {
@@ -1903,36 +1894,39 @@ public class ResolveTest extends TestCas
// 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")
- , getResolveOptions(new String[] {"A", "B", "compile"}));
+ ResolveReport r = ivy.resolve(new File("test/repositories/1/org2/mod2.2/ivys/ivy-0.7.xml"),
+ 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());
+ 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());
// 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());
+ 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());
// 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());
+ 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());
}
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")
- , getResolveOptions(new String[] {"*"}));
+ ResolveReport report = ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.0.xml"),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
@@ -1942,26 +1936,25 @@ public class ResolveTest extends TestCas
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ 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(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org3", "mod3.1", "1.0")).exists());
+ assertTrue(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")
- , getResolveOptions(new String[] {"*"}));
+ ResolveReport report = ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.1.xml"),
+ getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
@@ -1973,13 +1966,13 @@ public class ResolveTest extends TestCas
// 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);
+ 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 = getConfigurationResolveReportInCache(ResolveOptions
- .getDefaultResolveId(md), "default");
+ File r = getConfigurationResolveReportInCache(ResolveOptions.getDefaultResolveId(md),
+ "default");
assertTrue(r.exists());
final boolean[] found = new boolean[] {false};
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
@@ -1993,18 +1986,18 @@ public class ResolveTest extends TestCas
});
assertTrue(found[0]); // the report should contain the evicted revision
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ 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("org3", "mod3.1", "1.1")).exists());
+ assertTrue(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(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
}
@@ -2013,20 +2006,20 @@ public class ResolveTest extends TestCas
// - 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")
- , getResolveOptions(new String[] {"*"}));
+ ResolveReport report = ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.14.xml"),
+ getResolveOptions(new String[] {"*"}));
// 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);
+ assertEquals(0,
+ crr.getDownloadReports(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).length);
+ assertEquals(1,
+ crr.getDownloadReports(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).length);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org4", "mod4.1", "4.14");
- File r = getConfigurationResolveReportInCache(ResolveOptions
- .getDefaultResolveId(mrid.getModuleId()), "default");
+ File r = getConfigurationResolveReportInCache(
+ ResolveOptions.getDefaultResolveId(mrid.getModuleId()), "default");
assertTrue(r.exists());
final boolean[] found = new boolean[] {false};
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
@@ -2040,18 +2033,18 @@ public class ResolveTest extends TestCas
});
assertTrue(found[0]); // the report should contain the evicted revision
- assertTrue(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+ 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("org3", "mod3.1", "1.1")).exists());
+ assertTrue(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(getIvyFileInCache(
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).exists());
+ assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1"))
+ .exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
}
@@ -2069,56 +2062,58 @@ public class ResolveTest extends TestCas
// dependencies
[... 3212 lines stripped ...]