Author: xavier
Date: Fri Mar  2 02:43:20 2007
New Revision: 513696

URL: http://svn.apache.org/viewvc?view=rev&rev=513696
Log:
FIX: Static revision replacement is not working when delivering an artifact 
with a dependency on a branch (IVY-404)

Added:
    incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-latest-branch.xml
Modified:
    incubator/ivy/core/trunk/CHANGES.txt
    
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java

Modified: incubator/ivy/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?view=diff&rev=513696&r1=513695&r2=513696
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Fri Mar  2 02:43:20 2007
@@ -14,6 +14,7 @@
 - IMPROVE: Add a unit test to verify that latest.integration accepts released 
modules (IVY-394) (thanks to Gilles Scokart)
 - IMPROVE: New "modules in use" section in console report at the end of 
resolve (IVY-373) (thanks to John Wiliams)
 
+- FIX: Static revision replacement is not working when delivering an artifact 
with a dependency on a branch (IVY-404)
 - FIX: latest-time conflict manager not working properly (IVY-407)
 - FIX: LatestRevisionStrategy do not consider all dynamic revisions properly 
(IVY-383) (thanks to John Williams for the unit test)
 - FIX: IOException during publish causes NullPointerException (IVY-371)

Modified: 
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java?view=diff&rev=513696&r1=513695&r2=513696
==============================================================================
--- 
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
 (original)
+++ 
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
 Fri Mar  2 02:43:20 2007
@@ -308,7 +308,13 @@
                 String name = _ivy.substitute(attributes.getValue("name"));
                 String branch = _ivy.substitute(attributes.getValue("branch"));
                 String rev = _ivy.substitute(attributes.getValue("rev"));
-                _dd = new DefaultDependencyDescriptor(_md, 
ModuleRevisionId.newInstance(org, name, branch, rev, 
ExtendableItemHelper.getExtraAttributes(attributes, new String[] {"org", 
"name", "rev", "force", "transitive", "changing", "conf"})), force, changing, 
transitive);
+                _dd = new DefaultDependencyDescriptor(
+                               _md, 
+                               ModuleRevisionId.newInstance(org, name, branch, 
rev, 
+                                               
ExtendableItemHelper.getExtraAttributes(
+                                                               attributes, 
+                                                               new String[] 
{"org", "name", "branch", "rev", "force", "transitive", "changing", "conf"})), 
+                               force, changing, transitive);
                 _md.addDependency(_dd);
                 String confs = _ivy.substitute(attributes.getValue("conf"));
                 if (confs != null && confs.length() > 0) {

Modified: 
incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java?view=diff&rev=513696&r1=513695&r2=513696
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java 
(original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java 
Fri Mar  2 02:43:20 2007
@@ -103,6 +103,27 @@
         assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"), 
dds[0].getDependencyRevisionId());
     }
 
+    public void testWithBranch() throws Exception {
+       // test case for IVY-404
+        _project.setProperty("ivy.dep.file", 
"test/java/org/apache/ivy/ant/ivy-latest-branch.xml");
+        IvyResolve res = new IvyResolve();
+        res.setProject(_project);
+        res.execute();
+        
+        _deliver.setPubrevision("1.2");
+        _deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
+        _deliver.execute();
+        
+        // should have done the ivy delivering
+        File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
+        assertTrue(deliveredIvyFile.exists()); 
+        ModuleDescriptor md = 
XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), 
deliveredIvyFile.toURL(), true);
+        assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", 
"1.2"), md.getModuleRevisionId());
+        DependencyDescriptor[] dds = md.getDependencies();
+        assertEquals(1, dds.length);
+        assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "TRUNK", 
"2.2"), dds[0].getDependencyRevisionId());
+    }
+
     public void testReplaceImportedConfigurations() throws Exception {
         _project.setProperty("ivy.dep.file", 
"test/java/org/apache/ivy/ant/ivy-import-confs.xml");
         IvyResolve res = new IvyResolve();

Added: 
incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-latest-branch.xml
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-latest-branch.xml?view=auto&rev=513696
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-latest-branch.xml 
(added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-latest-branch.xml 
Fri Mar  2 02:43:20 2007
@@ -0,0 +1,10 @@
+<ivy-module version="1.0"> 
+       <info organisation="apache"
+              module="resolve-latest"
+              revision="1.0"
+              status="release"
+       />
+       <dependencies>
+               <dependency org="org1" name="mod1.2" rev="latest.integration" 
branch="TRUNK" />
+       </dependencies>
+</ivy-module>


Reply via email to