Author: maartenc
Date: Sat Jan 13 15:27:42 2007
New Revision: 496001

URL: http://svn.apache.org/viewvc?view=rev&rev=496001
Log:
Added junit test from IVY-388

Added:
    
incubator/ivy/trunk/test/java/org/apache/ivy/conflict/LatestConflictManagerTest.java
    incubator/ivy/trunk/test/java/org/apache/ivy/conflict/ivy-388.xml
    incubator/ivy/trunk/test/java/org/apache/ivy/conflict/ivyconf-latest.xml

Added: 
incubator/ivy/trunk/test/java/org/apache/ivy/conflict/LatestConflictManagerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/ivy/trunk/test/java/org/apache/ivy/conflict/LatestConflictManagerTest.java?view=auto&rev=496001
==============================================================================
--- 
incubator/ivy/trunk/test/java/org/apache/ivy/conflict/LatestConflictManagerTest.java
 (added)
+++ 
incubator/ivy/trunk/test/java/org/apache/ivy/conflict/LatestConflictManagerTest.java
 Sat Jan 13 15:27:42 2007
@@ -0,0 +1,63 @@
+/*
+ *  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.conflict;
+
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.Ivy;
+import org.apache.ivy.IvyNode;
+import org.apache.ivy.report.ResolveReport;
+
+public class LatestConflictManagerTest extends TestCase {
+
+       private Ivy ivy;
+
+       protected void setUp() throws Exception {
+               ivy = new Ivy();
+               ivy.configure(LatestConflictManagerTest.class
+                               .getResource("ivyconf-latest.xml"));
+       }
+
+       // Test case for issue IVY-388
+       public void testIvy388() throws Exception {
+               ResolveReport report = 
ivy.resolve(LatestConflictManagerTest.class
+                               .getResource("ivy-388.xml"), null, new String[] 
{ "*" }, null,
+                               new Date(), false);
+
+               List deps = report.getDependencies();
+               Iterator dependencies = deps.iterator();
+               String[] confs = report.getConfigurations();
+               while (dependencies.hasNext()) {
+                       IvyNode node = (IvyNode) dependencies.next();
+                       for (int i = 0; i < confs.length; i++) {
+                               String conf = confs[i];
+                               if (!node.isEvicted(conf)) {
+                                       boolean flag1 = 
report.getConfigurationReport(conf)
+                                                       
.getDependency(node.getResolvedId()) != null;
+                                       boolean flag2 = 
report.getConfigurationReport(conf)
+                                                       
.getModuleRevisionIds().contains(node.getResolvedId());
+                                       assertEquals("Inconsistent data for 
node " + node + " in conf " + conf , flag1, flag2);
+                               }
+                       }
+               }
+       }
+}

Added: incubator/ivy/trunk/test/java/org/apache/ivy/conflict/ivy-388.xml
URL: 
http://svn.apache.org/viewvc/incubator/ivy/trunk/test/java/org/apache/ivy/conflict/ivy-388.xml?view=auto&rev=496001
==============================================================================
--- incubator/ivy/trunk/test/java/org/apache/ivy/conflict/ivy-388.xml (added)
+++ incubator/ivy/trunk/test/java/org/apache/ivy/conflict/ivy-388.xml Sat Jan 
13 15:27:42 2007
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ivy-module version="1.0"> 
+        <info organisation="apache" module="resolve-latest-conflict" 
revision="1.0" status="release"/>
+        <configurations>
+          <conf name="default"/>
+          <conf name="nontransitive" transitive="false" extends="default"/>
+        </configurations>
+        <dependencies>
+            <dependency org="org1" name="mod1.1" rev="1.0"/>
+            <dependency org="org1" name="mod1.2" rev="2.1"/>
+            <dependency org="org6" name="mod6.1" rev="0.6"/>
+        </dependencies>
+</ivy-module>
\ No newline at end of file

Added: incubator/ivy/trunk/test/java/org/apache/ivy/conflict/ivyconf-latest.xml
URL: 
http://svn.apache.org/viewvc/incubator/ivy/trunk/test/java/org/apache/ivy/conflict/ivyconf-latest.xml?view=auto&rev=496001
==============================================================================
--- incubator/ivy/trunk/test/java/org/apache/ivy/conflict/ivyconf-latest.xml 
(added)
+++ incubator/ivy/trunk/test/java/org/apache/ivy/conflict/ivyconf-latest.xml 
Sat Jan 13 15:27:42 2007
@@ -0,0 +1,12 @@
+<ivyconf>
+
+    <conf defaultResolver="test"/>
+
+    <resolvers>
+        <filesystem name="test">
+            <artifact
+                    
pattern="test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]"/>
+            <ivy 
pattern="test/repositories/1/[organisation]/[module]/ivys/ivy-[revision].xml"/>
+        </filesystem>
+    </resolvers>
+</ivyconf>


Reply via email to