incubator-ivy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r600190 - in /incubator/ivy/core/trunk: src/java/org/apache/ivy/core/resolve/ src/java/org/apache/ivy/plugins/conflict/ test/java/org/apache/ivy/plugins/conflict/
Date Sat, 01 Dec 2007 20:15:40 GMT
Author: xavier
Date: Sat Dec  1 12:15:37 2007
New Revision: 600190

URL: http://svn.apache.org/viewvc?rev=600190&view=rev
Log:
- use a LinkedHashSet instead of HashSet for conflicts to make behavior consistent between
JRE and easier to test
- add a test and fix a bug in LatestCompatibleConflictManager revealed with java 6

Added:
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-latest-compatible-7.xml
  (with props)
Modified:
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManagerTest.java

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?rev=600190&r1=600189&r2=600190&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java Sat Dec
 1 12:15:37 2007
@@ -865,7 +865,7 @@
 
     private Collection computeConflicts(VisitNode node, VisitNode ancestor, String conf,
             Collection toevict, Collection resolvedNodes) {
-        Collection conflicts = new HashSet();
+        Collection conflicts = new LinkedHashSet();
         conflicts.add(node.getNode());
         if (resolvedNodes.removeAll(toevict)) {
             // parent.resolved(node.mid) is not up to date:

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java?rev=600190&r1=600189&r2=600190&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
(original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
Sat Dec  1 12:15:37 2007
@@ -97,8 +97,11 @@
             }
             // no incompatibility nor dynamic version found, let's return the latest static
version
             if (conflicts.size() == 2) {
-                // very common special case of only two modules in conflict
-                return Collections.singleton(conflicts.iterator().next());
+                // very common special case of only two modules in conflict, 
+                // let's return the second one (static)
+                Iterator it = conflicts.iterator();
+                it.next();
+                return Collections.singleton(it.next());
             }
             Collection newConflicts = new LinkedHashSet(conflicts);
             newConflicts.remove(node);

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManagerTest.java?rev=600190&r1=600189&r2=600190&view=diff
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManagerTest.java
(original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManagerTest.java
Sat Dec  1 12:15:37 2007
@@ -121,6 +121,15 @@
         resolveAndAssert("ivy-latest-compatible-6.xml", "#B;3.4, #C;4.6, #D;2.5");
     }
 
+    public void testCompatibilityResolve7() throws Exception {
+        /* Test data: (same as 1, but with reverse dependencies order 
+            #A;7-> { #C;[2.0,2.5] #B;1.4 }
+            #B;1.4->#D;1.5
+            #C;2.5->#D;[1.0,1.6]
+         */
+        resolveAndAssert("ivy-latest-compatible-7.xml", "#B;1.4, #C;2.5, #D;1.5");
+    }
+
 
     public void testConflict() throws Exception {
         /* Test data:

Added: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-latest-compatible-7.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-latest-compatible-7.xml?rev=600190&view=auto
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-latest-compatible-7.xml
(added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-latest-compatible-7.xml
Sat Dec  1 12:15:37 2007
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   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.    
+-->
+<ivy-module version="1.0"> 
+        <info organisation="" module="A" revision="1" status="release"/>
+        <dependencies>
+            <dependency name="C" rev="[2.0,2.5]"/>
+            <dependency name="B" rev="1.4"/>
+        </dependencies>
+</ivy-module>

Propchange: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/ivy-latest-compatible-7.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message