You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2009/07/02 12:03:31 UTC
svn commit: r790534 - in /ant/ivy/core/trunk: CHANGES.txt
src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
test/repositories/1/org20/mod20.1/ivys/ivy-1.2.xml
Author: hibou
Date: Thu Jul 2 10:03:31 2009
New Revision: 790534
URL: http://svn.apache.org/viewvc?rev=790534&view=rev
Log:
IVY-1098:
- fix : hascode and equals added on ArtifactDownloadReport so that the map used in RetrieveEngine#determineArtifactsToCopy will avoid duplicates
- unit test added
Added:
ant/ivy/core/trunk/test/repositories/1/org20/mod20.1/ivys/ivy-1.2.xml (with props)
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=790534&r1=790533&r2=790534&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Jul 2 10:03:31 2009
@@ -115,6 +115,7 @@
- FIX: Ivy doesn't handle maven dependencies with type 'test-jar' correctly (IVY-1066)
- FIX: transitive dependencies and conflict management (IVY-1083)
- FIX: exclude does not work in non-trivial conf case (IVY-983)
+- FIX: The artifact report task is generating duplicate artifact entries (IVY-1098)
2.1.0-rc1
=====================================
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java?rev=790534&r1=790533&r2=790534&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java Thu Jul 2 10:03:31 2009
@@ -154,4 +154,33 @@
public boolean isDownloaded() {
return DownloadStatus.SUCCESSFUL == downloadStatus;
}
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((artifact == null) ? 0 : artifact.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ArtifactDownloadReport other = (ArtifactDownloadReport) obj;
+ if (artifact == null) {
+ if (other.artifact != null) {
+ return false;
+ }
+ } else if (!artifact.equals(other.artifact)) {
+ return false;
+ }
+ return true;
+ }
+
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java?rev=790534&r1=790533&r2=790534&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java Thu Jul 2 10:03:31 2009
@@ -21,6 +21,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import junit.framework.TestCase;
@@ -33,6 +34,7 @@
import org.apache.ivy.core.event.retrieve.StartRetrieveArtifactEvent;
import org.apache.ivy.core.event.retrieve.StartRetrieveEvent;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.report.ResolveReport;
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.util.Message;
@@ -250,6 +252,33 @@
"jar", "jar", "default")).exists());
}
+ public void testRetrieveReport() throws Exception {
+ // mod1.1 depends on mod1.2
+ ResolveReport report = ivy.resolve(new File(
+ "test/repositories/1/org20/mod20.1/ivys/ivy-1.2.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
+ assertNotNull(report);
+ ModuleDescriptor md = report.getModuleDescriptor();
+ assertNotNull(md);
+
+ ModuleRevisionId mrid = md.getModuleRevisionId();
+ RetrieveOptions options = getRetrieveOptions();
+ options.setConfs(new String[] {"A"});
+ Map artifactsToCopy = ivy.getRetrieveEngine().determineArtifactsToCopy(mrid,
+ "build/test/retrieve/[module]/[conf]/[artifact]-[revision].[ext]", options);
+ assertEquals(2, artifactsToCopy.size());
+
+ options.setConfs(new String[] {"B"});
+ artifactsToCopy = ivy.getRetrieveEngine().determineArtifactsToCopy(mrid,
+ "build/test/retrieve/[module]/[conf]/[artifact]-[revision].[ext]", options);
+ assertEquals(2, artifactsToCopy.size());
+
+ options.setConfs(new String[] {"A", "B"});
+ artifactsToCopy = ivy.getRetrieveEngine().determineArtifactsToCopy(mrid,
+ "build/test/retrieve/[module]/[conf]/[artifact]-[revision].[ext]", options);
+ assertEquals(3, artifactsToCopy.size());
+ }
+
private RetrieveOptions getRetrieveOptions() {
return new RetrieveOptions();
}
Added: ant/ivy/core/trunk/test/repositories/1/org20/mod20.1/ivys/ivy-1.2.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/org20/mod20.1/ivys/ivy-1.2.xml?rev=790534&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/1/org20/mod20.1/ivys/ivy-1.2.xml (added)
+++ ant/ivy/core/trunk/test/repositories/1/org20/mod20.1/ivys/ivy-1.2.xml Thu Jul 2 10:03:31 2009
@@ -0,0 +1,34 @@
+<!--
+ 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="1.0">
+ <info organisation="org20"
+ module="mod20.1"
+ revision="1.2"
+ status="integration"
+ publication="20090526110000"
+ />
+ <configurations>
+ <conf name="A" />
+ <conf name="B" />
+ </configurations>
+ <publications/>
+ <dependencies>
+ <dependency org="org2" name="mod2.1" rev="0.5" conf="A->A;B->B" />
+ </dependencies>
+</ivy-module>
Propchange: ant/ivy/core/trunk/test/repositories/1/org20/mod20.1/ivys/ivy-1.2.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/core/trunk/test/repositories/1/org20/mod20.1/ivys/ivy-1.2.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/core/trunk/test/repositories/1/org20/mod20.1/ivys/ivy-1.2.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml