You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2010/02/27 00:52:34 UTC

svn commit: r916871 - /ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java

Author: maartenc
Date: Fri Feb 26 23:52:34 2010
New Revision: 916871

URL: http://svn.apache.org/viewvc?rev=916871&view=rev
Log:
FIX: artifact-lock strategy could hang Ivy when resolving dynamic revisions (junit test)

Modified:
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java

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=916871&r1=916870&r2=916871&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 Fri Feb 26 23:52:34 2010
@@ -2543,6 +2543,31 @@
         assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
     }
 
+    public void testResolveWithDynamicRevisionsAndArtifactLockStrategy() throws Exception {
+        // mod4.1 v 4.5 depends on
+        // - mod1.2 v 1+ and forces it
+        // - mod3.1 v 1.2 which depends on mod1.2 v 2+
+        Ivy ivy = new Ivy();
+        ivy.configure(new File("test/repositories/ivysettings-artifact-lock.xml"));
+        ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.5.xml")
+                .toURL(), getResolveOptions(new String[] {"*"}));
+
+        List lockFiles = new ArrayList();
+        findLockFiles(cache, lockFiles);
+        assertTrue("There were lockfiles left in the cache: " + lockFiles, lockFiles.isEmpty());
+    }
+    
+    private void findLockFiles(File dir, List result) {
+        File[] files = dir.listFiles();
+        for (int i = 0; i < files.length; i++) {
+            if (files[i].isDirectory()) {
+                findLockFiles(files[i], result);
+            } else if (files[i].getName().endsWith(".lck")) {
+                result.add(files[i]);
+            }
+        }
+    }
+
     public void testResolveForceWithDynamicRevisions() throws Exception {
         // mod4.1 v 4.5 depends on
         // - mod1.2 v 1+ and forces it