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 2008/03/02 12:54:52 UTC
svn commit: r632743 - in /ant/ivy/core/trunk:
src/java/org/apache/ivy/core/deliver/ src/java/org/apache/ivy/core/publish/
src/java/org/apache/ivy/plugins/parser/xml/
test/java/org/apache/ivy/plugins/parser/xml/
Author: xavier
Date: Sun Mar 2 03:54:51 2008
New Revision: 632743
URL: http://svn.apache.org/viewvc?rev=632743&view=rev
Log:
fix style: refactor: introduce UpdateOptions to reduce the number of parameters for XmlModuleDescriptorUpdater update methods
Added:
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java (with props)
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.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/XmlModuleDescriptorUpdater.java
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java?rev=632743&r1=632742&r2=632743&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java Sun Mar 2 03:54:51 2008
@@ -36,6 +36,7 @@
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.plugins.parser.xml.UpdateOptions;
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorUpdater;
import org.apache.ivy.plugins.report.XmlReportParser;
@@ -180,9 +181,15 @@
confsToRemove.removeAll(Arrays.asList(confs));
try {
- XmlModuleDescriptorUpdater.update(settings, ivyFileURL, new File(publishedIvy),
- resolvedDependencies, options.getStatus(), revision, options.getPubdate(), null,
- true, (String[]) confsToRemove.toArray(new String[confsToRemove.size()]));
+ XmlModuleDescriptorUpdater.update(ivyFileURL, new File(publishedIvy),
+ new UpdateOptions()
+ .setSettings(settings)
+ .setResolvedRevisions(resolvedDependencies)
+ .setStatus(options.getStatus())
+ .setRevision(revision)
+ .setPubdate(options.getPubdate())
+ .setConfsToExclude((String[]) confsToRemove
+ .toArray(new String[confsToRemove.size()])));
} catch (SAXException ex) {
throw new RuntimeException("bad ivy file in cache for " + mrid
+ ": please clean and resolve again", ex);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java?rev=632743&r1=632742&r2=632743&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java Sun Mar 2 03:54:51 2008
@@ -26,7 +26,6 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -42,6 +41,7 @@
import org.apache.ivy.core.module.descriptor.MDArtifact;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.plugins.parser.xml.UpdateOptions;
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorUpdater;
import org.apache.ivy.plugins.resolver.DependencyResolver;
@@ -116,11 +116,16 @@
confsToRemove.removeAll(Arrays.asList(confs));
try {
- XmlModuleDescriptorUpdater.update(settings, ivyFileURL, tmp, new HashMap(),
- options.getStatus() == null ? md.getStatus() : options.getStatus(),
- options.getPubrevision(), options.getPubdate() == null ? new Date()
- : options.getPubdate(), null, true, (String[]) confsToRemove
- .toArray(new String[confsToRemove.size()]));
+ XmlModuleDescriptorUpdater.update(ivyFileURL, tmp,
+ new UpdateOptions()
+ .setSettings(settings)
+ .setStatus(options.getStatus() == null
+ ? md.getStatus() : options.getStatus())
+ .setRevision(options.getPubrevision())
+ .setPubdate(options.getPubdate() == null ? new Date()
+ : options.getPubdate())
+ .setConfsToExclude((String[]) confsToRemove
+ .toArray(new String[confsToRemove.size()])));
ivyFile = tmp;
// we parse the new file to get updated module descriptor
md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
Added: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java?rev=632743&view=auto
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java (added)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java Sun Mar 2 03:54:51 2008
@@ -0,0 +1,117 @@
+/*
+ * 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.plugins.parser.xml;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.Map;
+
+import org.apache.ivy.plugins.namespace.Namespace;
+import org.apache.ivy.plugins.parser.ParserSettings;
+
+public class UpdateOptions {
+ /**
+ * Settings to use for update, may be <code>null</code>.
+ */
+ private ParserSettings settings = null;
+ /**
+ * Namespace in which the module to update is, may be <code>null</code>.
+ */
+ private Namespace namespace = null;
+ /**
+ * Map from ModuleId of dependencies to new revision (as String)
+ */
+ private Map resolvedRevisions = Collections.EMPTY_MAP;
+ /**
+ * the new status, <code>null</code> to keep the old one
+ */
+ private String status = null;
+ /**
+ * the new revision, <code>null</code> to keep the old one
+ */
+ private String revision = null;
+ /**
+ * the new publication date, <code>null</code> to keep the old one
+ */
+ private Date pubdate = null;
+ /**
+ * Should included information be replaced
+ */
+ private boolean replaceInclude = true;
+ /**
+ * Configurations to exclude during update, or <code>null</code> to keep all confs.
+ */
+ private String[] confsToExclude = null;
+
+ public ParserSettings getSettings() {
+ return settings;
+ }
+ public UpdateOptions setSettings(ParserSettings settings) {
+ this.settings = settings;
+ return this;
+ }
+ public Namespace getNamespace() {
+ return namespace;
+ }
+ public UpdateOptions setNamespace(Namespace ns) {
+ this.namespace = ns;
+ return this;
+ }
+ public Map getResolvedRevisions() {
+ return resolvedRevisions;
+ }
+ public UpdateOptions setResolvedRevisions(Map resolvedRevisions) {
+ this.resolvedRevisions = resolvedRevisions;
+ return this;
+ }
+ public String getStatus() {
+ return status;
+ }
+ public UpdateOptions setStatus(String status) {
+ this.status = status;
+ return this;
+ }
+ public String getRevision() {
+ return revision;
+ }
+ public UpdateOptions setRevision(String revision) {
+ this.revision = revision;
+ return this;
+ }
+ public Date getPubdate() {
+ return pubdate;
+ }
+ public UpdateOptions setPubdate(Date pubdate) {
+ this.pubdate = pubdate;
+ return this;
+ }
+ public boolean isReplaceInclude() {
+ return replaceInclude;
+ }
+ public UpdateOptions setReplaceInclude(boolean replaceInclude) {
+ this.replaceInclude = replaceInclude;
+ return this;
+ }
+ public String[] getConfsToExclude() {
+ return confsToExclude;
+ }
+ public UpdateOptions setConfsToExclude(String[] confsToExclude) {
+ this.confsToExclude = confsToExclude;
+ return this;
+ }
+}
Propchange: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
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=632743&r1=632742&r2=632743&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 Mar 2 03:54:51 2008
@@ -24,7 +24,6 @@
import java.net.URL;
import java.text.ParseException;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -120,10 +119,13 @@
DefaultModuleDescriptor dmd = (DefaultModuleDescriptor) md;
ns = dmd.getNamespace();
}
- XmlModuleDescriptorUpdater.update(IvyContext.getContext().getSettings(), is, res,
- destFile, Collections.EMPTY_MAP, md.getStatus(),
- md.getResolvedModuleRevisionId().getRevision(),
- md.getResolvedPublicationDate(), ns, true, null);
+ XmlModuleDescriptorUpdater.update(is, res, destFile,
+ new UpdateOptions()
+ .setSettings(IvyContext.getContext().getSettings())
+ .setStatus(md.getStatus())
+ .setRevision(md.getResolvedModuleRevisionId().getRevision())
+ .setPubdate(md.getResolvedPublicationDate())
+ .setNamespace(ns));
} catch (SAXException e) {
ParseException ex = new ParseException("exception occured while parsing " + res, 0);
ex.initCause(e);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java?rev=632743&r1=632742&r2=632743&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java Sun Mar 2 03:54:51 2008
@@ -44,7 +44,6 @@
import org.apache.ivy.Ivy;
import org.apache.ivy.core.module.id.ModuleId;
import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.plugins.namespace.NameSpaceHelper;
import org.apache.ivy.plugins.namespace.Namespace;
import org.apache.ivy.plugins.parser.ParserSettings;
@@ -83,31 +82,15 @@
* the url of the source module descriptor file
* @param destFile
* The file to which the updated module descriptor should be output
- * @param resolvedRevisions
- * Map from ModuleId of dependencies to new revision (as String)
- * @param status
- * the new status, null to keep the old one
- * @param revision
- * the new revision, null to keep the old one
*/
- public static void update(URL srcURL, File destFile, final Map resolvedRevisions,
- final String status, final String revision, final Date pubdate, String[] confsToExclude)
+ public static void update(URL srcURL, File destFile, UpdateOptions options)
throws IOException, SAXException {
- update(null, srcURL, destFile, resolvedRevisions, status, revision, pubdate, null, false,
- confsToExclude);
- }
-
- public static void update(final ParserSettings settings, URL srcURL, File destFile,
- final Map resolvedRevisions, final String status, final String revision,
- final Date pubdate, final Namespace ns, final boolean replaceInclude,
- String[] confsToExclude) throws IOException, SAXException {
if (destFile.getParentFile() != null) {
destFile.getParentFile().mkdirs();
}
OutputStream destStream = new FileOutputStream(destFile);
try {
- update(settings, srcURL, destStream, resolvedRevisions, status, revision,
- pubdate, ns, replaceInclude, confsToExclude);
+ update(srcURL, destStream, options);
} finally {
try {
destStream.close();
@@ -117,14 +100,11 @@
}
}
- public static void update(final ParserSettings settings, URL srcURL, OutputStream destFile,
- final Map resolvedRevisions, final String status, final String revision,
- final Date pubdate, final Namespace ns, final boolean replaceInclude,
- String[] confsToExclude) throws IOException, SAXException {
+ public static void update(URL srcURL, OutputStream destFile, UpdateOptions options)
+ throws IOException, SAXException {
InputStream in = srcURL.openStream();
try {
- update(settings, srcURL, in, destFile, resolvedRevisions, status, revision,
- pubdate, ns, replaceInclude, confsToExclude);
+ update(srcURL, in, destFile, options);
} finally {
try {
in.close();
@@ -141,11 +121,8 @@
}
- public static void update(
- final IvySettings settings, InputStream in, Resource res,
- File destFile, final Map resolvedRevisions, final String status, final String revision,
- final Date pubdate, final Namespace ns, final boolean replaceInclude,
- String[] confsToExclude) throws IOException, SAXException {
+ public static void update(InputStream in, Resource res,
+ File destFile, UpdateOptions options) throws IOException, SAXException {
if (destFile.getParentFile() != null) {
destFile.getParentFile().mkdirs();
}
@@ -158,8 +135,7 @@
} else if (res instanceof FileResource) {
inputStreamContext = ((FileResource) res).getFile().toURL();
}
- update(settings, inputStreamContext, in, fos, resolvedRevisions, status, revision,
- pubdate, ns, replaceInclude, confsToExclude);
+ update(inputStreamContext, in, fos, options);
} finally {
try {
in.close();
@@ -198,21 +174,18 @@
private final URL relativePathCtx;
- public UpdaterHandler(final ParserSettings settings, final PrintWriter out,
- final Map resolvedRevisions, final String status, final String revision,
- final Date pubdate, final Namespace ns, final boolean replaceInclude,
- final String[] confs, final URL relativePathCtx) {
- this.settings = settings;
+ public UpdaterHandler(URL relativePathCtx, PrintWriter out, final UpdateOptions options) {
+ this.settings = options.getSettings();
this.out = out;
- this.resolvedRevisions = resolvedRevisions;
- this.status = status;
- this.revision = revision;
- this.pubdate = pubdate;
- this.ns = ns;
- this.replaceInclude = replaceInclude;
+ this.resolvedRevisions = options.getResolvedRevisions();
+ this.status = options.getStatus();
+ this.revision = options.getRevision();
+ this.pubdate = options.getPubdate();
+ this.ns = options.getNamespace();
+ this.replaceInclude = options.isReplaceInclude();
this.relativePathCtx = relativePathCtx;
- if (confs != null) {
- this.confs = Arrays.asList(confs);
+ if (options.getConfsToExclude() != null) {
+ this.confs = Arrays.asList(options.getConfsToExclude());
} else {
this.confs = Collections.EMPTY_LIST;
}
@@ -735,10 +708,8 @@
}
- public static void update(final ParserSettings settings, URL inStreamCtx, InputStream inStream,
- OutputStream outStream, final Map resolvedRevisions, final String status,
- final String revision, final Date pubdate, final Namespace ns,
- final boolean replaceInclude, String[] confsToExclude)
+ public static void update(URL inStreamCtx, InputStream inStream,
+ OutputStream outStream, final UpdateOptions options)
throws IOException, SAXException {
final PrintWriter out = new PrintWriter(new OutputStreamWriter(outStream, "UTF-8"));
final BufferedInputStream in = new BufferedInputStream(inStream);
@@ -748,8 +719,7 @@
in.reset(); // reposition the stream at the beginning
try {
- UpdaterHandler updaterHandler = new UpdaterHandler(settings, out, resolvedRevisions,
- status, revision, pubdate, ns, replaceInclude, confsToExclude, inStreamCtx);
+ UpdaterHandler updaterHandler = new UpdaterHandler(inStreamCtx, out, options);
InputSource inSrc = new InputSource(in);
if (inStreamCtx != null) {
inSrc.setSystemId(inStreamCtx.toExternalForm());
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java?rev=632743&r1=632742&r2=632743&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java Sun Mar 2 03:54:51 2008
@@ -44,6 +44,8 @@
import org.apache.ivy.util.FileUtil;
import org.xml.sax.SAXParseException;
+import sun.reflect.ReflectionFactory.GetReflectionFactoryAction;
+
public class XmlModuleUpdaterTest extends TestCase {
public void testUpdate() throws Exception {
@@ -65,9 +67,10 @@
Ivy ivy = Ivy.newInstance();
ivy.setVariable("myvar", "myconf1");
- XmlModuleDescriptorUpdater.update(ivy.getSettings(), XmlModuleUpdaterTest.class
- .getResource("test-update.xml"), dest, resolvedRevisions, "release", "mynewrev",
- cal.getTime(), null, true, null);
+ XmlModuleDescriptorUpdater.update(
+ XmlModuleUpdaterTest.class.getResource("test-update.xml"), dest,
+ getUpdateOptions(ivy.getSettings(), resolvedRevisions,
+ "release", "mynewrev", cal.getTime()));
assertTrue(dest.exists());
String expected = FileUtil.readEntirely(new BufferedReader(new InputStreamReader(
@@ -136,9 +139,10 @@
ivy.setVariable("regexp", "regexp");
ivy.setVariable("theirrev", "1.0, 1.1");
- XmlModuleDescriptorUpdater.update(ivy.getSettings(), XmlModuleUpdaterTest.class
- .getResource("test-update-withvar.xml"), dest, resolvedRevisions, "release", "mynewrev",
- cal.getTime(), null, true, null);
+ XmlModuleDescriptorUpdater.update(
+ XmlModuleUpdaterTest.class.getResource("test-update-withvar.xml"), dest,
+ getUpdateOptions(ivy.getSettings(), resolvedRevisions,
+ "release", "mynewrev", cal.getTime()));
assertTrue(dest.exists());
String expected = FileUtil.readEntirely(new BufferedReader(new InputStreamReader(
@@ -151,9 +155,8 @@
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
URL settingsUrl = new File("test/java/org/apache/ivy/plugins/parser/xml/"
+ "test-configurations-import4.xml").toURL();
- XmlModuleDescriptorUpdater.update(new IvySettings(), settingsUrl, buffer, new HashMap(),
- "release", "mynewrev", new Date(), null,
- true, null);
+ XmlModuleDescriptorUpdater.update(settingsUrl, buffer,
+ getUpdateOptions("release", "mynewrev"));
String updatedXml = buffer.toString();
@@ -166,9 +169,8 @@
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
URL settingsUrl = new File("test/java/org/apache/ivy/plugins/parser/xml/"
+ "test-update-excludedconfs1.xml").toURL();
- XmlModuleDescriptorUpdater.update(new IvySettings(), settingsUrl,
- buffer, new HashMap(), "release", "mynewrev", new Date(), null, true,
- new String[] {"myconf2"});
+ XmlModuleDescriptorUpdater.update(settingsUrl, buffer,
+ getUpdateOptions("release", "mynewrev").setConfsToExclude(new String[] {"myconf2"}));
XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
@@ -194,9 +196,9 @@
URL settingFile = new File("test/java/org/apache/ivy/plugins/parser/xml/"
+ "test-update-excludedconfs2.xml").toURL();
try {
- XmlModuleDescriptorUpdater.update(new IvySettings(), settingFile, buffer,
- new HashMap(), "release", "mynewrev", new Date(), null, true,
- new String[] {"myconf2"});
+ XmlModuleDescriptorUpdater.update(settingFile, buffer,
+ getUpdateOptions("release", "mynewrev")
+ .setConfsToExclude(new String[] {"myconf2"}));
fail("IllegalArgumentException hasn't been thrown");
} catch (IllegalArgumentException e) {
// this is ok
@@ -210,8 +212,9 @@
URL settingsUrl = new File("test/java/org/apache/ivy/plugins/parser/xml/"
+ "test-update-excludedconfs3.xml").toURL();
- XmlModuleDescriptorUpdater.update(new IvySettings(), settingsUrl, buffer, new HashMap(),
- "release", "mynewrev", new Date(), null, true, new String[] {"myconf2", "conf2"});
+ XmlModuleDescriptorUpdater.update(settingsUrl, buffer,
+ getUpdateOptions("release", "mynewrev")
+ .setConfsToExclude(new String[] {"myconf2", "conf2"}));
XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
@@ -238,8 +241,8 @@
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
URL settingsUrl = new File("test/java/org/apache/ivy/plugins/parser/xml/"
+ "test-update-excludedconfs4.xml").toURL();
- XmlModuleDescriptorUpdater.update(new IvySettings(), settingsUrl, buffer, new HashMap(),
- "release", "mynewrev", new Date(), null, true, new String[] {"myconf2"});
+ XmlModuleDescriptorUpdater.update(settingsUrl, buffer,
+ getUpdateOptions("release", "mynewrev").setConfsToExclude(new String[] {"myconf2"}));
XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
@@ -264,8 +267,9 @@
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
URL settingsUrl = new File("test/java/org/apache/ivy/plugins/parser/xml/"
+ "test-update-excludedconfs5.xml").toURL();
- XmlModuleDescriptorUpdater.update(new IvySettings(), settingsUrl, buffer, new HashMap(),
- "release", "mynewrev", new Date(), null, true, new String[] {"myconf2"});
+ XmlModuleDescriptorUpdater.update(settingsUrl, buffer,
+ getUpdateOptions("release", "mynewrev")
+ .setConfsToExclude(new String[] {"myconf2"}));
XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
@@ -285,5 +289,19 @@
+ " shouldn't have a dependency artifact for configuration myconf2", 0, deps[i]
.getDependencyArtifacts("myconf2").length);
}
+ }
+
+ private UpdateOptions getUpdateOptions(String status, String revision) {
+ return getUpdateOptions(new IvySettings(), new HashMap(), status, revision, new Date());
+ }
+
+ private UpdateOptions getUpdateOptions(IvySettings settings, Map resolvedRevisions,
+ String status, String revision, Date pubdate) {
+ return new UpdateOptions()
+ .setSettings(settings)
+ .setResolvedRevisions(resolvedRevisions)
+ .setStatus(status)
+ .setRevision(revision)
+ .setPubdate(pubdate);
}
}