ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1028018 - in /ant/ivy/core/trunk: src/java/org/apache/ivy/ant/IvyResources.java test/java/org/apache/ivy/ant/IvyResourcesTest.java
Date Wed, 27 Oct 2010 15:59:56 GMT
Author: hibou
Date: Wed Oct 27 15:59:56 2010
New Revision: 1028018

URL: http://svn.apache.org/viewvc?rev=1028018&view=rev
Log:
Unit test and fix on exclude/include in ivy:resources

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResources.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResourcesTest.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResources.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResources.java?rev=1028018&r1=1028017&r2=1028018&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResources.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResources.java Wed Oct 27 15:59:56 2010
@@ -180,6 +180,7 @@ public class IvyResources extends BaseRe
         while (itExcludes.hasNext()) {
             IvyExclude exclude = (IvyExclude) itExcludes.next();
             DefaultExcludeRule rule = exclude.asRule(ivy.getSettings());
+            rule.addConfiguration("default");
             md.addExcludeRule(rule);
         }
 

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResourcesTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResourcesTest.java?rev=1028018&r1=1028017&r2=1028018&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResourcesTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResourcesTest.java Wed Oct 27 15:59:56
2010
@@ -181,6 +181,91 @@ public class IvyResourcesTest extends Te
         assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
     }
 
+    public void testExclude() throws Exception {
+        IvyDependency dependency = resources.createDependency();
+        dependency.setOrg("org1");
+        dependency.setName("mod1.2");
+        dependency.setRev("2.0");
+
+        dependency = resources.createDependency();
+        dependency.setOrg("org2");
+        dependency.setName("mod2.2");
+        dependency.setRev("0.10");
+        dependency.setConf("B");
+
+        IvyExclude exclude = resources.createExclude();
+        exclude.setOrg("org1");
+        exclude.setModule("mod1.1");
+
+        resources.iterator();
+
+        assertTrue(getIvyFileInCache("org1", "mod1.2", "2.0").exists());
+        assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
+
+        assertTrue(getIvyFileInCache("org2", "mod2.2", "0.10").exists());
+        assertTrue(getArchiveFileInCache("org2", "mod2.2", "0.10", "mod2.2", "jar", "jar").exists());
+
+        assertTrue(getIvyFileInCache("org2", "mod2.1", "0.7").exists());
+        assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.7", "mod2.1", "jar", "jar").exists());
+
+        assertFalse(getIvyFileInCache("org1", "mod1.1", "1.0").exists());
+        assertFalse(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
+    }
+
+    public void testDependencyExclude() throws Exception {
+        IvyDependency dependency = resources.createDependency();
+        dependency.setOrg("org1");
+        dependency.setName("mod1.2");
+        dependency.setRev("2.0");
+
+        dependency = resources.createDependency();
+        dependency.setOrg("org2");
+        dependency.setName("mod2.2");
+        dependency.setRev("0.10");
+        dependency.setConf("B");
+
+        IvyDependencyExclude exclude = dependency.createExclude();
+        exclude.setOrg("org1");
+
+        resources.iterator();
+
+        assertTrue(getIvyFileInCache("org1", "mod1.2", "2.0").exists());
+        assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
+
+        assertTrue(getIvyFileInCache("org2", "mod2.2", "0.10").exists());
+        assertTrue(getArchiveFileInCache("org2", "mod2.2", "0.10", "mod2.2", "jar", "jar").exists());
+
+        assertTrue(getIvyFileInCache("org2", "mod2.1", "0.7").exists());
+        assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.7", "mod2.1", "jar", "jar").exists());
+
+        assertFalse(getIvyFileInCache("org1", "mod1.1", "1.0").exists());
+        assertFalse(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
+    }
+
+    public void testDependencyInclude() throws Exception {
+        IvyDependency dependency = resources.createDependency();
+        dependency.setOrg("org1");
+        dependency.setName("mod1.2");
+        dependency.setRev("2.0");
+
+        dependency = resources.createDependency();
+        dependency.setOrg("org2");
+        dependency.setName("mod2.2");
+        dependency.setRev("0.9");
+
+        IvyDependencyInclude include = dependency.createInclude();
+        include.setName("art22-1");
+
+        resources.iterator();
+
+        assertTrue(getIvyFileInCache("org1", "mod1.2", "2.0").exists());
+        assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
+
+        assertTrue(getIvyFileInCache("org2", "mod2.2", "0.9").exists());
+        assertTrue(getArchiveFileInCache("org2", "mod2.2", "0.9", "art22-1", "jar", "jar").exists());
+        assertFalse(getArchiveFileInCache("org2", "mod2.2", "0.9", "art22-2", "jar", "jar").exists());
+    }
+
     public void testFail() throws Exception {
         IvyDependency dependency = resources.createDependency();
         dependency.setOrg("org1");



Mime
View raw message