Repository: ant-ivy Updated Branches: refs/heads/master 41fefde64 -> 497147e3e
IVY-1355 Update the help text of Ivy command line for the "types" argument Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/497147e3 Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/497147e3 Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/497147e3 Branch: refs/heads/master Commit: 497147e3e6ba0a50c32817e14985ca5bf1041f9d Parents: 41fefde Author: Jaikiran Pai <jaiki...@apache.org> Authored: Tue Jul 25 12:18:15 2017 +0530 Committer: Jaikiran Pai <jaiki...@apache.org> Committed: Tue Jul 25 12:18:15 2017 +0530 ---------------------------------------------------------------------- asciidoc/release-notes.adoc | 1 + src/java/org/apache/ivy/Main.java | 2 +- test/java/org/apache/ivy/MainTest.java | 34 +++++++++++++++++++++++++---- 3 files changed, 32 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/497147e3/asciidoc/release-notes.adoc ---------------------------------------------------------------------- diff --git a/asciidoc/release-notes.adoc b/asciidoc/release-notes.adoc index 9b8448d..28885df 100644 --- a/asciidoc/release-notes.adoc +++ b/asciidoc/release-notes.adoc @@ -67,6 +67,7 @@ For details about the following changes, check our JIRA install at link:https:// - FIX: Makepom ignores dependency classifiers (jira:IVY-1528[]) (Thanks to Jaikiran Pai) - FIX: Infinite loop in dependencytree (jira:IVY-1540[]) (Thanks to Jaikiran Pai) - FIX: HTTP issue: Basic authentication is stuck in 401 loop (jira:IVY-1336[]) +- FIX: command line: -types seems to not accept comma [jira:IVY-1355[]] - IMPROVEMENT: Throw an IllegalStateException when retrieving the resolutionCacheRoot on the DefaultResolutionCacheManager if the basedir (or IvySettings) is not set (jira:IVY-1482[]) - IMPROVEMENT: Optimization: limit the revision numbers scanned if revision prefix is specified (Thanks to Ernestas Vaiciukevičius) http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/497147e3/src/java/org/apache/ivy/Main.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/ivy/Main.java b/src/java/org/apache/ivy/Main.java index 99690c1..4e93a0e 100644 --- a/src/java/org/apache/ivy/Main.java +++ b/src/java/org/apache/ivy/Main.java @@ -114,7 +114,7 @@ public final class Main { .description("resolve given configurations").create()) .addOption( new OptionBuilder("types").arg("types").countArgs(false) - .description("comma separated list of accepted artifact types") + .description("accepted artifact types") .create()) .addOption( new OptionBuilder("mode").arg("resolvemode") http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/497147e3/test/java/org/apache/ivy/MainTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/MainTest.java b/test/java/org/apache/ivy/MainTest.java index c90a060..0219f7f 100644 --- a/test/java/org/apache/ivy/MainTest.java +++ b/test/java/org/apache/ivy/MainTest.java @@ -17,19 +17,23 @@ */ package org.apache.ivy; -import java.io.File; - import org.apache.ivy.util.CacheCleaner; import org.apache.ivy.util.cli.CommandLine; import org.apache.ivy.util.cli.ParseException; - import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import static org.junit.Assert.*; +import java.io.File; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; public class MainTest { @@ -127,6 +131,28 @@ public class MainTest { assertEquals(0, leftOver.length); } + /** + * Tests that the {@code types} argument to the command line is parsed correctly when it's passed + * more than one value for the argument + * + * @throws Exception + * @see <a href="https://issues.apache.org/jira/browse/IVY-1355">IVY-1355</a> + */ + @Test + public void testTypes() throws Exception { + final String[] params = new String[]{"-settings", "test/repositories/ivysettings.xml", "-retrieve", + "build/test/main/retrieve/[module]/[conf]/[artifact]-[revision].[ext]", + "-types", "jar", "source"}; + final CommandLine parsedCommand = Main.getParser().parse(params); + final String[] parsedTypes = parsedCommand.getOptionValues("types"); + assertNotNull("Values for types argument is missing", parsedTypes); + assertEquals("Unexpected number of values parsed for types argument", 2, parsedTypes.length); + final Set<String> uniqueParsedTypes = new HashSet<>(); + uniqueParsedTypes.addAll(Arrays.asList(parsedTypes)); + assertTrue("jar type is missing from the parsed types argument", uniqueParsedTypes.contains("jar")); + assertTrue("jar type is missing from the parsed types argument", uniqueParsedTypes.contains("source")); + } + private void run(String[] args) throws Exception { Main.run(Main.getParser(), args); }