commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jke...@apache.org
Subject cvs commit: jakarta-commons/cli/src/test/org/apache/commons/cli ChildOptionTest.java AnonymousArgumentTest.java BugzillaTest.java
Date Sun, 08 Jun 2003 18:16:02 GMT
jkeyes      2003/06/08 11:16:02

  Modified:    cli/src/java/org/apache/commons/cli Tag: cli_1_x
                        CommandLineParser.java ArgumentBuilder.java
                        Option.java ArgumentImpl.java
                        AnonymousArgumentImpl.java OptionBuilder.java
                        OptionImpl.java
               cli/src/test/org/apache/commons/cli Tag: cli_1_x
                        ChildOptionTest.java AnonymousArgumentTest.java
                        BugzillaTest.java
  Log:
  
o  modified child Option support, to support Options, 
   not just Option
o  made some
changes to method parameters making 
   them final definitions
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.8   +40 -42    jakarta-commons/cli/src/java/org/apache/commons/cli/CommandLineParser.java
  
  Index: CommandLineParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/CommandLineParser.java,v
  retrieving revision 1.6.2.7
  retrieving revision 1.6.2.8
  diff -u -r1.6.2.7 -r1.6.2.8
  --- CommandLineParser.java	6 Jun 2003 22:25:34 -0000	1.6.2.7
  +++ CommandLineParser.java	8 Jun 2003 18:16:01 -0000	1.6.2.8
  @@ -81,11 +81,11 @@
       private int style = POSIX;
       private Properties props = new Properties();
           
  -    public void setStyle(int style) {
  +    public void setStyle(final int style) {
           this.style = style;    
       }
       
  -    public CommandLine parse(Options options, String[] args) 
  +    public CommandLine parse(final Options options, final String[] args) 
       throws UnknownOptionException, MissingValueException, AlreadySelectedException, ParseException
{
           CommandLineCreator creator = new CommandLineImpl();
           final List tokens = Arrays.asList(args);
  @@ -96,7 +96,7 @@
           return line;
       }
       
  -    private CommandLine parse(Options options, ListIterator iter, CommandLineCreator creator)

  +    private CommandLine parse(final Options options, final ListIterator iter, final CommandLineCreator
creator) 
       throws UnknownOptionException, MissingValueException {
           while (iter.hasNext()) {
               String arg = iter.next().toString();
  @@ -171,7 +171,7 @@
           return (CommandLine)creator;
       }
   
  -    private void processJavaProperty(String token) {
  +    private void processJavaProperty(final String token) {
           int sep = token.indexOf('=');
   
           String key = null;
  @@ -188,11 +188,11 @@
       }
   
       private void processOptionGroup(
  -        Options options,
  -        ListIterator iter,
  -        CommandLineCreator creator,
  -        String arg)
  -        throws MissingValueException, UnknownOptionException {
  +        final Options options,
  +        final ListIterator iter,
  +        final CommandLineCreator creator,
  +        final String arg)
  +    throws MissingValueException, UnknownOptionException {
               
           OptionGroup group = options.getOptionGroup(arg);
           Option option = group.getOption(arg);
  @@ -207,10 +207,10 @@
       }
   
       private void processOption(
  -        Options options,
  -        ListIterator iter,
  -        CommandLineCreator creator,
  -        String arg)
  +        final Options options,
  +        final ListIterator iter,
  +        final CommandLineCreator creator,
  +        final String arg)
       throws UnknownOptionException, MissingValueException {
   
           Option option = options.getOption(arg);
  @@ -219,11 +219,11 @@
       }
   
       private void processArgument(
  -        Options options,
  -        ListIterator iter,
  -        CommandLineCreator creator,
  -        String arg,
  -        String value)
  +        final Options options,
  +        final ListIterator iter,
  +        final CommandLineCreator creator,
  +        final String arg,
  +        final String value)
       throws MissingValueException, UnknownOptionException {
   
           Argument argument = options.getArgument(arg);
  @@ -243,10 +243,10 @@
       //
       //
       private void burst(
  -        Options options,
  -        String token,
  -        CommandLineCreator creator,
  -        ListIterator iter)
  +        final Options options,
  +        final String token,
  +        final CommandLineCreator creator,
  +        final ListIterator iter)
       throws UnknownOptionException, MissingValueException {
                  
           int tokenLength = token.length();
  @@ -271,24 +271,22 @@
       }
       
       private void processChildOptions(
  -        Option option,
  -        ListIterator iter,
  -        CommandLineCreator cmdline) 
  +        final Option option,
  +        final ListIterator iter,
  +        final CommandLineCreator cmdline) 
       throws UnknownOptionException, MissingValueException {
   
  -        if (option.getChildren().size() > 0) {
  -            Options opts = new Options();
  -            opts.add(option.getChildren());
  -
  +        Options opts = option.getOptions();
  +        if (opts != null) {
               parse(opts, iter, cmdline);
           }
   
       }
   
       private List processArgument(
  -        Argument argument,
  -        ListIterator iter,
  -        String arg)
  +        final Argument argument,
  +        final ListIterator iter,
  +        final String arg)
       throws MissingValueException {
           
           if (arg == null || arg.startsWith("-")) {
  @@ -325,7 +323,7 @@
        * 
        * @return the collection of values
        */
  -    private Collection getValues(String value, char separator) {
  +    private Collection getValues(final String value, final char separator) {
           List values = new ArrayList();
           StringTokenizer tokenizer =
               new StringTokenizer(value, String.valueOf(separator));
  @@ -349,7 +347,7 @@
        *     if an Argument that requires a value does not have one
        *     specified on the command line
        */
  -    private List processArgument(Argument argument, ListIterator iter)
  +    private List processArgument(final Argument argument, final ListIterator iter)
           throws MissingValueException {
           return processArgument(argument, iter, new ArrayList());
       }
  @@ -378,9 +376,9 @@
        *     specified on the command line
        */
       private List processArgument(
  -        Argument argument,
  -        ListIterator iter,
  -        List argList)
  +        final Argument argument,
  +        final ListIterator iter,
  +        final List argList)
       throws MissingValueException {
           
           int size = argument.getSize();
  @@ -419,7 +417,7 @@
        * 
        * @return the List of the command line arguments that remain
        */
  -    private List processAnonymousValues(Iterator iter) {
  +    private List processAnonymousValues(final Iterator iter) {
           List args = new ArrayList();
   
           while (iter.hasNext()) {
  @@ -451,7 +449,7 @@
           return str;
       }
   
  -    private List processTrailingValues(Iterator iter) {
  +    private List processTrailingValues(final Iterator iter) {
           List args = new ArrayList();
   
           while (iter.hasNext()) {
  
  
  
  1.1.2.5   +13 -35    jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/ArgumentBuilder.java
  
  Index: ArgumentBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/ArgumentBuilder.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- ArgumentBuilder.java	24 May 2003 14:44:43 -0000	1.1.2.4
  +++ ArgumentBuilder.java	8 Jun 2003 18:16:01 -0000	1.1.2.5
  @@ -60,8 +60,6 @@
    */
   package org.apache.commons.cli;
   
  -import java.util.HashSet;
  -import java.util.Set;
   
   /**
    * ArgumentBuilder creates Argument instances based on the
  @@ -86,8 +84,8 @@
       /** specifies whether the argument is required, by default false */
       private boolean required;
   
  -    /** the set of children this argument has */
  -    private Set children;
  +    /** the child Options */
  +    private Options options;
   
       /**
        * the value separator e.g. if this is ',' and the value is
  @@ -133,7 +131,7 @@
                   this.valueSeparator,
                   this.valueName,
                   this.hasOptionalValues,
  -                this.children);
  +                this.options);
           } finally {
               // reset the state of the builder
               reset();
  @@ -189,7 +187,7 @@
        * 
        * @return the ArgumentBuilder
        */
  -    public ArgumentBuilder withDescription(String description) {
  +    public ArgumentBuilder withDescription(final String description) {
           this.description = description;
           return this;
       }
  @@ -209,36 +207,16 @@
       }
   
       /**
  -     * Adds the specified child to the next Argument instance that will
  -     * be created.
  -     * 
  -     * @param child
  -     *     the child Option of the next Argument
  -     * 
  -     * @return the ArgumentBuilder
  -     */
  -    public ArgumentBuilder withChild(final Option child) {
  -        if (this.children == null) {
  -            this.children = new HashSet();
  -        }
  -        this.children.add(child);
  -        return this;
  -    }
  -
  -    /**
  -     * Adds the set of children to the next Argument instance that will
  -     * be created.
  +     * Adds the specified Options to the next Argument instance that 
  +     * will be created.
        * 
  -     * @param children
  +     * @param options
        *     the set of child Options of the next Argument
        * 
        * @return the ArgumentBuilder
        */
  -    public ArgumentBuilder withChildren(final Set children) {
  -        if (this.children == null) {
  -            this.children = new HashSet();
  -        }
  -        this.children.addAll(children);
  +    public ArgumentBuilder withOptions(final Options options) {
  +        this.options = options;
           return this;
       }
   
  @@ -318,7 +296,7 @@
           this.name = null;
           this.longName = null;
           this.required = false;
  -        this.children = null;
  +        this.options = null;
           this.valueSeparator = (char) 0;
           this.valueName = null;
           this.size = 1;
  
  
  
  1.20.2.5  +5 -22     jakarta-commons/cli/src/java/org/apache/commons/cli/Option.java
  
  Index: Option.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Option.java,v
  retrieving revision 1.20.2.4
  retrieving revision 1.20.2.5
  diff -u -r1.20.2.4 -r1.20.2.5
  --- Option.java	6 Jun 2003 22:17:08 -0000	1.20.2.4
  +++ Option.java	8 Jun 2003 18:16:01 -0000	1.20.2.5
  @@ -60,8 +60,6 @@
    */
   package org.apache.commons.cli;
   
  -import java.util.Collection;
  -
   /**
    * An Option is a command line flag.  It specifies some type of
    * configuration to an application by it presence or lack of it.
  @@ -93,20 +91,6 @@
       String getDescription();
   
       /**
  -     * Adds the specified Option as a child.  For example,
  -     * if there is an Option '-time' and it has three
  -     * children, one for each time period, '-hours', '-mins'
  -     * and '-secs'.  One way of constructing such a definition
  -     * for this would be to create an Option for each time
  -     * period and add each of these Options as a child of
  -     * '-time'.
  -     * 
  -     * @param childOption
  -     *     a child Option
  -     */
  -    void addChild(Option childOption);
  -
  -    /**
        * Adds the specified Set of Options as children.
        * 
        * @param children
  @@ -114,14 +98,14 @@
        * 
        * @see Option.addChild(cli.Option)
        */
  -    void addChildren(Collection children);
  +    void setOptions(Options options);
   
       /**
        * Returns whether this Option has any child Options
        * 
        * @return true if this Option has children, otherwise false
        */
  -    boolean hasChildren();
  +    boolean hasOptions();
   
       /**
        * Returns whether this Option must be present in the command
  @@ -133,10 +117,9 @@
       boolean isRequired();
   
       /**
  -     * Returns the children of the Option
  +     * Returns the child Options of the Option
        * 
  -     * @return the Set of children, if there are no children 
  -     *     return null
  +     * @return the child Options, otherwise return null
        */
  -    Collection getChildren();
  +    Options getOptions();
   }
  
  
  
  1.1.2.4   +15 -17    jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/ArgumentImpl.java
  
  Index: ArgumentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/ArgumentImpl.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- ArgumentImpl.java	24 May 2003 22:20:53 -0000	1.1.2.3
  +++ ArgumentImpl.java	8 Jun 2003 18:16:01 -0000	1.1.2.4
  @@ -60,8 +60,6 @@
    */
   package org.apache.commons.cli;
   
  -import java.util.Set;
  -
   /**
    * Implementation of the Argument interface.
    * 
  @@ -115,22 +113,22 @@
        * @param hasOptionalValues
        *     whether this Argument has optional values
        * 
  -     * @param children
  +     * @param options
        *     the child Options of this Argument
        */
       public ArgumentImpl(
  -        String name,
  -        String longName,
  -        String description,
  -        boolean required,
  -        int size,
  -        Class type,
  -        char valueSeparator,
  -        String valueName,
  -        boolean hasOptionalValues,
  -        Set children) {
  +        final String name,
  +        final String longName,
  +        final String description,
  +        final boolean required,
  +        final int size,
  +        final Class type,
  +        final char valueSeparator,
  +        final String valueName,
  +        final boolean hasOptionalValues,
  +        final Options options) {
   
  -        super(name, longName, description, required, children);
  +        super(name, longName, description, required, options);
   
           this.size = size;
           this.type = type;
  
  
  
  1.1.2.6   +19 -27    jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/AnonymousArgumentImpl.java
  
  Index: AnonymousArgumentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/AnonymousArgumentImpl.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- AnonymousArgumentImpl.java	7 Jun 2003 01:31:50 -0000	1.1.2.5
  +++ AnonymousArgumentImpl.java	8 Jun 2003 18:16:01 -0000	1.1.2.6
  @@ -60,11 +60,10 @@
    */
   package org.apache.commons.cli;
   
  -import java.util.Collection;
   
   /**
    * AnonyousArgumentImpl is a special Argument that consumes trailing
  - * argument values.  This Argument can also have children, this is to
  + * argument values.  This Argument can also have child Options, this is to
    * support <i>CVS like</i> command lines.
    * 
    * @author John Keyes
  @@ -79,8 +78,8 @@
       /** the name of the value for help text */
       private String valueName;
   
  -    /** the arguments children */
  -    private Collection children;
  +    /** the child options */
  +    private Options options;
   
       /**
        * Creates an anonymous Argument with the specified name.
  @@ -94,17 +93,17 @@
   
       /**
        * Creates an anonymous Argument with the specified name and
  -     * children.
  +     * child Options.
        * 
        * @param name
        *     the textual description of the anonymous argument
        * 
  -     * @param children
  +     * @param Options
        *     the child Options
        */
  -    AnonymousArgumentImpl(final String name, final Collection children) {
  +    AnonymousArgumentImpl(final String name, final Options options) {
           this.valueName = name;
  -        this.children = children;
  +        this.options = options;
       }
   
       /**
  @@ -154,31 +153,24 @@
       }
   
       /**
  -     * @see Option.addChild()
  +     * @see Option#addChildren(Options)
        */
  -    public void addChild(Option child) {
  -        throw new UnsupportedOperationException("cannot add a child to anonymous option");
  +    public void setOptions(final Options options) {
  +        this.options = options;
       }
   
       /**
  -     * @see Option#addChildren(java.util.Collection)
  +     * @see Option#getOptions()
        */
  -    public void addChildren(Collection children) {
  -        this.children = children;
  +    public Options getOptions() {
  +        return this.options;
       }
   
       /**
  -     * @see Option#getChildren()
  +     * @see Option#hasOptions()
        */
  -    public Collection getChildren() {
  -        return this.children;
  -    }
  -
  -    /**
  -     * @see Option#hasChildren()
  -     */
  -    public boolean hasChildren() {
  -        return (children != null && this.children.size() > 0);
  +    public boolean hasOptions() {
  +        return (options != null);
       }
   
       /**
  
  
  
  1.15.2.5  +15 -38    jakarta-commons/cli/src/java/org/apache/commons/cli/OptionBuilder.java
  
  Index: OptionBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/OptionBuilder.java,v
  retrieving revision 1.15.2.4
  retrieving revision 1.15.2.5
  diff -u -r1.15.2.4 -r1.15.2.5
  --- OptionBuilder.java	24 May 2003 14:44:43 -0000	1.15.2.4
  +++ OptionBuilder.java	8 Jun 2003 18:16:01 -0000	1.15.2.5
  @@ -60,9 +60,6 @@
    */
   package org.apache.commons.cli;
   
  -import java.util.Set;
  -import java.util.HashSet;
  -
   /**
    * OptionBuilder creates Option instances based on the
    * methods called by the client.  After each create is called
  @@ -87,8 +84,8 @@
       /** specifies whether the option is required, default false */
       private boolean required;
   
  -    /** the set of children this option has */
  -    private Set children;
  +    /** the child Options this option has */
  +    private Options options;
   
       /**
        * Creates OptionBuilder instances
  @@ -111,7 +108,7 @@
                   this.longName,
                   this.description,
                   this.required,
  -                this.children);
  +                this.options);
           } finally {
               // reset the state of the builder
               reset();
  @@ -126,7 +123,7 @@
        * 
        * @return the OptionBuilder
        */
  -    public OptionBuilder withName(String name) {
  +    public OptionBuilder withName(final String name) {
           this.name = name;
           return this;
       }
  @@ -139,7 +136,7 @@
        * 
        * @return the OptionBuilder
        */
  -    public OptionBuilder withLongName(String longName) {
  +    public OptionBuilder withLongName(final String longName) {
           this.longName = longName;
           return this;
       }
  @@ -152,7 +149,7 @@
        * 
        * @return the OptionBuilder
        */
  -    public OptionBuilder withDescription(String description) {
  +    public OptionBuilder withDescription(final String description) {
           this.description = description;
           return this;
       }
  @@ -166,42 +163,22 @@
        * 
        * @return the OptionBuilder
        */
  -    public OptionBuilder withRequired(boolean required) {
  +    public OptionBuilder withRequired(final boolean required) {
           this.required = required;
           return this;
       }
   
       /**
  -     * Adds the specified child to the next Option instance that will
  -     * be created.
  -     * 
  -     * @param child
  -     *     the child Option of the next Option
  -     * 
  -     * @return the OptionBuilder
  -     */
  -    public OptionBuilder withChild(final Option child) {
  -        if (this.children == null) {
  -            this.children = new HashSet();
  -        }
  -        this.children.add(child);
  -        return this;
  -    }
  -
  -    /**
        * Adds the set of children to the next Option instance that will
        * be created.
        * 
  -     * @param children
  -     *     the set of child Options of the next Option
  +     * @param options
  +     *     the child Options of the next Option
        * 
        * @return the OptionBuilder
        */
  -    public OptionBuilder withChildren(final Set children) {
  -        if (this.children == null) {
  -            this.children = new HashSet();
  -        }
  -        this.children.addAll(children);
  +    public OptionBuilder withOptions(final Options options) {
  +        this.options = options;
           return this;
       }
   
  @@ -213,7 +190,7 @@
           this.longName = null;
           this.description = null;
           this.required = false;
  -        this.children = null;
  +        this.options = null;
       }
   
   }
  
  
  
  1.1.2.6   +25 -36    jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/OptionImpl.java
  
  Index: OptionImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/OptionImpl.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- OptionImpl.java	7 Jun 2003 01:29:49 -0000	1.1.2.5
  +++ OptionImpl.java	8 Jun 2003 18:16:01 -0000	1.1.2.6
  @@ -60,10 +60,6 @@
    */
   package org.apache.commons.cli;
   
  -import java.util.Collection;
  -import java.util.Collections;
  -import java.util.HashSet;
  -
   /**
    * An implementation of the Option interface.
    * 
  @@ -84,7 +80,7 @@
       private boolean required;
   
       /** the child Options */
  -    private Collection children;
  +    private Options options;
   
       /**
        * Creates an Option
  @@ -101,7 +97,7 @@
        * @param required
        *     whether this Option is required
        * 
  -     * @param children
  +     * @param options
        *     the child Options
        */
       OptionImpl(
  @@ -109,7 +105,7 @@
           final String longName,
           final String description,
           final boolean required,
  -        final Collection children) {
  +        final Options options) {
               
           // if the name and longName are null throw an exception
           if (name == null && longName == null) {
  @@ -130,7 +126,7 @@
           
           this.description = description;
           this.required = required;
  -        this.children = (children != null) ? children : new HashSet(0);
  +        this.options = (options != null) ? options : null;
       }
   
       /**
  @@ -155,17 +151,10 @@
       }
   
       /**
  -     * @see Option#addChild(Option)
  -     */
  -    public void addChild(Option option) {
  -        this.children.add(option);
  -    }
  -
  -    /**
  -     * @see Option#addChildren(java.util.Set)
  +     * @see Option#addChildren(Options)
        */
  -    public void addChildren(Collection children) {
  -        this.children.addAll(children);
  +    public void setOptions(final Options options) {
  +        this.options = options;
       }
   
       /**
  @@ -176,17 +165,17 @@
       }
   
       /**
  -     * @see Option#getChildren()
  +     * @see Option#getOptions()
        */
  -    public Collection getChildren() {
  -        return this.children;
  +    public Options getOptions() {
  +        return this.options;
       }
   
       /**
  -     * @see Option#hasChildren()
  +     * @see Option#hasOptions()
        */
  -    public boolean hasChildren() {
  -        return (children != null && this.children.size() > 0);
  +    public boolean hasOptions() {
  +        return this.options != null;
       }
   
       /**
  @@ -201,13 +190,13 @@
               return false;
           }
           
  -        OptionImpl option = (OptionImpl)obj;
  +        final OptionImpl option = (OptionImpl)obj;
           
  -        String name = option.getName();
  -        String longName = option.getLongName();
  -        String description = option.getDescription();
  -        boolean required = option.isRequired();
  -        Collection children = option.getChildren();
  +        final String name = option.getName();
  +        final String longName = option.getLongName();
  +        final String description = option.getDescription();
  +        final boolean required = option.isRequired();
  +        final Options options = option.getOptions();
           
           return (
               this.name == name || (this.name != null && this.name.equals(name)))
  @@ -217,8 +206,8 @@
                   || (this.description != null
                       && this.description.equals(description)))
               && this.required == required
  -            && (this.children == children
  -                || (this.children != null && this.children.equals(children)));
  +            && (this.options == options
  +                || (this.options != null && this.options.equals(options)));
       }
       
       /**
  @@ -230,7 +219,7 @@
               (this.longName == null ? 0 : this.longName.hashCode()) ^
               (this.description == null ? 0 : this.description.hashCode()) ^
               (this.required ? 0 : 1) ^
  -            (this.children == null ? 0 : this.children.hashCode());
  +            (this.options == null ? 0 : this.options.hashCode());
       }
       
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +9 -5      jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/ChildOptionTest.java
  
  Index: ChildOptionTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/ChildOptionTest.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- ChildOptionTest.java	4 Jun 2003 01:21:54 -0000	1.1.2.3
  +++ ChildOptionTest.java	8 Jun 2003 18:16:01 -0000	1.1.2.4
  @@ -88,8 +88,10 @@
   
           Option child = builder.withName("c").create();
   
  -        parent.addChild(child);
  -
  +        Options childOptions = new Options();
  +        childOptions.add(child);
  +        parent.setOptions(childOptions);
  +        
           Options opts = new Options();
           opts.add(parent);
   
  @@ -118,7 +120,9 @@
   
           Argument child = abuilder.withName("c").create();
   
  -        parent.addChild(child);
  +        Options childOptions = new Options();
  +        childOptions.add(child);
  +        parent.setOptions(childOptions);
   
           Options opts = new Options();
           opts.add(parent);
  
  
  
  1.1.2.4   +7 -12     jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/AnonymousArgumentTest.java
  
  Index: AnonymousArgumentTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/AnonymousArgumentTest.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- AnonymousArgumentTest.java	4 Jun 2003 01:21:54 -0000	1.1.2.3
  +++ AnonymousArgumentTest.java	8 Jun 2003 18:16:01 -0000	1.1.2.4
  @@ -60,7 +60,6 @@
    */
   package org.apache.commons.cli;
   
  -import java.util.HashSet;
   import java.util.List;
   
   import junit.framework.TestCase;
  @@ -192,15 +191,11 @@
   
           try {
               anon.getName();
  -            /*
  -             * TODO: tie down the anonymous argument name support
  -             *
               fail("cannot get name of anonymous argument");
  -             */
           } catch (UnsupportedOperationException exp) {
           }
   
  -        assertNull(anon.getChildren());
  +        assertNull(anon.getOptions());
   
           try {
               anon.getValueSeparator();
  @@ -210,14 +205,14 @@
   
           OptionBuilder obuilder = new OptionBuilder();
           Option f = obuilder.withName("f").create();
  +        Options opts = new Options();
  +        opts.add(f);
           try {
  -            anon.addChild(f);
  -            fail("expected exception not caught");
  +            // TODO: test the parse
  +            anon.setOptions(opts);
           } catch (UnsupportedOperationException exp) {
   
           }
  -
  -        anon.addChildren(new HashSet());
       }
   
   }
  
  
  
  1.1.2.5   +7 -10     jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/BugzillaTest.java
  
  Index: BugzillaTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/BugzillaTest.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- BugzillaTest.java	4 Jun 2003 01:21:54 -0000	1.1.2.4
  +++ BugzillaTest.java	8 Jun 2003 18:16:01 -0000	1.1.2.5
  @@ -60,9 +60,6 @@
    */
   package org.apache.commons.cli;
   
  -import java.util.HashSet;
  -import java.util.Set;
  -
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
  @@ -230,7 +227,7 @@
           OptionBuilder builder = new OptionBuilder();
   
           // for the exec option, there are 2 options...
  -        Set execOptions = new HashSet();
  +        Options execOptions = new Options();
   
           execOptions.add(
               builder.withDescription("desc").withName("exec_opt1").create());
  @@ -238,7 +235,7 @@
               builder.withDescription("desc").withName("exec_opt2").create());
   
           // similarly, for rep there are 2 options...
  -        Set repOptions = new HashSet();
  +        Options repOptions = new Options();
           repOptions.add(
               builder.withDescription("desc").withName("repopto").create());
           repOptions.add(
  @@ -248,14 +245,14 @@
           grp.add(
               builder
                   .withDescription("description for this option")
  -                .withChildren(execOptions)
  +                .withOptions(execOptions)
                   .withName("exec")
                   .create());
   
           grp.add(
               builder
                   .withDescription("description for this option")
  -                .withChildren(repOptions)
  +                .withOptions(repOptions)
                   .withName("rep")
                   .create());
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message