Author: xavier
Date: Mon Jul 28 10:33:12 2008
New Revision: 680417

URL: http://svn.apache.org/viewvc?rev=680417&view=rev
Log:
FIX: Cache can't distinguish artifacts with classifiers (IVY-803) (thanks to 
James P. White)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=680417&r1=680416&r2=680417&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Mon Jul 28 10:33:12 2008
@@ -66,6 +66,7 @@
        Johan Stuyts
        Jason Trump
        Tjeerd Verhagen
+       James P. White
        John Williams
        Patrick Woodworth
        Jaroslaw Wypychowski
@@ -99,6 +100,7 @@
 - IMPROVEMENT: Smarter determination if an expression is exact or not for 
RegexpPatternMatcher and GlobPatternMatcher
 - IMPROVEMENT: Check branch consistency during resolve (IVY-858)
 
+- FIX: Cache can't distinguish artifacts with classifiers (IVY-803) (thanks to 
James P. White)
 - FIX: Reports showing double dependencies in certain cases (IVY-578)
 - FIX: Dynamic revision resolve does not throw error when configuration is 
missing (IVY-861)
 - FIX: Referenced resolver not found in macro (IVY-860)

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java?rev=680417&r1=680416&r2=680417&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
 (original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
 Mon Jul 28 10:33:12 2008
@@ -60,7 +60,7 @@
 
 public class DefaultRepositoryCacheManager implements RepositoryCacheManager, 
IvySettingsAware {
     private static final String DEFAULT_ARTIFACT_PATTERN =
-        
"[organisation]/[module](/[branch])/[type]s/[artifact]-[revision](.[ext])";
+        
"[organisation]/[module](/[branch])/[type]s/[artifact]-[revision](-[classifier])(.[ext])";
 
     private static final String DEFAULT_DATA_FILE_PATTERN = 
         "[organisation]/[module](/[branch])/ivydata-[revision].properties";

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=680417&r1=680416&r2=680417&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 
Mon Jul 28 10:33:12 2008
@@ -21,6 +21,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -3686,8 +3687,11 @@
         // dependencies
         assertTrue(getIvyFileInCache(
             ModuleRevisionId.newInstance("org.apache", "test-classified", 
"1.0")).exists());
-        assertTrue(getArchiveFileInCache(ivy, "org.apache", "test-classified",
-            "1.0", "test-classified", "jar", "jar").exists());
+        
+        Map cmap = new HashMap();
+        cmap.put("classifier", "asl");
+        assertTrue(getArchiveFileInCache(ivy, "org.apache", "test-classified", 
null /* branch */
+                    , "1.0", "test-classified", "jar", "jar", cmap).exists());
     }
 
     public void testResolveMaven2GetSources() throws Exception {
@@ -3704,8 +3708,8 @@
         File jarFileInCache = getArchiveFileInCache(ivy, "org.apache", 
"test-sources",
             "1.0", "test-sources", "jar", "jar");
         assertTrue(jarFileInCache.exists());
-        File sourceFileInCache = getArchiveFileInCache(ivy, "org.apache", 
"test-sources",
-            "1.0", "test-sources", "source", "jar");
+        File sourceFileInCache = getArchiveFileInCache(ivy, "org.apache", 
"test-sources", null,
+            "1.0", "test-sources", "source", "jar", 
Collections.singletonMap("classifier", "sources"));
         assertTrue(sourceFileInCache.exists());
         assertTrue(jarFileInCache.length() != sourceFileInCache.length());
     }
@@ -3724,12 +3728,12 @@
         File jarFileInCache = getArchiveFileInCache(ivy, "org.apache", 
"test-sources",
             "1.0", "test-sources", "jar", "jar");
         assertTrue(jarFileInCache.exists());
-        File sourceFileInCache = getArchiveFileInCache(ivy, "org.apache", 
"test-sources",
-            "1.0", "test-sources", "source", "jar");
+        File sourceFileInCache = getArchiveFileInCache(ivy, "org.apache", 
"test-sources", null,
+            "1.0", "test-sources", "source", "jar", 
Collections.singletonMap("classifier", "sources"));
         assertTrue(sourceFileInCache.exists());
         assertTrue(jarFileInCache.length() != sourceFileInCache.length());
-        File javadocFileInCache = getArchiveFileInCache(ivy, "org.apache", 
"test-sources",
-            "1.0", "test-sources", "javadoc", "jar");
+        File javadocFileInCache = getArchiveFileInCache(ivy, "org.apache", 
"test-sources", null,
+            "1.0", "test-sources", "javadoc", "jar", 
Collections.singletonMap("classifier", "javadoc"));
         assertTrue(javadocFileInCache.exists());
         assertTrue(jarFileInCache.length() != javadocFileInCache.length());
     }
@@ -4375,6 +4379,15 @@
             String artifactName, String type, String ext) {
         return getArchiveFileInCache(ivy, organisation, module, revision, 
artifactName, type, ext);
     }
+    
+    private File getArchiveFileInCache(Ivy ivy, String organisation, String 
module, String branch, String revision,
+            String artifactName, String type, String ext, Map extraAttrs) {
+        ModuleRevisionId mrid = ModuleRevisionId.newInstance(organisation, 
module,
+            branch, revision);
+        DefaultArtifact artifact = new DefaultArtifact(mrid, new Date(), 
artifactName, type, ext, extraAttrs);
+        return TestHelper.getRepositoryCacheManager(ivy, 
mrid).getArchiveFileInCache(artifact);
+    }
+        
 
     private File getArchiveFileInCache(Ivy ivy, String organisation, String 
module, String revision,
             String artifactName, String type, String ext) {


Reply via email to