You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jl...@apache.org on 2014/01/12 17:53:41 UTC

svn commit: r1557557 - in /ant/ivy/core/trunk: src/java/org/apache/ivy/core/module/descriptor/ src/java/org/apache/ivy/plugins/parser/xml/ test/java/org/apache/ivy/plugins/parser/xml/

Author: jlboudart
Date: Sun Jan 12 16:53:40 2014
New Revision: 1557557

URL: http://svn.apache.org/r1557557
Log:
fix IVY-1457 XmlModuleDescriptorWritter doesn't support fully extra infos elements

ModuleDescriptor.getExtraInfo() is now deprecated as name of the tag was used as key. Tag name can't be used as key as extra info elements can be non unique.

Added:
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ExtraInfoHolder.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-extrainfo-nested.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-extrainfo.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo-nested.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo.xml
Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriterTest.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java?rev=1557557&r1=1557556&r2=1557557&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java Sun Jan 12 16:53:40 2014
@@ -194,6 +194,7 @@ public class DefaultModuleDescriptor imp
         nmd.lastModified = md.getLastModified();
         nmd.extraAttributesNamespaces = md.getExtraAttributesNamespaces();
         nmd.extraInfo = md.getExtraInfo();
+        nmd.extraInfos = md.getExtraInfos();
         nmd.namespace = ns;
 
         return nmd;
@@ -256,6 +257,8 @@ public class DefaultModuleDescriptor imp
 
     private Map/* <String,String> */extraInfo = new HashMap();
 
+    private List<ExtraInfoHolder> extraInfos = new ArrayList<ExtraInfoHolder>();
+
     public DefaultModuleDescriptor(ModuleRevisionId id, String status, Date pubDate) {
         this(id, status, pubDate, false);
     }
@@ -840,4 +843,12 @@ public class DefaultModuleDescriptor imp
     public Map getExtraInfo() {
         return extraInfo;
     }
+
+    public List<ExtraInfoHolder> getExtraInfos() {
+        return extraInfos;
+    }
+
+    public void addExtraInfo(ExtraInfoHolder extraInfo) {
+        extraInfos.add(extraInfo);
+    }
 }

Added: ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ExtraInfoHolder.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ExtraInfoHolder.java?rev=1557557&view=auto
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ExtraInfoHolder.java (added)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ExtraInfoHolder.java Sun Jan 12 16:53:40 2014
@@ -0,0 +1,73 @@
+/*
+ *  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.core.module.descriptor;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ExtraInfoHolder {
+    
+    private String name;
+    private Map<String, String> attributes = new LinkedHashMap<String, String>();
+    private String content;
+    private List<ExtraInfoHolder> nestedExtraInfoHolder = new ArrayList<ExtraInfoHolder>();
+
+    public ExtraInfoHolder() {
+        
+    }
+    
+    public ExtraInfoHolder(String name, String content) {
+        this.name = name;
+        this.content = content;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Map<String, String> getAttributes() {
+        return attributes;
+    }
+
+    public void setAttributes(Map<String, String> attributes) {
+        this.attributes = attributes;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public List<ExtraInfoHolder> getNestedExtraInfoHolder() {
+        return nestedExtraInfoHolder;
+    }
+
+    public void setNestedExtraInfoHolder(List<ExtraInfoHolder> nestedExtraInfoHolder) {
+        this.nestedExtraInfoHolder = nestedExtraInfoHolder;
+    }
+
+}

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java?rev=1557557&r1=1557556&r2=1557557&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java Sun Jan 12 16:53:40 2014
@@ -21,8 +21,10 @@ import java.io.File;
 import java.io.IOException;
 import java.text.ParseException;
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
+import org.apache.ivy.core.module.descriptor.ExtraInfoHolder;
 import org.apache.ivy.core.module.id.ArtifactId;
 import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
@@ -263,5 +265,14 @@ public interface ModuleDescriptor 
      * The key is the name of the tag, the value is its content.
      * @return
      */
+    @Deprecated
     Map/*<String,String>*/ getExtraInfo();
+    
+
+    /**
+     * Returns a list of extras infos (tag name, attributes and content).
+     * All the tags except the description are given.
+     * @return
+     */
+    List<ExtraInfoHolder> getExtraInfos();
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java?rev=1557557&r1=1557556&r2=1557557&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java Sun Jan 12 16:53:40 2014
@@ -26,7 +26,9 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.text.ParseException;
 import java.util.Arrays;
+import java.util.Deque;
 import java.util.LinkedHashMap;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -47,6 +49,7 @@ import org.apache.ivy.core.module.descri
 import org.apache.ivy.core.module.descriptor.DependencyArtifactDescriptor;
 import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.ExcludeRule;
+import org.apache.ivy.core.module.descriptor.ExtraInfoHolder;
 import org.apache.ivy.core.module.descriptor.IncludeRule;
 import org.apache.ivy.core.module.descriptor.License;
 import org.apache.ivy.core.module.descriptor.MDArtifact;
@@ -227,6 +230,7 @@ public class XmlModuleDescriptorParser e
         private StringBuffer buffer;
         private String descriptorVersion;
         private String[] publicationsDefaultConf;
+        private Deque<ExtraInfoHolder> extraInfoStack = new LinkedList<ExtraInfoHolder>();
         
         public Parser(ModuleDescriptorParser parser, ParserSettings ivySettings) {
             super(parser);
@@ -313,9 +317,17 @@ public class XmlModuleDescriptorParser e
                     // nothing to do, we don't store this
                 } else if (state == State.INFO && "repository".equals(qName)) {
                     // nothing to do, we don't store this
-                } else if (state == State.INFO && isOtherNamespace(qName)) {
+                } else if (state == State.EXTRA_INFO || state == State.INFO
+                        && isOtherNamespace(qName)) {
                     buffer = new StringBuffer();
                     state = State.EXTRA_INFO;
+                    ExtraInfoHolder extraInfo = new ExtraInfoHolder();
+                    extraInfo.setName(qName);
+                    for (int i = 0; i < attributes.getLength(); i++) {
+                        extraInfo.getAttributes().put(attributes.getQName(i),
+                            attributes.getValue(i));
+                    }
+                    extraInfoStack.push(extraInfo);
                 } else if ("configurations".equals(qName)) {
                     configurationStarted(attributes);
                 } else if ("publications".equals(qName)) {
@@ -1194,9 +1206,18 @@ public class XmlModuleDescriptorParser e
                 buffer = null;
                 state = State.INFO;
             } else if (state == State.EXTRA_INFO) {
-                getMd().addExtraInfo(qName, buffer == null ? "" : buffer.toString());
+                String content = buffer == null ? "" : buffer.toString();
                 buffer = null;
-                state = State.INFO;
+                getMd().addExtraInfo(qName, content);
+                ExtraInfoHolder extraInfo = extraInfoStack.pop();
+                extraInfo.setContent(content);
+                if (extraInfoStack.isEmpty()) {
+                    getMd().addExtraInfo(extraInfo);
+                    state = State.INFO;
+                } else {
+                    ExtraInfoHolder parentHolder = extraInfoStack.peek();
+                    parentHolder.getNestedExtraInfoHolder().add(extraInfo);
+                }
             } else if (state == State.DESCRIPTION) {
                 if (buffer.toString().endsWith("<" + qName + ">")) {
                     buffer.deleteCharAt(buffer.length() - 1);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java?rev=1557557&r1=1557556&r2=1557557&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java Sun Jan 12 16:53:40 2014
@@ -36,6 +36,7 @@ import org.apache.ivy.core.module.descri
 import org.apache.ivy.core.module.descriptor.DependencyDescriptorMediator;
 import org.apache.ivy.core.module.descriptor.ExcludeRule;
 import org.apache.ivy.core.module.descriptor.ExtendsDescriptor;
+import org.apache.ivy.core.module.descriptor.ExtraInfoHolder;
 import org.apache.ivy.core.module.descriptor.IncludeRule;
 import org.apache.ivy.core.module.descriptor.License;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
@@ -507,19 +508,8 @@ public final class XmlModuleDescriptorWr
                     out.println(" />");
                 }
             }
-            for (Iterator it = md.getExtraInfo().entrySet().iterator(); it.hasNext();) {
-                Map.Entry extraDescr = (Map.Entry) it.next();
-                if (extraDescr.getValue() == null 
-                        || ((String) extraDescr.getValue()).length() == 0) {
-                    continue;
-                }
-                out.print("\t\t<");
-                out.print(extraDescr.getKey());
-                out.print(">");
-                out.print(XMLHelper.escape((String) extraDescr.getValue()));
-                out.print("</");
-                out.print(extraDescr.getKey());
-                out.println(">");
+            for (ExtraInfoHolder extraInfo : md.getExtraInfos()) {
+                printExtraInfoElement(out, extraInfo, 2);
             }
             out.println("\t</info>");
         } else {
@@ -527,9 +517,50 @@ public final class XmlModuleDescriptorWr
         }
 
     }
+    
+    private static void printExtraInfoElement(PrintWriter out, ExtraInfoHolder extraInfo, int indent) {
+        for (int i = 1; i <= indent; i++) {
+            out.print("\t");
+        }
+        out.print("<");
+        out.print(extraInfo.getName());
+        for (Entry<String, String> entry : extraInfo.getAttributes().entrySet()) {
+            out.print(" ");
+            out.print(entry.getKey());
+            out.print("=");
+            out.print("\"");
+            out.print(entry.getValue());
+            out.print("\"");
+        }
+        boolean requireClosingTag = false;
+        if (extraInfo.getContent() != null && extraInfo.getContent().trim().length() > 0) {
+            out.print(">");
+            out.print(XMLHelper.escape(extraInfo.getContent()));
+            requireClosingTag = true;
+        }
+        if (!extraInfo.getNestedExtraInfoHolder().isEmpty()) {
+            out.println(">");
+            for (ExtraInfoHolder nestedElement : extraInfo.getNestedExtraInfoHolder()) {
+                printExtraInfoElement(out, nestedElement, indent + 1);
+            }
+            requireClosingTag = true;
+            // prepare indentation for closing tag
+            for (int i = 1; i <= indent; i++) {
+                out.print("\t");
+            }
+        }
+        if (requireClosingTag) {
+            out.print("</");
+            out.print(extraInfo.getName());
+            out.println(">");
+        } else {
+            out.println("/>");
+        }
+    }
 
     private static boolean requireInnerInfoElement(ModuleDescriptor md) {
         return md.getExtraInfo().size() > 0 
+                || md.getExtraInfos().size() > 0
                 || md.getHomePage() != null 
                 || (md.getDescription() != null && md.getDescription().trim().length() > 0) 
                 || md.getLicenses().length > 0

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java?rev=1557557&r1=1557556&r2=1557557&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java Sun Jan 12 16:53:40 2014
@@ -32,6 +32,7 @@ import org.apache.ivy.core.module.descri
 import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.ExcludeRule;
+import org.apache.ivy.core.module.descriptor.ExtraInfoHolder;
 import org.apache.ivy.core.module.descriptor.License;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.descriptor.Configuration.Visibility;
@@ -490,6 +491,60 @@ public class XmlModuleDescriptorParserTe
         assertEquals("56576", md.getExtraInfo().get("e:someExtra"));
     }
     
+    public void testExtraInfos() throws Exception {
+        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
+            getClass().getResource("test-extrainfo.xml"), true);
+        assertNotNull(md);
+        assertEquals(2, md.getExtraInfo().size());
+        assertEquals("56576", md.getExtraInfo().get("e:someExtra"));
+        assertEquals(2, md.getExtraInfos().size());
+        ExtraInfoHolder firstExtraInfoElement = md.getExtraInfos().get(0);
+        assertEquals("e:someExtra", firstExtraInfoElement.getName());
+        assertEquals("56576", firstExtraInfoElement.getContent());
+        assertEquals(0, firstExtraInfoElement.getAttributes().size());
+        assertEquals(0, firstExtraInfoElement.getNestedExtraInfoHolder().size());
+        ExtraInfoHolder secondExtraInfoElement = md.getExtraInfos().get(1);
+        assertEquals("e:someExtraWithAttributes", secondExtraInfoElement.getName());
+        assertEquals("", secondExtraInfoElement.getContent());
+        assertEquals(2, secondExtraInfoElement.getAttributes().size());
+        assertEquals("foo", secondExtraInfoElement.getAttributes().get("attr1"));
+        assertEquals("bar", secondExtraInfoElement.getAttributes().get("attr2"));
+        assertEquals(0, secondExtraInfoElement.getNestedExtraInfoHolder().size());
+    }
+    
+    public void testExtraInfosNested() throws Exception {
+        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
+            getClass().getResource("test-extrainfo-nested.xml"), true);
+        assertNotNull(md);
+        assertEquals(4, md.getExtraInfo().size());
+        assertEquals("56576", md.getExtraInfo().get("e:someExtra"));
+        assertEquals(2, md.getExtraInfos().size());
+        ExtraInfoHolder someExtraElement = md.getExtraInfos().get(0);
+        assertEquals("e:someExtra", someExtraElement.getName());
+        assertEquals("56576", someExtraElement.getContent());
+        assertEquals(0, someExtraElement.getAttributes().size());
+        assertEquals(0, someExtraElement.getNestedExtraInfoHolder().size());
+        ExtraInfoHolder someExtraElementWithAttributes = md.getExtraInfos().get(1);
+        assertEquals("e:someExtraWithAttributes", someExtraElementWithAttributes.getName());
+        assertEquals("", someExtraElementWithAttributes.getContent());
+        assertEquals(2, someExtraElementWithAttributes.getAttributes().size());
+        assertEquals("foo", someExtraElementWithAttributes.getAttributes().get("attr1"));
+        assertEquals("bar", someExtraElementWithAttributes.getAttributes().get("attr2"));
+        assertEquals(1, someExtraElementWithAttributes.getNestedExtraInfoHolder().size());
+        ExtraInfoHolder anotherExtraInfoElement = someExtraElementWithAttributes.getNestedExtraInfoHolder().get(0);
+        assertEquals("e:anotherExtraInfo", anotherExtraInfoElement.getName());
+        assertEquals("", anotherExtraInfoElement.getContent());
+        assertEquals(1, anotherExtraInfoElement.getAttributes().size());
+        assertEquals("foobar", anotherExtraInfoElement.getAttributes().get("myattribute"));
+        assertEquals(1, anotherExtraInfoElement.getNestedExtraInfoHolder().size());
+        ExtraInfoHolder yetAnotherExtraInfoElement = anotherExtraInfoElement.getNestedExtraInfoHolder().get(0);
+        assertEquals("e:yetAnotherExtraInfo", yetAnotherExtraInfoElement.getName());
+        assertEquals("", yetAnotherExtraInfoElement.getContent());
+        assertEquals(1, yetAnotherExtraInfoElement.getAttributes().size());
+        assertEquals("value", yetAnotherExtraInfoElement.getAttributes().get("anAttribute"));
+        assertEquals(0, yetAnotherExtraInfoElement.getNestedExtraInfoHolder().size());
+    }
+    
     public void testBug60() throws Exception {
         ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
             getClass().getResource("test-bug60.xml"), true);

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriterTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriterTest.java?rev=1557557&r1=1557556&r2=1557557&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriterTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriterTest.java Sun Jan 12 16:53:40 2014
@@ -110,6 +110,34 @@ public class XmlModuleDescriptorWriterTe
             '\r', '\n');
         assertEquals(expected, wrote);
     }
+    
+    public void testExtraInfos() throws Exception {
+        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+            new IvySettings(),
+            XmlModuleDescriptorWriterTest.class.getResource("test-extrainfo.xml"), false);
+        XmlModuleDescriptorWriter.write(md, LICENSE, dest);
+
+        assertTrue(dest.exists());
+        String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(dest)))
+                .replaceAll("\r\n", "\n").replace('\r', '\n');
+        String expected = readEntirely("test-write-extrainfo.xml").replaceAll("\r\n", "\n")
+                .replace('\r', '\n');
+        assertEquals(expected, wrote);
+    }
+
+    public void testExtraInfosWithNestedElement() throws Exception {
+        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+            new IvySettings(),
+            XmlModuleDescriptorWriterTest.class.getResource("test-extrainfo-nested.xml"), false);
+        XmlModuleDescriptorWriter.write(md, LICENSE, dest);
+
+        assertTrue(dest.exists());
+        String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(dest)))
+                .replaceAll("\r\n", "\n").replace('\r', '\n');
+        String expected = readEntirely("test-write-extrainfo-nested.xml").replaceAll("\r\n", "\n")
+                .replace('\r', '\n');
+        assertEquals(expected, wrote);
+    }
 
 	public void testExtends() throws Exception {
 		ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-extrainfo-nested.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-extrainfo-nested.xml?rev=1557557&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-extrainfo-nested.xml (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-extrainfo-nested.xml Sun Jan 12 16:53:40 2014
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+   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="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
+	<info organisation="myorg"
+	       module="mymodule"
+	       revision="myrev"
+	       status="integration"
+	       publication="20041101110000"
+	       e:attr1="value1">
+	       
+		<license name="MyLicense" url="http://www.my.org/mymodule/mylicense.html"/>
+		
+		<ivyauthor name="jayasoft" url="http://www.jayasoft.org/"/>
+		<ivyauthor name="myorg" url="http://www.myorg.org/"/>
+
+		<repository name="ivyrep" url="http://www.jayasoft.fr/org/ivyrep/" pattern="[organisation]/[module]/ivy-[revision].xml" ivys="true" artifacts="false"/>
+
+		<description homepage="http://www.my.org/mymodule/">			
+	This module is <b>great</b> !<br/>
+	You can use it especially with myconf1 and myconf2, and myconf4 is not too bad too.
+		</description>
+
+		<e:someExtra>56576</e:someExtra>
+        <e:someExtraWithAttributes attr1="foo" attr2="bar">
+            <e:anotherExtraInfo myattribute="foobar">
+                <e:yetAnotherExtraInfo anAttribute="value"/>
+            </e:anotherExtraInfo>
+        </e:someExtraWithAttributes>
+  	</info>
+	<configurations>
+		<conf name="myconf1" description="desc 1" e:attr2="value2"/>
+		<conf name="myconf2" description="desc 2" visibility="public"/>
+		<conf name="myconf3" description="desc 3" visibility="private"/>
+		<conf name="myconf4" description="desc 4" extends="myconf1, myconf2"/>		
+		<conf name="myoldconf" description="my old desc" deprecated="20050115"/>
+	</configurations>
+	<publications>
+		<artifact name="myartifact1" type="jar" e:attr3="value3"/>
+		<artifact name="myartifact2" type="jar" conf="myconf1"/>
+		<artifact name="myartifact3" type="jar" conf="myconf1, myconf2, myconf3"/>
+		<artifact name="myartifact4" type="jar">
+			<conf name="myconf1"/>
+			<conf name="myconf3"/>
+		</artifact>
+	</publications>
+	<dependencies>
+		<dependency name="mymodule2" rev="2.0" e:attr4="value4"/>
+		<dependency name="mymodule3" rev="2.0" changing="true" transitive="false"/>
+		<dependency org="yourorg" name="yourmodule1" branch="trunk" rev="1.1" branchConstraint="branch1" revConstraint="1+" conf="myconf1"/>
+		<dependency org="yourorg" name="yourmodule2" rev="2+" conf="myconf1->yourconf1"/>
+		<dependency org="yourorg" name="yourmodule3" rev="3.1" conf="myconf1->yourconf1, yourconf2"/>
+		<dependency org="yourorg" name="yourmodule4" rev="4.1" conf="myconf1, myconf2->yourconf1, yourconf2"/>
+		<dependency org="yourorg" name="yourmodule5" rev="5.1" conf="myconf1->yourconf1;myconf2->yourconf1, yourconf2"/>
+
+		<dependency org="yourorg" name="yourmodule6" rev="latest.integration">
+			<conf name="myconf1" mapped="yourconf1"/>
+			<conf name="myconf2" mapped="yourconf1, yourconf2"/>
+		</dependency>
+
+		<dependency org="yourorg" name="yourmodule7" rev="7.1">
+			<conf name="myconf1">
+				<mapped name="yourconf1"/>
+			</conf>
+			<conf name="myconf2">
+				<mapped name="yourconf1"/>
+				<mapped name="yourconf2"/>
+			</conf>
+		</dependency>
+
+		<dependency org="yourorg" name="yourmodule8" rev="8.1">
+			<artifact name="yourartifact8-1" type="jar" e:attr5="value5"/>
+			<artifact name="yourartifact8-2" type="jar"/>
+		</dependency>		
+
+		<dependency org="yourorg" name="yourmodule9" rev="9.1" conf="myconf1,myconf2,myconf3->default">
+			<artifact name="yourartifact9-1" type="jar" conf="myconf1,myconf2"/>
+			<artifact name="yourartifact9-2" type="jar">
+				<conf name="myconf2"/>
+				<conf name="myconf3"/>
+			</artifact>
+		</dependency>		
+
+		<dependency org="yourorg" name="yourmodule10" rev="10.1">
+			<include name="your.*" type="jar"/>
+			<include ext="xml"/>
+			<exclude name="toexclude"/>
+		</dependency>
+		<dependency org="yourorg" name="yourmodule11" rev="11.1" conf="*->@"/>
+		
+		<exclude module="*servlet*" matcher="glob" conf="myconf1" /> 
+		<exclude org="acme" module="test" artifact="test" type="source" ext="jar" />
+        <override org="yourorg" module=".*1" matcher="regexp" branch="BRANCH" rev="1.0" /> 
+		<conflict org="yourorg" module=".*" matcher="regexp" manager="all" />
+		<conflict org="theirorg" module="theirmodule1" rev="1.0, 1.1"/>
+	</dependencies>
+</ivy-module>

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-extrainfo.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-extrainfo.xml?rev=1557557&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-extrainfo.xml (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-extrainfo.xml Sun Jan 12 16:53:40 2014
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+   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="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
+	<info organisation="myorg"
+	       module="mymodule"
+	       revision="myrev"
+	       status="integration"
+	       publication="20041101110000"
+	       e:attr1="value1">
+	       
+		<license name="MyLicense" url="http://www.my.org/mymodule/mylicense.html"/>
+		
+		<ivyauthor name="jayasoft" url="http://www.jayasoft.org/"/>
+		<ivyauthor name="myorg" url="http://www.myorg.org/"/>
+
+		<repository name="ivyrep" url="http://www.jayasoft.fr/org/ivyrep/" pattern="[organisation]/[module]/ivy-[revision].xml" ivys="true" artifacts="false"/>
+
+		<description homepage="http://www.my.org/mymodule/">			
+	This module is <b>great</b> !<br/>
+	You can use it especially with myconf1 and myconf2, and myconf4 is not too bad too.
+		</description>
+
+		<e:someExtra>56576</e:someExtra>
+        <e:someExtraWithAttributes attr1="foo" attr2="bar"/>
+	</info>
+	<configurations>
+		<conf name="myconf1" description="desc 1" e:attr2="value2"/>
+		<conf name="myconf2" description="desc 2" visibility="public"/>
+		<conf name="myconf3" description="desc 3" visibility="private"/>
+		<conf name="myconf4" description="desc 4" extends="myconf1, myconf2"/>		
+		<conf name="myoldconf" description="my old desc" deprecated="20050115"/>
+	</configurations>
+	<publications>
+		<artifact name="myartifact1" type="jar" e:attr3="value3"/>
+		<artifact name="myartifact2" type="jar" conf="myconf1"/>
+		<artifact name="myartifact3" type="jar" conf="myconf1, myconf2, myconf3"/>
+		<artifact name="myartifact4" type="jar">
+			<conf name="myconf1"/>
+			<conf name="myconf3"/>
+		</artifact>
+	</publications>
+	<dependencies>
+		<dependency name="mymodule2" rev="2.0" e:attr4="value4"/>
+		<dependency name="mymodule3" rev="2.0" changing="true" transitive="false"/>
+		<dependency org="yourorg" name="yourmodule1" branch="trunk" rev="1.1" branchConstraint="branch1" revConstraint="1+" conf="myconf1"/>
+		<dependency org="yourorg" name="yourmodule2" rev="2+" conf="myconf1->yourconf1"/>
+		<dependency org="yourorg" name="yourmodule3" rev="3.1" conf="myconf1->yourconf1, yourconf2"/>
+		<dependency org="yourorg" name="yourmodule4" rev="4.1" conf="myconf1, myconf2->yourconf1, yourconf2"/>
+		<dependency org="yourorg" name="yourmodule5" rev="5.1" conf="myconf1->yourconf1;myconf2->yourconf1, yourconf2"/>
+
+		<dependency org="yourorg" name="yourmodule6" rev="latest.integration">
+			<conf name="myconf1" mapped="yourconf1"/>
+			<conf name="myconf2" mapped="yourconf1, yourconf2"/>
+		</dependency>
+
+		<dependency org="yourorg" name="yourmodule7" rev="7.1">
+			<conf name="myconf1">
+				<mapped name="yourconf1"/>
+			</conf>
+			<conf name="myconf2">
+				<mapped name="yourconf1"/>
+				<mapped name="yourconf2"/>
+			</conf>
+		</dependency>
+
+		<dependency org="yourorg" name="yourmodule8" rev="8.1">
+			<artifact name="yourartifact8-1" type="jar" e:attr5="value5"/>
+			<artifact name="yourartifact8-2" type="jar"/>
+		</dependency>		
+
+		<dependency org="yourorg" name="yourmodule9" rev="9.1" conf="myconf1,myconf2,myconf3->default">
+			<artifact name="yourartifact9-1" type="jar" conf="myconf1,myconf2"/>
+			<artifact name="yourartifact9-2" type="jar">
+				<conf name="myconf2"/>
+				<conf name="myconf3"/>
+			</artifact>
+		</dependency>		
+
+		<dependency org="yourorg" name="yourmodule10" rev="10.1">
+			<include name="your.*" type="jar"/>
+			<include ext="xml"/>
+			<exclude name="toexclude"/>
+		</dependency>
+		<dependency org="yourorg" name="yourmodule11" rev="11.1" conf="*->@"/>
+		
+		<exclude module="*servlet*" matcher="glob" conf="myconf1" /> 
+		<exclude org="acme" module="test" artifact="test" type="source" ext="jar" />
+        <override org="yourorg" module=".*1" matcher="regexp" branch="BRANCH" rev="1.0" /> 
+		<conflict org="yourorg" module=".*" matcher="regexp" manager="all" />
+		<conflict org="theirorg" module="theirmodule1" rev="1.0, 1.1"/>
+	</dependencies>
+</ivy-module>

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo-nested.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo-nested.xml?rev=1557557&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo-nested.xml (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo-nested.xml Sun Jan 12 16:53:40 2014
@@ -0,0 +1,81 @@
+<?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="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
+	<info organisation="myorg"
+		module="mymodule"
+		revision="myrev"
+		status="integration"
+		publication="20041101110000"
+		e:attr1="value1"
+	>
+		<license name="MyLicense" url="http://www.my.org/mymodule/mylicense.html" />
+		<description homepage="http://www.my.org/mymodule/">
+		This module is &lt;b>great&lt;/b> !&lt;br/>
+	You can use it especially with myconf1 and myconf2, and myconf4 is not too bad too.
+		</description>
+		<e:someExtra>56576</e:someExtra>
+		<e:someExtraWithAttributes attr1="foo" attr2="bar">
+			<e:anotherExtraInfo myattribute="foobar">
+				<e:yetAnotherExtraInfo anAttribute="value"/>
+			</e:anotherExtraInfo>
+		</e:someExtraWithAttributes>
+	</info>
+	<configurations>
+		<conf name="myconf1" visibility="public" description="desc 1" e:attr2="value2"/>
+		<conf name="myconf2" visibility="public" description="desc 2"/>
+		<conf name="myconf3" visibility="private" description="desc 3"/>
+		<conf name="myconf4" visibility="public" description="desc 4" extends="myconf1,myconf2"/>
+		<conf name="myoldconf" visibility="public" description="my old desc" deprecated="20050115"/>
+	</configurations>
+	<publications>
+		<artifact name="myartifact1" type="jar" ext="jar" conf="myconf1,myconf2,myconf3,myconf4,myoldconf" e:attr3="value3"/>
+		<artifact name="myartifact2" type="jar" ext="jar" conf="myconf1"/>
+		<artifact name="myartifact3" type="jar" ext="jar" conf="myconf1,myconf2,myconf3"/>
+		<artifact name="myartifact4" type="jar" ext="jar" conf="myconf1,myconf3"/>
+	</publications>
+	<dependencies>
+		<dependency org="myorg" name="mymodule2" rev="2.0" conf="*->*" e:attr4="value4"/>
+		<dependency org="myorg" name="mymodule3" rev="2.0" changing="true" transitive="false" conf="*->*"/>
+		<dependency org="yourorg" name="yourmodule1" branch="trunk" rev="1.1" branchConstraint="branch1" revConstraint="1+" conf="myconf1->myconf1"/>
+		<dependency org="yourorg" name="yourmodule2" rev="2+" conf="myconf1->yourconf1"/>
+		<dependency org="yourorg" name="yourmodule3" rev="3.1" conf="myconf1->yourconf1,yourconf2"/>
+		<dependency org="yourorg" name="yourmodule4" rev="4.1" conf="myconf1->yourconf1,yourconf2;myconf2->yourconf1,yourconf2"/>
+		<dependency org="yourorg" name="yourmodule5" rev="5.1" conf="myconf1->yourconf1;myconf2->yourconf1,yourconf2"/>
+		<dependency org="yourorg" name="yourmodule6" rev="latest.integration" conf="myconf1->yourconf1;myconf2->yourconf1,yourconf2"/>
+		<dependency org="yourorg" name="yourmodule7" rev="7.1" conf="myconf1->yourconf1;myconf2->yourconf1,yourconf2"/>
+		<dependency org="yourorg" name="yourmodule8" rev="8.1" conf="*->*">
+			<artifact name="yourartifact8-1" type="jar" ext="jar" e:attr5="value5"/>
+			<artifact name="yourartifact8-2" type="jar" ext="jar"/>
+		</dependency>
+		<dependency org="yourorg" name="yourmodule9" rev="9.1" conf="myconf1->default;myconf2->default;myconf3->default">
+			<artifact name="yourartifact9-1" type="jar" ext="jar" conf="myconf1,myconf2"/>
+			<artifact name="yourartifact9-2" type="jar" ext="jar" conf="myconf2,myconf3"/>
+		</dependency>
+		<dependency org="yourorg" name="yourmodule10" rev="10.1" conf="*->*">
+			<include name="your.*" type="jar" ext="jar" matcher="exact"/>
+			<include name="*" type="*" ext="xml" matcher="exact"/>
+			<exclude org="*" module="*" name="toexclude" type="*" ext="*" matcher="exact"/>
+		</dependency>
+		<dependency org="yourorg" name="yourmodule11" rev="11.1" conf="*->*"/>
+		<exclude org="*" module="*servlet*" artifact="*" type="*" ext="*" conf="myconf1" matcher="glob"/>
+		<exclude org="acme" module="test" artifact="test" type="source" ext="jar" matcher="exact"/>
+		<override org="yourorg" module=".*1" matcher="regexp" branch="BRANCH" rev="1.0"/>
+	</dependencies>
+</ivy-module>

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo.xml?rev=1557557&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo.xml (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-extrainfo.xml Sun Jan 12 16:53:40 2014
@@ -0,0 +1,77 @@
+<?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="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
+	<info organisation="myorg"
+		module="mymodule"
+		revision="myrev"
+		status="integration"
+		publication="20041101110000"
+		e:attr1="value1"
+	>
+		<license name="MyLicense" url="http://www.my.org/mymodule/mylicense.html" />
+		<description homepage="http://www.my.org/mymodule/">
+		This module is &lt;b>great&lt;/b> !&lt;br/>
+	You can use it especially with myconf1 and myconf2, and myconf4 is not too bad too.
+		</description>
+		<e:someExtra>56576</e:someExtra>
+		<e:someExtraWithAttributes attr1="foo" attr2="bar"/>
+	</info>
+	<configurations>
+		<conf name="myconf1" visibility="public" description="desc 1" e:attr2="value2"/>
+		<conf name="myconf2" visibility="public" description="desc 2"/>
+		<conf name="myconf3" visibility="private" description="desc 3"/>
+		<conf name="myconf4" visibility="public" description="desc 4" extends="myconf1,myconf2"/>
+		<conf name="myoldconf" visibility="public" description="my old desc" deprecated="20050115"/>
+	</configurations>
+	<publications>
+		<artifact name="myartifact1" type="jar" ext="jar" conf="myconf1,myconf2,myconf3,myconf4,myoldconf" e:attr3="value3"/>
+		<artifact name="myartifact2" type="jar" ext="jar" conf="myconf1"/>
+		<artifact name="myartifact3" type="jar" ext="jar" conf="myconf1,myconf2,myconf3"/>
+		<artifact name="myartifact4" type="jar" ext="jar" conf="myconf1,myconf3"/>
+	</publications>
+	<dependencies>
+		<dependency org="myorg" name="mymodule2" rev="2.0" conf="*->*" e:attr4="value4"/>
+		<dependency org="myorg" name="mymodule3" rev="2.0" changing="true" transitive="false" conf="*->*"/>
+		<dependency org="yourorg" name="yourmodule1" branch="trunk" rev="1.1" branchConstraint="branch1" revConstraint="1+" conf="myconf1->myconf1"/>
+		<dependency org="yourorg" name="yourmodule2" rev="2+" conf="myconf1->yourconf1"/>
+		<dependency org="yourorg" name="yourmodule3" rev="3.1" conf="myconf1->yourconf1,yourconf2"/>
+		<dependency org="yourorg" name="yourmodule4" rev="4.1" conf="myconf1->yourconf1,yourconf2;myconf2->yourconf1,yourconf2"/>
+		<dependency org="yourorg" name="yourmodule5" rev="5.1" conf="myconf1->yourconf1;myconf2->yourconf1,yourconf2"/>
+		<dependency org="yourorg" name="yourmodule6" rev="latest.integration" conf="myconf1->yourconf1;myconf2->yourconf1,yourconf2"/>
+		<dependency org="yourorg" name="yourmodule7" rev="7.1" conf="myconf1->yourconf1;myconf2->yourconf1,yourconf2"/>
+		<dependency org="yourorg" name="yourmodule8" rev="8.1" conf="*->*">
+			<artifact name="yourartifact8-1" type="jar" ext="jar" e:attr5="value5"/>
+			<artifact name="yourartifact8-2" type="jar" ext="jar"/>
+		</dependency>
+		<dependency org="yourorg" name="yourmodule9" rev="9.1" conf="myconf1->default;myconf2->default;myconf3->default">
+			<artifact name="yourartifact9-1" type="jar" ext="jar" conf="myconf1,myconf2"/>
+			<artifact name="yourartifact9-2" type="jar" ext="jar" conf="myconf2,myconf3"/>
+		</dependency>
+		<dependency org="yourorg" name="yourmodule10" rev="10.1" conf="*->*">
+			<include name="your.*" type="jar" ext="jar" matcher="exact"/>
+			<include name="*" type="*" ext="xml" matcher="exact"/>
+			<exclude org="*" module="*" name="toexclude" type="*" ext="*" matcher="exact"/>
+		</dependency>
+		<dependency org="yourorg" name="yourmodule11" rev="11.1" conf="*->*"/>
+		<exclude org="*" module="*servlet*" artifact="*" type="*" ext="*" conf="myconf1" matcher="glob"/>
+		<exclude org="acme" module="test" artifact="test" type="source" ext="jar" matcher="exact"/>
+		<override org="yourorg" module=".*1" matcher="regexp" branch="BRANCH" rev="1.0"/>
+	</dependencies>
+</ivy-module>