You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2007/12/28 01:11:43 UTC
svn commit: r607146 [2/4] - in /ant/ivy/core/trunk: ./
src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/
src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/cache/
src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/deliver/
src...
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java Thu Dec 27 16:11:39 2007
@@ -74,7 +74,7 @@
this.date = date;
// parse previous deps from previous report file if any
- ResolutionCacheManager cache = options.getCache();
+ ResolutionCacheManager cache = resolveEngine.getSettings().getResolutionCacheManager();
String resolveId = options.getResolveId();
File previousReportFile = cache.getConfigurationResolveReportInCache(resolveId, conf);
if (previousReportFile.exists()) {
@@ -253,6 +253,15 @@
total += reports == null ? 0 : reports.size();
}
return total;
+ }
+
+ public ArtifactDownloadReport[] getAllArtifactsReports() {
+ List result = new ArrayList();
+ for (Iterator iter = dependencyReports.values().iterator(); iter.hasNext();) {
+ Collection reports = (Collection) iter.next();
+ result.addAll(reports);
+ }
+ return (ArtifactDownloadReport[]) result.toArray(new ArtifactDownloadReport[result.size()]);
}
public ArtifactDownloadReport[] getDownloadedArtifactsReports() {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/DownloadStatus.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/DownloadStatus.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/DownloadStatus.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/DownloadStatus.java Thu Dec 27 16:11:39 2007
@@ -35,6 +35,26 @@
public static final DownloadStatus SUCCESSFUL = new DownloadStatus("successful");
public static final DownloadStatus FAILED = new DownloadStatus("failed");
+
+ /**
+ * Returns the {@link DownloadStatus} corresponding to the given String representation.
+ *
+ * @return the {@link DownloadStatus} corresponding to the given String representation.
+ * @throws IllegalArgumentException
+ * if the given String does not correspond to any {@link DownloadStatus}.
+ */
+ public static final DownloadStatus fromString(String status) {
+ if (NO.name.equals(status)) {
+ return NO;
+ }
+ if (SUCCESSFUL.name.equals(status)) {
+ return SUCCESSFUL;
+ }
+ if (FAILED.name.equals(status)) {
+ return FAILED;
+ }
+ throw new IllegalArgumentException("unknown download status '" + status + "'");
+ }
public String toString() {
return name;
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java Thu Dec 27 16:11:39 2007
@@ -30,6 +30,7 @@
import org.apache.ivy.core.cache.ResolutionCacheManager;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleId;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.IvyNode;
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.plugins.report.ReportOutputter;
@@ -122,6 +123,24 @@
for (Iterator iter = confReports.values().iterator(); iter.hasNext();) {
ConfigurationResolveReport report = (ConfigurationResolveReport) iter.next();
all.addAll(Arrays.asList(report.getFailedArtifactsReports()));
+ }
+ return (ArtifactDownloadReport[]) all.toArray(new ArtifactDownloadReport[all.size()]);
+ }
+
+ public ArtifactDownloadReport[] getAllArtifactsReports() {
+ Collection all = new HashSet();
+ for (Iterator iter = confReports.values().iterator(); iter.hasNext();) {
+ ConfigurationResolveReport report = (ConfigurationResolveReport) iter.next();
+ all.addAll(Arrays.asList(report.getAllArtifactsReports()));
+ }
+ return (ArtifactDownloadReport[]) all.toArray(new ArtifactDownloadReport[all.size()]);
+ }
+
+ public ArtifactDownloadReport[] getArtifactsReports(ModuleRevisionId mrid) {
+ Collection all = new HashSet();
+ for (Iterator iter = confReports.values().iterator(); iter.hasNext();) {
+ ConfigurationResolveReport report = (ConfigurationResolveReport) iter.next();
+ all.addAll(Arrays.asList(report.getDownloadReports(mrid)));
}
return (ArtifactDownloadReport[]) all.toArray(new ArtifactDownloadReport[all.size()]);
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java Thu Dec 27 16:11:39 2007
@@ -320,7 +320,7 @@
private ResolveData newResolveData() {
return new ResolveData(resolveEngine,
- new ResolveOptions().setCache(cacheManager).setUseOrigin(true));
+ new ResolveOptions().setUseOrigin(true));
}
private void ensureAnalyzed() {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java Thu Dec 27 16:11:39 2007
@@ -17,36 +17,15 @@
*/
package org.apache.ivy.core.resolve;
-import java.io.File;
-
-import org.apache.ivy.core.cache.CacheManager;
-import org.apache.ivy.core.cache.RepositoryCacheManager;
-import org.apache.ivy.core.settings.IvySettings;
public class DownloadOptions {
- private RepositoryCacheManager cacheManager;
-
private boolean useOrigin = false;
- public DownloadOptions(IvySettings settings, File cache) {
- this(CacheManager.getInstance(settings, cache));
- }
-
- public DownloadOptions(RepositoryCacheManager cacheManager) {
- this(cacheManager, false);
- }
-
- public DownloadOptions(RepositoryCacheManager cacheManager, boolean useOrigin) {
- this.cacheManager = cacheManager;
+ public DownloadOptions(boolean useOrigin) {
this.useOrigin = useOrigin;
}
public boolean isUseOrigin() {
return useOrigin;
}
-
- public RepositoryCacheManager getCacheManager() {
- return cacheManager;
- }
-
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java Thu Dec 27 16:11:39 2007
@@ -225,7 +225,8 @@
new EndResolveDependencyEvent(resolver, dependencyDescriptor, module,
System.currentTimeMillis() - start));
if (module != null) {
- data.getCacheManager().saveResolvers(module.getDescriptor(),
+ module.getResolver().getRepositoryCacheManager().saveResolvers(
+ module.getDescriptor(),
module.getResolver().getName(),
module.getArtifactResolver().getName());
if (settings.logModuleWhenFound()) {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java Thu Dec 27 16:11:39 2007
@@ -151,10 +151,6 @@
return options;
}
- public RepositoryCacheManager getCacheManager() {
- return options.getCache();
- }
-
public ResolveEngineSettings getSettings() {
return engine.getSettings();
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java Thu Dec 27 16:11:39 2007
@@ -36,8 +36,6 @@
import org.apache.ivy.Ivy;
import org.apache.ivy.core.IvyContext;
-import org.apache.ivy.core.cache.CacheManager;
-import org.apache.ivy.core.cache.RepositoryCacheManager;
import org.apache.ivy.core.cache.ResolutionCacheManager;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.event.download.PrepareDownloadEvent;
@@ -205,14 +203,6 @@
setDictatorResolver(new CacheResolver(settings));
}
try {
- CacheManager cacheManager = options.getCache();
- if (cacheManager == null) { // ensure that a cache is configured
- cacheManager = IvyContext.getContext().getCacheManager();
- options.setCache(cacheManager);
- } else {
- IvyContext.getContext().setCacheManager(cacheManager);
- }
-
String[] confs = options.getConfs(md);
options.setConfs(confs);
@@ -234,6 +224,7 @@
report.setDependencies(Arrays.asList(dependencies), options.getArtifactFilter());
// produce resolved ivy file and ivy properties in cache
+ ResolutionCacheManager cacheManager = settings.getResolutionCacheManager();
File ivyFileInCache = cacheManager.getResolvedIvyFileInCache(md
.getResolvedModuleRevisionId());
md.toIvyFile(ivyFileInCache);
@@ -281,8 +272,7 @@
if (options.isDownload()) {
Message.verbose(":: downloading artifacts ::");
- downloadArtifacts(report, cacheManager, options.isUseOrigin(), options
- .getArtifactFilter());
+ downloadArtifacts(report, options.isUseOrigin(), options.getArtifactFilter());
}
if (options.isOutputReport()) {
@@ -313,7 +303,7 @@
report.output(settings.getReportOutputters(), cacheMgr);
}
- public void downloadArtifacts(ResolveReport report, RepositoryCacheManager cacheManager,
+ public void downloadArtifacts(ResolveReport report,
boolean useOrigin, Filter artifactFilter) {
long start = System.currentTimeMillis();
IvyNode[] dependencies = (IvyNode[]) report.getDependencies().toArray(
@@ -330,8 +320,8 @@
DependencyResolver resolver = dependencies[i].getModuleRevision()
.getArtifactResolver();
Artifact[] selectedArtifacts = dependencies[i].getSelectedArtifacts(artifactFilter);
- DownloadReport dReport = resolver.download(selectedArtifacts, new DownloadOptions(
- cacheManager, useOrigin));
+ DownloadReport dReport = resolver.download(selectedArtifacts,
+ new DownloadOptions(useOrigin));
ArtifactDownloadReport[] adrs = dReport.getArtifactsReports();
for (int j = 0; j < adrs.length; j++) {
if (adrs[j].getDownloadStatus() == DownloadStatus.FAILED) {
@@ -364,22 +354,23 @@
/**
* Download an artifact to the cache. Not used internally, useful especially for IDE plugins
* needing to download artifact one by one (for source or javadoc artifact, for instance).
- * Downloaded artifact file can be accessed using getArchiveFileInCache method. It is possible
- * to track the progression of the download using classical ivy progress monitoring feature (see
- * addTransferListener).
+ * <p>
+ * Downloaded artifact file can be accessed using {@link ArtifactDownloadReport#getLocalFile()}.
+ * </p>
+ * <p>
+ * It is possible to track the progression of the download using classical ivy progress
+ * monitoring feature (see addTransferListener).
+ * </p>
*
* @param artifact
* the artifact to download
- * @param cacheManager
- * the cacheManager to use.
* @return a report concerning the download
*/
- public ArtifactDownloadReport download(Artifact artifact, RepositoryCacheManager cacheManager,
- boolean useOrigin) {
+ public ArtifactDownloadReport download(Artifact artifact, boolean useOrigin) {
DependencyResolver resolver = settings.getResolver(artifact.getModuleRevisionId()
.getModuleId());
- DownloadReport r = resolver.download(new Artifact[] {artifact}, new DownloadOptions(
- cacheManager, useOrigin));
+ DownloadReport r = resolver.download(new Artifact[] {artifact},
+ new DownloadOptions(useOrigin));
return r.getArtifactReport(artifact);
}
@@ -392,7 +383,7 @@
* url of the ivy file to use for dependency resolving
* @param confs
* an array of configuration names to resolve - must not be null nor empty
- * @param cache
+ * @param getCache
* the cache to use - default cache is used if null
* @param date
* the date to which resolution must be done - may be null
@@ -427,14 +418,7 @@
if (md == null) {
throw new NullPointerException("module descriptor must not be null");
}
- CacheManager cacheManager = options.getCache();
IvyContext context = IvyContext.getContext();
- if (cacheManager == null) { // ensure that a cache is configured
- cacheManager = context.getCacheManager();
- options.setCache(cacheManager);
- } else {
- context.setCacheManager(cacheManager);
- }
String[] confs = options.getConfs(md);
options.setConfs(confs);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java Thu Dec 27 16:11:39 2007
@@ -19,7 +19,6 @@
import java.util.Date;
-import org.apache.ivy.core.cache.CacheManager;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleId;
import org.apache.ivy.util.ConfigurationUtils;
@@ -45,11 +44,6 @@
private String revision = null;
/**
- * The cache manager to use during resolve. If it is null, default cache manager will be used.
- */
- private CacheManager cache = null;
-
- /**
* the date for which the dependencies should be resolved. All obtained artifacts should have a
* publication date which is before or equal to the given date. The date can be null, in which
* case all artifacts will be considered
@@ -108,7 +102,6 @@
public ResolveOptions(ResolveOptions options) {
confs = options.confs;
revision = options.revision;
- cache = options.cache;
date = options.date;
validate = options.validate;
useCacheOnly = options.useCacheOnly;
@@ -126,15 +119,6 @@
public ResolveOptions setArtifactFilter(Filter artifactFilter) {
this.artifactFilter = artifactFilter;
- return this;
- }
-
- public CacheManager getCache() {
- return cache;
- }
-
- public ResolveOptions setCache(CacheManager cache) {
- this.cache = cache;
return this;
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java Thu Dec 27 16:11:39 2007
@@ -35,8 +35,6 @@
import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.IvyPatternHelper;
-import org.apache.ivy.core.cache.CacheManager;
-import org.apache.ivy.core.cache.RepositoryCacheManager;
import org.apache.ivy.core.cache.ResolutionCacheManager;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.event.retrieve.EndRetrieveEvent;
@@ -46,6 +44,8 @@
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleId;
import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+import org.apache.ivy.core.report.DownloadStatus;
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.plugins.parser.ModuleDescriptorParser;
import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
@@ -85,7 +85,6 @@
String destIvyPattern = IvyPatternHelper.substituteVariables(options.getDestIvyPattern(),
settings.getVariables());
- RepositoryCacheManager cacheManager = getCacheManager(options);
String[] confs = getConfs(mrid, options);
Message.info("\tconfs: " + Arrays.asList(confs));
if (this.eventManager != null) {
@@ -108,21 +107,8 @@
int targetsUpToDate = 0;
long totalCopiedSize = 0;
for (Iterator iter = artifactsToCopy.keySet().iterator(); iter.hasNext();) {
- Artifact artifact = (Artifact) iter.next();
- File archive;
- if ("ivy".equals(artifact.getType())) {
- archive = cacheManager.getIvyFileInCache(artifact.getModuleRevisionId());
- } else {
- archive = cacheManager.getArchiveFileInCache(artifact, cacheManager
- .getSavedArtifactOrigin(artifact), options.isUseOrigin());
- if (!options.isUseOrigin() && !archive.exists()) {
- // file is not available in cache, maybe the last resolve was performed with
- // useOrigin=true.
- // we try to use the best we can
- archive = cacheManager.getArchiveFileInCache(artifact, cacheManager
- .getSavedArtifactOrigin(artifact));
- }
- }
+ ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
+ File archive = artifact.getLocalFile();
Set dest = (Set) artifactsToCopy.get(artifact);
Message.verbose("\tretrieving " + archive);
for (Iterator it2 = dest.iterator(); it2.hasNext();) {
@@ -194,7 +180,7 @@
String[] confs = options.getConfs();
if (confs == null || (confs.length == 1 && "*".equals(confs[0]))) {
try {
- File ivyFile = options.getCache().getResolvedIvyFileInCache(mrid);
+ File ivyFile = getCache().getResolvedIvyFileInCache(mrid);
Message.verbose("no explicit confs given for retrieve, using ivy file: " + ivyFile);
URL ivySource = ivyFile.toURL();
URLResource res = new URLResource(ivySource);
@@ -215,15 +201,8 @@
return confs;
}
- private CacheManager getCacheManager(RetrieveOptions options) {
- CacheManager cacheManager = options.getCache();
- if (cacheManager == null) { // ensure that a cache is configured
- cacheManager = IvyContext.getContext().getCacheManager();
- options.setCache(cacheManager);
- } else {
- IvyContext.getContext().setCacheManager(cacheManager);
- }
- return cacheManager;
+ private ResolutionCacheManager getCache() {
+ return settings.getResolutionCacheManager();
}
private void sync(Collection target, Collection existing) {
@@ -253,18 +232,20 @@
options.setResolveId(ResolveOptions.getDefaultResolveId(moduleId));
}
- ResolutionCacheManager cacheManager = getCacheManager(options);
+ ResolutionCacheManager cacheManager = getCache();
String[] confs = getConfs(mrid, options);
String destIvyPattern = IvyPatternHelper.substituteVariables(options.getDestIvyPattern(),
settings.getVariables());
// find what we must retrieve where
- final Map artifactsToCopy = new HashMap(); // Artifact source -> Set (String
- // copyDestAbsolutePath)
- final Map conflictsMap = new HashMap(); // String copyDestAbsolutePath -> Set (Artifact
- // source)
- final Map conflictsConfMap = new HashMap(); // String copyDestAbsolutePath -> Set (String
- // conf)
+
+ // ArtifactDownloadReport source -> Set (String copyDestAbsolutePath)
+ final Map artifactsToCopy = new HashMap();
+ // String copyDestAbsolutePath -> Set (ArtifactDownloadReport source)
+ final Map conflictsMap = new HashMap();
+ // String copyDestAbsolutePath -> Set (String conf)
+ final Map conflictsConfMap = new HashMap();
+
XmlReportParser parser = new XmlReportParser();
for (int i = 0; i < confs.length; i++) {
final String conf = confs[i];
@@ -273,15 +254,21 @@
conf);
parser.parse(report);
- Collection artifacts = new ArrayList(Arrays.asList(parser.getArtifacts()));
+ Collection artifacts = new ArrayList(Arrays.asList(parser.getArtifactReports()));
if (destIvyPattern != null) {
ModuleRevisionId[] mrids = parser.getRealDependencyRevisionIds();
for (int j = 0; j < mrids.length; j++) {
- artifacts.add(DefaultArtifact.newIvyArtifact(mrids[j], null));
+ ArtifactDownloadReport aReport = new ArtifactDownloadReport(
+ DefaultArtifact.newIvyArtifact(mrids[j], null));
+ aReport.setDownloadStatus(DownloadStatus.SUCCESSFUL);
+ // TODO cache: store metadata cache info in report and reuse it
+ aReport.setLocalFile(settings.getResolver(mrids[j].getModuleId())
+ .getRepositoryCacheManager().getIvyFileInCache(mrids[j]));
+ artifacts.add(aReport);
}
}
for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
- Artifact artifact = (Artifact) iter.next();
+ ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
String destPattern = "ivy".equals(artifact.getType()) ? destIvyPattern
: destFilePattern;
@@ -290,7 +277,8 @@
continue; // skip this artifact, the filter didn't accept it!
}
- String destFileName = IvyPatternHelper.substitute(destPattern, artifact, conf);
+ String destFileName = IvyPatternHelper.substitute(
+ destPattern, artifact.getArtifact(), conf);
Set dest = (Set) artifactsToCopy.get(artifact);
if (dest == null) {
@@ -332,14 +320,15 @@
+ " in "
+ conflictsConfs
+ ": "
- + ((Artifact) artifactsList.get(artifactsList.size() - 1))
- .getModuleRevisionId().getRevision() + " won");
+ + ((ArtifactDownloadReport) artifactsList.get(artifactsList.size() - 1))
+ .getArtifact().getModuleRevisionId().getRevision() + " won");
// we now iterate over the list beginning with the artifact preceding the winner,
// and going backward to the least artifact
for (int i = artifactsList.size() - 2; i >= 0; i--) {
- Artifact looser = (Artifact) artifactsList.get(i);
- Message.verbose("\t\tremoving conflict looser artifact: " + looser);
+ ArtifactDownloadReport looser = (ArtifactDownloadReport) artifactsList.get(i);
+ Message.verbose("\t\tremoving conflict looser artifact: "
+ + looser.getArtifact());
// for each loser, we remove the pair (loser - copyDest) in the artifactsToCopy
// map
Set dest = (Set) artifactsToCopy.get(looser);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java Thu Dec 27 16:11:39 2007
@@ -19,9 +19,9 @@
import java.util.Map;
-import org.apache.ivy.plugins.parser.ParserSettings;
+import org.apache.ivy.core.cache.CacheSettings;
-public interface RetrieveEngineSettings extends ParserSettings {
+public interface RetrieveEngineSettings extends CacheSettings {
boolean isCheckUpToDate();
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java Thu Dec 27 16:11:39 2007
@@ -17,7 +17,6 @@
*/
package org.apache.ivy.core.retrieve;
-import org.apache.ivy.core.cache.CacheManager;
import org.apache.ivy.util.filter.Filter;
import org.apache.ivy.util.filter.FilterHelper;
@@ -34,12 +33,6 @@
private String[] confs = new String[] {"*"};
/**
- * The cache manager to retrieve files from. If null, the default cache manager of the current
- * Ivy instance will be used.
- */
- private CacheManager cache = null;
-
- /**
* The pattern to which ivy files should be retrieved. If destIvyPattern is null no ivy files
* will be copied.
*/
@@ -79,15 +72,6 @@
public RetrieveOptions setArtifactFilter(Filter artifactFilter) {
this.artifactFilter = artifactFilter;
- return this;
- }
-
- public CacheManager getCache() {
- return cache;
- }
-
- public RetrieveOptions setCache(CacheManager cacheManager) {
- this.cache = cacheManager;
return this;
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java Thu Dec 27 16:11:39 2007
@@ -40,7 +40,10 @@
import org.apache.ivy.core.IvyPatternHelper;
import org.apache.ivy.core.NormalRelativeUrlResolver;
import org.apache.ivy.core.RelativeUrlResolver;
+import org.apache.ivy.core.cache.CacheManager;
import org.apache.ivy.core.cache.CacheSettings;
+import org.apache.ivy.core.cache.RepositoryCacheManager;
+import org.apache.ivy.core.cache.ResolutionCacheManager;
import org.apache.ivy.core.check.CheckEngineSettings;
import org.apache.ivy.core.deliver.DeliverEngineSettings;
import org.apache.ivy.core.install.InstallEngineSettings;
@@ -740,8 +743,13 @@
public File getDefaultCache() {
if (defaultCache == null) {
- setDefaultCache(new File(getDefaultIvyUserDir(), "cache"));
- Message.verbose("no default cache defined: set to " + defaultCache);
+ String cache = getVariable("ivy.cache.dir");
+ if (cache != null) {
+ defaultCache = new File(cache);
+ } else {
+ setDefaultCache(new File(getDefaultIvyUserDir(), "cache"));
+ Message.verbose("no default cache defined: set to " + defaultCache);
+ }
}
return defaultCache;
}
@@ -1066,6 +1074,14 @@
public void setCheckUpToDate(boolean checkUpToDate) {
this.checkUpToDate = checkUpToDate;
+ }
+
+ public ResolutionCacheManager getResolutionCacheManager() {
+ return CacheManager.getInstance(this, getDefaultCache());
+ }
+
+ public RepositoryCacheManager getDefaultRepositoryCacheManager() {
+ return CacheManager.getInstance(this, getDefaultCache());
}
public String getCacheArtifactPattern() {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java Thu Dec 27 16:11:39 2007
@@ -557,7 +557,6 @@
if (data == null) {
ResolveEngine engine = IvyContext.getContext().getIvy().getResolveEngine();
ResolveOptions options = new ResolveOptions();
- options.setCache(IvyContext.getContext().getCacheManager());
options.setDownload(false);
data = new ResolveData(engine, options);
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java Thu Dec 27 16:11:39 2007
@@ -32,9 +32,12 @@
import javax.xml.parsers.SAXParserFactory;
import org.apache.ivy.Ivy;
+import org.apache.ivy.core.cache.ArtifactOrigin;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+import org.apache.ivy.core.report.DownloadStatus;
import org.apache.ivy.util.extendable.ExtendableItemHelper;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -50,12 +53,15 @@
private List artifacts;
+ private List artifactReports;
+
private ModuleRevisionId mRevisionId;
private File report;
SaxXmlReportParser(File report) {
artifacts = new ArrayList();
+ artifactReports = new ArrayList();
mrids = new ArrayList();
defaultMrids = new ArrayList();
realMrids = new ArrayList();
@@ -132,16 +138,32 @@
return;
}
String status = attributes.getValue("status");
- if (status != null && "failed".equals(status)) {
- return;
- }
String artifactName = attributes.getValue("name");
String type = attributes.getValue("type");
String ext = attributes.getValue("ext");
Artifact artifact = new DefaultArtifact(mrid, pubdate, artifactName,
type, ext, ExtendableItemHelper.getExtraAttributes(attributes,
"extra-"));
- revisionArtifacts.add(artifact);
+ ArtifactDownloadReport aReport = new ArtifactDownloadReport(artifact);
+ aReport.setDownloadStatus(DownloadStatus.fromString(status));
+ aReport.setDownloadDetails(attributes.getValue("details"));
+ aReport.setSize(Long.parseLong(attributes.getValue("size")));
+ aReport.setDownloadTimeMillis(Long.parseLong(attributes.getValue("time")));
+ if (attributes.getValue("location") != null) {
+ aReport.setLocalFile(new File(attributes.getValue("location")));
+ }
+ revisionArtifacts.add(aReport);
+ } else if ("origin-location".equals(qName)) {
+ if (skip) {
+ return;
+ }
+ ArtifactDownloadReport aReport = (ArtifactDownloadReport)
+ revisionArtifacts.get(revisionArtifacts.size() - 1);
+
+ aReport.setArtifactOrigin(
+ new ArtifactOrigin(
+ Boolean.parseBoolean(attributes.getValue("is-local")),
+ attributes.getValue("location")));
} else if ("info".equals(qName)) {
String organisation = attributes.getValue("organisation");
String name = attributes.getValue("module");
@@ -166,8 +188,16 @@
if ("dependencies".equals(qname)) {
// add the artifacts in the correct order
for (Iterator it = revisionsMap.values().iterator(); it.hasNext();) {
- List artifacts = (List) it.next();
- SaxXmlReportParser.this.artifacts.addAll(artifacts);
+ List artifactReports = (List) it.next();
+ SaxXmlReportParser.this.artifactReports.addAll(artifactReports);
+ for (Iterator iter = artifactReports.iterator(); iter.hasNext();) {
+ ArtifactDownloadReport artifactReport
+ = (ArtifactDownloadReport) iter.next();
+ if (artifactReport.getDownloadStatus() != DownloadStatus.FAILED) {
+ artifacts.add(artifactReport.getArtifact());
+ }
+ }
+
}
}
}
@@ -183,6 +213,10 @@
return artifacts;
}
+ public List getArtifactReports() {
+ return artifactReports;
+ }
+
public List getModuleRevisionIds() {
return mrids;
}
@@ -218,6 +252,11 @@
public Artifact[] getArtifacts() {
return (Artifact[]) parser.getArtifacts().toArray(
new Artifact[parser.getArtifacts().size()]);
+ }
+
+ public ArtifactDownloadReport[] getArtifactReports() {
+ return (ArtifactDownloadReport[]) parser.getArtifactReports().toArray(
+ new ArtifactDownloadReport[parser.getArtifactReports().size()]);
}
public ModuleRevisionId[] getDependencyRevisionIds() {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java Thu Dec 27 16:11:39 2007
@@ -230,7 +230,13 @@
}
out.print(" status=\""
+ XMLHelper.escape(adr[i].getDownloadStatus().toString()) + "\"");
+ out.print(" details=\"" + XMLHelper.escape(adr[i].getDownloadDetails()) + "\"");
out.print(" size=\"" + adr[i].getSize() + "\"");
+ out.print(" time=\"" + adr[i].getDownloadTimeMillis() + "\"");
+ if (adr[i].getLocalFile() != null) {
+ out.print(" location=\""
+ + XMLHelper.escape(adr[i].getLocalFile().getAbsolutePath()) + "\"");
+ }
ArtifactOrigin origin = adr[i].getArtifactOrigin();
if (origin != null) {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java Thu Dec 27 16:11:39 2007
@@ -21,7 +21,7 @@
import java.util.Map;
import org.apache.ivy.core.IvyContext;
-import org.apache.ivy.core.cache.CacheManager;
+import org.apache.ivy.core.cache.RepositoryCacheManager;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
@@ -77,6 +77,8 @@
private Namespace namespace;
private String namespaceName;
+
+ private RepositoryCacheManager repositoryCacheManager;
public ResolverSettings getSettings() {
return settings;
@@ -168,8 +170,7 @@
* avoid the download
*/
public boolean exists(Artifact artifact) {
- DownloadReport dr = download(new Artifact[] {artifact}, new DownloadOptions(
- CacheManager.getInstance(getSettings()), true));
+ DownloadReport dr = download(new Artifact[] {artifact}, new DownloadOptions(true));
ArtifactDownloadReport adr = dr.getArtifactReport(artifact);
return adr.getDownloadStatus() != DownloadStatus.FAILED;
}
@@ -271,7 +272,7 @@
}
protected ResolvedModuleRevision findModuleInCache(ResolveData data, ModuleRevisionId mrid) {
- return data.getCacheManager().findModuleInCache(
+ return getRepositoryCacheManager().findModuleInCache(
mrid, doValidate(data), getName());
}
@@ -301,6 +302,17 @@
+ "'. It is set as changing matcher in " + this);
}
return matcher.getMatcher(changingPattern);
+ }
+
+ public RepositoryCacheManager getRepositoryCacheManager() {
+ if (repositoryCacheManager == null) {
+ repositoryCacheManager = settings.getDefaultRepositoryCacheManager();
+ }
+ return repositoryCacheManager;
+ }
+
+ public void setRepositoryCacheManager(RepositoryCacheManager repositoryCacheManager) {
+ this.repositoryCacheManager = repositoryCacheManager;
}
public void abortPublishTransaction() throws IOException {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java Thu Dec 27 16:11:39 2007
@@ -361,7 +361,7 @@
}
}
- RepositoryCacheManager cacheManager = data.getCacheManager();
+ RepositoryCacheManager cacheManager = getRepositoryCacheManager();
// the metadata artifact which was used to cache the original metadata file
Artifact requestedMetadataArtifact =
@@ -459,7 +459,7 @@
Artifact moduleArtifact = parser.getMetadataArtifact(resolvedMrid, mdRef.getResource());
boolean isChangingRevision = getChangingMatcher().matches(mrid.getRevision());
boolean isChangingDependency = isChangingRevision || dd.isChanging();
- return data.getCacheManager().cacheModuleDescriptor(
+ return getRepositoryCacheManager().cacheModuleDescriptor(
this, mdRef, moduleArtifact, downloader,
(CacheMetadataOptions) new CacheMetadataOptions()
.setChanging(isChangingDependency)
@@ -611,7 +611,7 @@
}
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
- RepositoryCacheManager cacheManager = options.getCacheManager();
+ RepositoryCacheManager cacheManager = getRepositoryCacheManager();
clearArtifactAttempts();
DownloadReport dr = new DownloadReport();
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/CacheResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/CacheResolver.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/CacheResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/CacheResolver.java Thu Dec 27 16:11:39 2007
@@ -23,6 +23,7 @@
import java.util.Collections;
import java.util.Date;
+import org.apache.ivy.core.cache.CacheSettings;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
@@ -59,19 +60,19 @@
// if we do not have to check modified and if the revision is exact and not changing,
// we first search for it in cache
if (!getSettings().getVersionMatcher().isDynamic(mrid)) {
- ResolvedModuleRevision rmr = data.getCacheManager()
+ ResolvedModuleRevision rmr = getRepositoryCacheManager()
.findModuleInCache(mrid, doValidate(data), null);
if (rmr != null) {
Message.verbose("\t" + getName() + ": revision in cache: " + mrid);
return rmr;
} else {
- logIvyAttempt(data.getCacheManager().getArchiveFileInCache(
+ logIvyAttempt(getRepositoryCacheManager().getArchiveFileInCache(
DefaultArtifact.newIvyArtifact(mrid, new Date())).getAbsolutePath());
Message.verbose("\t" + getName() + ": no ivy file in cache found for " + mrid);
return null;
}
} else {
- ensureConfigured(data.getSettings(), data.getCacheManager().getRepositoryCacheRoot());
+ ensureConfigured();
ResolvedResource ivyRef = findIvyFileRef(dd, data);
if (ivyRef != null) {
Message.verbose("\t" + getName() + ": found ivy file in cache for " + mrid);
@@ -86,8 +87,8 @@
+ resolvedMrid);
return node.getModuleRevision();
}
- ResolvedModuleRevision rmr = data.getCacheManager().findModuleInCache(resolvedMrid,
- doValidate(data), null);
+ ResolvedModuleRevision rmr = getRepositoryCacheManager()
+ .findModuleInCache(resolvedMrid, doValidate(data), null);
if (rmr != null) {
Message.verbose("\t" + getName() + ": revision in cache: " + resolvedMrid);
return rmr;
@@ -109,12 +110,12 @@
for (int i = 0; i < artifacts.length; i++) {
final ArtifactDownloadReport adr = new ArtifactDownloadReport(artifacts[i]);
dr.addArtifactReport(adr);
- File archiveFile = options.getCacheManager().getArchiveFileInCache(artifacts[i]);
+ File archiveFile = getRepositoryCacheManager().getArchiveFileInCache(artifacts[i]);
if (archiveFile.exists()) {
Message.verbose("\t[NOT REQUIRED] " + artifacts[i]);
adr.setDownloadStatus(DownloadStatus.NO);
adr.setSize(archiveFile.length());
- adr.setDownloadedFile(archiveFile);
+ adr.setLocalFile(archiveFile);
} else {
logArtifactAttempt(artifacts[i], archiveFile.getAbsolutePath());
adr.setDownloadStatus(DownloadStatus.FAILED);
@@ -154,11 +155,13 @@
private void ensureConfigured() {
if (getSettings() != null) {
+ // TODO: we need to address new cache management
+ // (where repository cache is not always in default cache directory)
ensureConfigured(getSettings(), getSettings().getDefaultCache());
}
}
- private void ensureConfigured(ResolverSettings settings, File cache) {
+ private void ensureConfigured(CacheSettings settings, File cache) {
if (settings == null || cache == null) {
return;
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java Thu Dec 27 16:11:39 2007
@@ -22,6 +22,7 @@
import java.text.ParseException;
import java.util.Map;
+import org.apache.ivy.core.cache.RepositoryCacheManager;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
@@ -113,4 +114,13 @@
void dumpSettings();
void setSettings(ResolverSettings settings);
+
+ /**
+ * Returns the {@link RepositoryCacheManager} used to manage the repository cache associated
+ * with this dependency resolver.
+ *
+ * @return the {@link RepositoryCacheManager} used to manage the repository cache associated
+ * with this dependency resolver.
+ */
+ RepositoryCacheManager getRepositoryCacheManager();
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java Thu Dec 27 16:11:39 2007
@@ -82,7 +82,6 @@
}
private ResolveOptions getResolveOptions(IvySettings settings, String[] confs) {
- return new ResolveOptions().setConfs(confs).setCache(
- CacheManager.getInstance(settings, settings.getDefaultCache()));
+ return new ResolveOptions().setConfs(confs);
}
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java Thu Dec 27 16:11:39 2007
@@ -29,7 +29,7 @@
import junit.framework.Assert;
-import org.apache.ivy.core.cache.CacheManager;
+import org.apache.ivy.core.cache.RepositoryCacheManager;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
@@ -49,16 +49,27 @@
public class TestHelper {
- public static File getArchiveFileInCache(Ivy ivy, File cache, String organisation,
- String module, String revision, String artifact, String type, String ext) {
- return getArchiveFileInCache(ivy.getCacheManager(cache), organisation, module, revision,
- artifact, type, ext);
+ public static DefaultArtifact newArtifact(
+ String organisation, String module, String revision,
+ String artifact, String type, String ext) {
+ return new DefaultArtifact(ModuleRevisionId.newInstance(
+ organisation, module, revision), new Date(), artifact, type, ext);
}
+
+
+ public static File getArchiveFileInCache(Ivy ivy, String organisation, String module,
+ String revision, String artifactName, String type, String ext) {
+ DefaultArtifact artifact = newArtifact(organisation, module, revision,
+ artifactName, type, ext);
+ return getRepositoryCacheManager(ivy, artifact.getModuleRevisionId())
+ .getArchiveFileInCache(artifact);
+ }
+
- public static File getArchiveFileInCache(CacheManager cacheManager, String organisation,
- String module, String revision, String artifact, String type, String ext) {
- return cacheManager.getArchiveFileInCache(new DefaultArtifact(ModuleRevisionId.newInstance(
- organisation, module, revision), new Date(), artifact, type, ext));
+ public static RepositoryCacheManager getRepositoryCacheManager(Ivy ivy, ModuleRevisionId id) {
+ // WARN: this doesn't work if the resolver registered is a compound resolver (chain or dual)
+ // and a sub resolver doesn't use the same cache manager as the parent
+ return ivy.getSettings().getResolver(id.getModuleId()).getRepositoryCacheManager();
}
/**
@@ -294,6 +305,6 @@
* @return the basic resolve options, useful for testing
*/
public static ResolveOptions newResolveOptions(IvySettings settings) {
- return new ResolveOptions().setCache(CacheManager.getInstance(settings));
+ return new ResolveOptions();
}
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java Thu Dec 27 16:11:39 2007
@@ -39,7 +39,7 @@
prop = new IvyArtifactProperty();
prop.setProject(project);
- prop.setCache(cache);
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
}
private void createCache() {
@@ -71,7 +71,6 @@
public void testWithResolveId() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
resolve.setResolveId("abc");
resolve.execute();
@@ -79,7 +78,6 @@
// resolve another ivy file
resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
resolve.execute();
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactReportTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactReportTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactReportTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactReportTest.java Thu Dec 27 16:11:39 2007
@@ -38,7 +38,7 @@
prop = new IvyArtifactReport();
prop.setProject(project);
- prop.setCache(cache);
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
}
private void createCache() {
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java Thu Dec 27 16:11:39 2007
@@ -42,7 +42,7 @@
fileset = new IvyCacheFileset();
fileset.setProject(project);
- fileset.setCache(cache);
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
}
private void createCache() {
@@ -72,19 +72,19 @@
DirectoryScanner directoryScanner = fs.getDirectoryScanner(project);
assertEquals(1, directoryScanner.getIncludedFiles().length);
assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar")
- .getAbsolutePath(), new File("build/cache/"
- + directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
+ .getAbsolutePath(), new File(directoryScanner.getBasedir(),
+ directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
}
private File getArchiveFileInCache(String organisation, String module, String revision,
String artifact, String type, String ext) {
- return TestHelper.getArchiveFileInCache(fileset.getIvyInstance(), cache, organisation,
+ return TestHelper.getArchiveFileInCache(fileset.getIvyInstance(), organisation,
module, revision, artifact, type, ext);
}
private File getArchiveFileInCache(String organisation, String module, String revision,
String artifact, String type, String ext, File cache) {
- return TestHelper.getArchiveFileInCache(fileset.getIvyInstance(), cache, organisation,
+ return TestHelper.getArchiveFileInCache(fileset.getIvyInstance(), organisation,
module, revision, artifact, type, ext);
}
@@ -130,7 +130,7 @@
try {
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
fileset.setSetid("simple-setid");
- fileset.setCache(cache2);
+ System.setProperty("ivy.cache.dir", cache2.getAbsolutePath());
fileset.execute();
Object ref = project.getReference("simple-setid");
assertNotNull(ref);
@@ -139,8 +139,8 @@
DirectoryScanner directoryScanner = fs.getDirectoryScanner(project);
assertEquals(1, directoryScanner.getIncludedFiles().length);
assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar",
- cache2).getAbsolutePath(), new File("build/cache2/"
- + directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
+ cache2).getAbsolutePath(), new File(directoryScanner.getBasedir(),
+ directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
} finally {
Delete del = new Delete();
del.setProject(new Project());
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java Thu Dec 27 16:11:39 2007
@@ -41,7 +41,7 @@
path = new IvyCachePath();
path.setProject(project);
- path.setCache(cache);
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
}
private void createCache() {
@@ -160,7 +160,6 @@
public void testWithResolveId() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
resolve.setResolveId("withResolveId");
resolve.execute();
@@ -168,7 +167,6 @@
// resolve another ivy file
resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
resolve.execute();
@@ -191,7 +189,6 @@
IvyResolve resolve = new IvyResolve();
resolve.setProject(otherProject);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
resolve.setResolveId("withResolveId");
resolve.execute();
@@ -199,7 +196,6 @@
// resolve another ivy file
resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
resolve.execute();
@@ -223,7 +219,6 @@
IvyResolve resolve = new IvyResolve();
resolve.setProject(otherProject);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
resolve.setResolveId("testWithResolveIdAndMissingConfs");
resolve.setConf("default");
@@ -232,7 +227,6 @@
// resolve another ivy file
resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
resolve.execute();
@@ -247,7 +241,7 @@
private File getArchiveFileInCache(String organisation, String module, String revision,
String artifact, String type, String ext) {
- return TestHelper.getArchiveFileInCache(path.getIvyInstance(), cache, organisation,
+ return TestHelper.getArchiveFileInCache(path.getIvyInstance(), organisation,
module, revision, artifact, type, ext);
}
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java Thu Dec 27 16:11:39 2007
@@ -52,7 +52,7 @@
deliver = new IvyDeliver();
deliver.setProject(project);
- deliver.setCache(cache);
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
}
private void createCache() {
@@ -113,7 +113,6 @@
public void testWithResolveId() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
resolve.setResolveId("withResolveId");
resolve.execute();
@@ -121,7 +120,6 @@
// resolve another ivy file
resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
resolve.execute();
@@ -152,7 +150,6 @@
// do a resolve in the new build
IvyResolve resolve = new IvyResolve();
resolve.setProject(other);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
resolve.setResolveId("withResolveId");
resolve.execute();
@@ -160,7 +157,6 @@
// resolve another ivy file
resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
resolve.execute();
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java Thu Dec 27 16:11:39 2007
@@ -40,7 +40,7 @@
install = new IvyInstall();
install.setProject(project);
- install.setCache(cache);
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
}
private void createCache() {
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java Thu Dec 27 16:11:39 2007
@@ -48,7 +48,7 @@
}
};
task.setProject(project);
- task.setCache(cache);
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
}
private void createCache() {
@@ -63,7 +63,6 @@
public void testWithPreviousResolveInSameBuildAndLessConfs() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
resolve.setConf("default,compile");
resolve.execute();
@@ -82,7 +81,6 @@
public void testWithPreviousResolveInSameBuildAndSameConfs() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
resolve.setConf("default");
resolve.execute();
@@ -101,7 +99,6 @@
public void testWithPreviousResolveInSameBuildAndWildcard() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
resolve.setConf("*");
resolve.execute();
@@ -120,7 +117,6 @@
public void testWithPreviousResolveInSameBuildAndBothWildcard() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
resolve.setConf("*");
resolve.execute();
@@ -139,7 +135,6 @@
public void testWithPreviousResolveInSameBuildAndMoreConfs() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
resolve.setConf("compile");
resolve.execute();
@@ -163,7 +158,6 @@
public void testWithoutKeep() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
resolve.setConf("compile");
resolve.execute();
@@ -219,7 +213,6 @@
public void testWithResolveIdAndPreviousResolveInSameBuildAndLessConfs() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
resolve.setConf("default,compile");
resolve.setResolveId("testResolveId");
@@ -231,7 +224,6 @@
// perform another resolve
resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
resolve.setConf("*");
resolve.execute();
@@ -255,7 +247,6 @@
public void testWithResolveIdAndPreviousResolveInSameBuildAndSameConfs() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
resolve.setConf("default");
resolve.setResolveId("testResolveId");
@@ -267,7 +258,6 @@
// perform another resolve
resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
resolve.setConf("*");
resolve.execute();
@@ -291,7 +281,6 @@
public void testWithResolveIdAndPreviousResolveInSameBuildAndWildcard() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
resolve.setConf("*");
resolve.setResolveId("testResolveId");
@@ -303,7 +292,6 @@
// perform another resolve
resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
resolve.setConf("*");
resolve.execute();
@@ -327,7 +315,6 @@
public void testWithResolveIdAndPreviousResolveInSameBuildAndBothWildcard() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
resolve.setConf("*");
resolve.setResolveId("testResolveId");
@@ -339,7 +326,6 @@
// perform another resolve
resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
resolve.setConf("*");
resolve.execute();
@@ -363,7 +349,6 @@
public void testWithResolveIdAndPreviousResolveInSameBuildAndMoreConfs() throws Exception {
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
resolve.setConf("compile");
resolve.setResolveId("testResolveId");
@@ -379,7 +364,6 @@
// perform another resolve
resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
resolve.setConf("*");
resolve.execute();
@@ -403,7 +387,7 @@
private File getArchiveFileInCache(String organisation, String module, String revision,
String artifact, String type, String ext) {
- return TestHelper.getArchiveFileInCache(task.getIvyInstance(), cache, organisation,
+ return TestHelper.getArchiveFileInCache(task.getIvyInstance(), organisation,
module, revision, artifact, type, ext);
}
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java Thu Dec 27 16:11:39 2007
@@ -53,7 +53,7 @@
publish = new IvyPublish();
publish.setProject(project);
- publish.setCache(cache);
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
Message.setDefaultLogger(new DefaultMessageLogger(10));
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyReportTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyReportTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyReportTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyReportTest.java Thu Dec 27 16:11:39 2007
@@ -40,7 +40,7 @@
report = new IvyReport();
report.setTaskName("report");
report.setProject(project);
- report.setCache(cache);
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
}
private void createCache() {
@@ -69,7 +69,6 @@
IvyResolve res = new IvyResolve();
res.setProject(project);
res.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
- res.setCache(cache);
res.execute();
report.setTodir(new File(cache, "report"));
@@ -92,7 +91,6 @@
IvyResolve res = new IvyResolve();
res.setProject(project);
res.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
- res.setCache(cache);
res.execute();
report.setTodir(new File(cache, "report"));
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRepositoryReportTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRepositoryReportTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRepositoryReportTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRepositoryReportTest.java Thu Dec 27 16:11:39 2007
@@ -36,7 +36,7 @@
report = new IvyRepositoryReport();
report.setProject(project);
- report.setCache(cache);
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
}
private void createCache() {
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java Thu Dec 27 16:11:39 2007
@@ -23,6 +23,7 @@
import org.apache.ivy.Ivy;
import org.apache.ivy.TestHelper;
+import org.apache.ivy.core.cache.RepositoryCacheManager;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -37,10 +38,10 @@
createCache();
Project project = new Project();
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
+ project.setProperty("ivy.cache.dir", cache.getAbsolutePath());
resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
}
private void createCache() {
@@ -89,16 +90,16 @@
private File getArchiveFileInCache(String organisation, String module, String revision,
String artifact, String type, String ext) {
- return TestHelper.getArchiveFileInCache(getIvy(), cache, organisation, module, revision,
+ return TestHelper.getArchiveFileInCache(getIvy(), organisation, module, revision,
artifact, type, ext);
}
private File getIvyFileInCache(ModuleRevisionId id) {
- return getIvy().getCacheManager(cache).getIvyFileInCache(id);
+ return TestHelper.getRepositoryCacheManager(getIvy(), id).getIvyFileInCache(id);
}
private File getResolvedIvyFileInCache(ModuleRevisionId id) {
- return getIvy().getCacheManager(cache).getResolvedIvyFileInCache(id);
+ return getIvy().getResolutionCacheManager().getResolvedIvyFileInCache(id);
}
public void testInline() throws Exception {
@@ -218,7 +219,7 @@
assertTrue(getResolvedIvyFileInCache(
ModuleRevisionId.newInstance("apache", "resolve-simple", "1.0")).exists());
- assertTrue(getIvy().getCacheManager(cache).getConfigurationResolveReportInCache(
+ assertTrue(getIvy().getResolutionCacheManager().getConfigurationResolveReportInCache(
"testWithResolveId", "default").exists());
// dependencies
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveTest.java Thu Dec 27 16:11:39 2007
@@ -49,7 +49,7 @@
retrieve = new IvyRetrieve();
retrieve.setProject(project);
- retrieve.setCache(cache);
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
retrieve.setPattern(RETRIEVE_PATTERN);
}
@@ -150,7 +150,6 @@
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.execute();
// then we do a retrieve with the correct module information
@@ -170,7 +169,6 @@
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setResolveId("testWithAPreviousResolveAndResolveId");
resolve.execute();
@@ -193,7 +191,6 @@
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
- resolve.setCache(cache);
resolve.setUseOrigin(true);
resolve.execute();
@@ -336,7 +333,6 @@
retrieve = new IvyRetrieve();
retrieve.setProject(project);
- retrieve.setCache(cache);
retrieve.setPattern(RETRIEVE_PATTERN);
retrieve.setConf("compile,unittest");
retrieve.execute();
@@ -352,7 +348,7 @@
private File getArchiveFileInCache(String organisation, String module, String revision,
String artifact, String type, String ext) {
- return TestHelper.getArchiveFileInCache(retrieve.getIvyInstance(), cache, organisation,
+ return TestHelper.getArchiveFileInCache(retrieve.getIvyInstance(), organisation,
module, revision, artifact, type, ext);
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java Thu Dec 27 16:11:39 2007
@@ -148,8 +148,7 @@
}
private ResolveOptions getResolveOptions(String[] confs) {
- return new ResolveOptions().setConfs(confs).setCache(
- CacheManager.getInstance(ivy.getSettings(), cache));
+ return new ResolveOptions().setConfs(confs);
}
public static void main(String[] args) throws Exception {
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/install/InstallTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/install/InstallTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/install/InstallTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/install/InstallTest.java Thu Dec 27 16:11:39 2007
@@ -34,7 +34,7 @@
ivy.configure(new File("test/repositories/ivysettings.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), ivy.getSettings()
- .getDefaultResolver().getName(), "install", true, true, true, null, _cache,
+ .getDefaultResolver().getName(), "install", true, true, true, null,
PatternMatcher.EXACT);
assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.0.xml").exists());
@@ -46,7 +46,7 @@
ivy.configure(new File("test/repositories/ivysettings-nodefaultresolver.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), "test", "install", true,
- true, true, null, _cache, PatternMatcher.EXACT);
+ true, true, null, PatternMatcher.EXACT);
assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
@@ -57,7 +57,7 @@
ivy.configure(new File("test/repositories/ivysettings.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), ivy.getSettings()
- .getDefaultResolver().getName(), "install", true, true, true, null, _cache,
+ .getDefaultResolver().getName(), "install", true, true, true, null,
PatternMatcher.EXACT);
assertTrue(new File("build/test/install/org1/mod1.1/ivy-1.0.xml").exists());
@@ -72,7 +72,7 @@
ivy.configure(new File("test/repositories/ivysettings.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), ivy.getSettings()
- .getDefaultResolver().getName(), "install", false, true, true, null, _cache,
+ .getDefaultResolver().getName(), "install", false, true, true, null,
PatternMatcher.EXACT);
assertTrue(new File("build/test/install/org1/mod1.1/ivy-1.0.xml").exists());
@@ -87,7 +87,7 @@
ivy.configure(new File("test/repositories/ivysettings.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", ".*", ".*"), "1", "install", false, true,
- true, null, _cache, PatternMatcher.REGEXP);
+ true, null, PatternMatcher.REGEXP);
assertTrue(new File("build/test/install/org1/mod1.1/ivy-1.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/mod1.1-1.0.jar").exists());
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/publish/PublishEngineTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/publish/PublishEngineTest.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/publish/PublishEngineTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/publish/PublishEngineTest.java Thu Dec 27 16:11:39 2007
@@ -42,6 +42,7 @@
public class PublishEngineTest extends TestCase {
protected void setUp() throws Exception {
+ System.setProperty("ivy.cache.dir", new File("build/test/publish/cache").getAbsolutePath());
FileUtil.forceDelete(new File("build/test/publish"));
}
protected void tearDown() throws Exception {
@@ -131,8 +132,7 @@
new DefaultDependencyDescriptor(ModuleRevisionId.parse(module), false),
new ResolveData(
new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
- new ResolveOptions().setCache(
- new CacheManager(settings, new File("build/test/publish/cache")))));
+ new ResolveOptions()));
}
private void sleepSilently(int timeout) {
try {