ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r949860 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/plugins/version/LatestVersionMatcher.java test/java/org/apache/ivy/plugins/version/LatestVersionMatcherTest.java
Date Mon, 31 May 2010 20:57:10 GMT
Author: maartenc
Date: Mon May 31 20:57:10 2010
New Revision: 949860

URL: http://svn.apache.org/viewvc?rev=949860&view=rev
Log:
FIX: LatestVersionMatcher.needModuleDescriptor() does not honor custom statuses (IVY-1170)
(thanks to Carl Quinn)

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/version/LatestVersionMatcherTest.java
  (with props)
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/LatestVersionMatcher.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=949860&r1=949859&r2=949860&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Mon May 31 20:57:10 2010
@@ -125,6 +125,7 @@ for detailed view of each issue, please 
 - IMPROVEMENT: Trace a message when a property file referenced from the settings doesn't
exixts (IVY-1074)
 - IMPROVEMENT: use defaultconf in combination with defaultconfmapping (IVY-1135) (thanks
to Jon Schneider)
 
+- FIX: LatestVersionMatcher.needModuleDescriptor() does not honor custom statuses (IVY-1170)
(thanks to Carl Quinn)
 - FIX: Proxy authentication could fail when using commons-httpclient 
 - FIX: Packager resolver always extracts all files from archives even when the packaging
instructions contains include tags (IVY-1179) (thanks to Stefan De Boey)
 - FIX: Ivy cannot connect to URLs with '_' in their hostname

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/LatestVersionMatcher.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/LatestVersionMatcher.java?rev=949860&r1=949859&r2=949860&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/LatestVersionMatcher.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/LatestVersionMatcher.java Mon
May 31 20:57:10 2010
@@ -18,9 +18,11 @@
 package org.apache.ivy.plugins.version;
 
 import java.util.Comparator;
+import java.util.List;
 
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.module.status.Status;
 import org.apache.ivy.core.module.status.StatusManager;
 
 public class LatestVersionMatcher extends AbstractVersionMatcher {
@@ -37,7 +39,10 @@ public class LatestVersionMatcher extend
     }
 
     public boolean needModuleDescriptor(ModuleRevisionId askedMrid, ModuleRevisionId foundMrid)
{
-        return !"latest.integration".equals(askedMrid.getRevision());
+        List statuses = StatusManager.getCurrent().getStatuses();
+        Status lowest = (Status) statuses.get(statuses.size() - 1);
+        String latestLowest = "latest." + lowest.getName();
+        return !latestLowest.equals(askedMrid.getRevision());
     }
 
     public boolean accept(ModuleRevisionId askedMrid, ModuleDescriptor foundMD) {

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/version/LatestVersionMatcherTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/version/LatestVersionMatcherTest.java?rev=949860&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/version/LatestVersionMatcherTest.java
(added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/version/LatestVersionMatcherTest.java
Mon May 31 20:57:10 2010
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.version;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.module.status.Status;
+import org.apache.ivy.core.module.status.StatusManager;
+
+public class LatestVersionMatcherTest extends TestCase {
+    private LatestVersionMatcher vm = new LatestVersionMatcher();
+
+    public void testNeedModuleDescriptorStandardStatus() throws Exception {
+        assertNeed("latest.release", true);
+        assertNeed("latest.milestone", true);
+        assertNeed("latest.integration", false);
+    }
+    
+    public void testNeedModuleDescriptorCustomStatus() throws Exception {
+        StatusManager.getCurrent().addStatus(new Status("release", false));
+        StatusManager.getCurrent().addStatus(new Status("snapshot", true));
+
+        assertNeed("latest.release", true);
+        assertNeed("latest.snapshot", false);
+    }
+
+    // assertion helper methods
+    private void assertNeed(String askedVersion, boolean b) {
+        assertEquals(b, vm.needModuleDescriptor(ModuleRevisionId.newInstance("org", "name",
askedVersion), null));
+    }
+}

Propchange: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/version/LatestVersionMatcherTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message