Author: xavier
Date: Wed Mar 7 02:07:00 2007
New Revision: 515510
URL: http://svn.apache.org/viewvc?view=rev&rev=515510
Log:
FIX: Static revision replacement is not working when delivering an artifact
with a dependency having extra attributes (IVY-415)
Added:
incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-latest-extra.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/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.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=515510&r1=515509&r2=515510
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Wed Mar 7 02:07:00 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 having extra attributes (IVY-415)
- 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)
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=515510&r1=515509&r2=515510
==============================================================================
---
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
Wed Mar 7 02:07:00 2007
@@ -66,6 +66,8 @@
*
*/
public class XmlModuleDescriptorParser extends AbstractModuleDescriptorParser {
+ static final String[] DEPENDENCY_REGULAR_ATTRIBUTES = new String[] {"org",
"name", "branch", "rev", "force", "transitive", "changing", "conf"};
+
private static XmlModuleDescriptorParser INSTANCE = new
XmlModuleDescriptorParser();
public static XmlModuleDescriptorParser getInstance() {
@@ -126,7 +128,8 @@
private static class Parser extends AbstractParser {
- private static final List ALLOWED_VERSIONS = Arrays.asList(new String[]
{"1.0", "1.1", "1.2", "1.3", "1.4"});
+
+ private static final List ALLOWED_VERSIONS = Arrays.asList(new String[]
{"1.0", "1.1", "1.2", "1.3", "1.4"});
private DefaultDependencyDescriptor _dd;
private DefaultDependencyArtifactDescriptor _dad;
@@ -313,7 +316,7 @@
ModuleRevisionId.newInstance(org, name, branch,
rev,
ExtendableItemHelper.getExtraAttributes(
attributes,
- new String[]
{"org", "name", "branch", "rev", "force", "transitive", "changing", "conf"})),
+
DEPENDENCY_REGULAR_ATTRIBUTES)),
force, changing, transitive);
_md.addDependency(_dd);
String confs = _ivy.substitute(attributes.getValue("conf"));
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java?view=diff&rev=515510&r1=515509&r2=515510
==============================================================================
---
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
(original)
+++
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
Wed Mar 7 02:07:00 2007
@@ -42,6 +42,7 @@
import org.apache.ivy.plugins.namespace.Namespace;
import org.apache.ivy.util.Message;
import org.apache.ivy.util.XMLHelper;
+import org.apache.ivy.util.extendable.ExtendableItemHelper;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@@ -218,7 +219,10 @@
String module = substitute(settings,
attributes.getValue("name"));
String branch = substitute(settings,
attributes.getValue("branch"));
String revision = substitute(settings,
attributes.getValue("rev"));
- ModuleRevisionId localMid = ModuleRevisionId.newInstance(org,
module, branch, revision);
+ ModuleRevisionId localMid = ModuleRevisionId.newInstance(org,
module, branch, revision,
+ ExtendableItemHelper.getExtraAttributes(
+ attributes,
+
XmlModuleDescriptorParser.DEPENDENCY_REGULAR_ATTRIBUTES));
ModuleRevisionId systemMid = ns == null ?
localMid :
ns.getToSystemTransformer().transform(localMid);
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=515510&r1=515509&r2=515510
==============================================================================
--- 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
Wed Mar 7 02:07:00 2007
@@ -20,6 +20,8 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
+import java.util.HashMap;
+import java.util.Map;
import junit.framework.TestCase;
@@ -122,6 +124,31 @@
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "TRUNK",
"2.2"), dds[0].getDependencyRevisionId());
+ }
+
+ public void testWithExtraAttributes() throws Exception {
+ // test case for IVY-415
+ _project.setProperty("ivy.dep.file",
"test/java/org/apache/ivy/ant/ivy-latest-extra.xml");
+ IvyResolve res = new IvyResolve();
+ res.setValidate(false);
+ res.setProject(_project);
+ res.execute();
+
+ _deliver.setPubrevision("1.2");
+ _deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
+ _deliver.setValidate(false);
+ _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(), false);
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest",
"1.2"), md.getModuleRevisionId());
+ DependencyDescriptor[] dds = md.getDependencies();
+ assertEquals(1, dds.length);
+ Map extraAtt = new HashMap();
+ extraAtt.put("myExtraAtt", "myValue");
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2",
extraAtt), dds[0].getDependencyRevisionId());
}
public void testReplaceImportedConfigurations() throws Exception {
Added:
incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-latest-extra.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-latest-extra.xml?view=auto&rev=515510
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-latest-extra.xml
(added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-latest-extra.xml
Wed Mar 7 02:07:00 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"
myExtraAtt="myValue" />
+ </dependencies>
+</ivy-module>