commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian A. Egge" <>
Subject Re: [CLI2] Writing source code unit tests (CvsTest)
Date Wed, 01 Aug 2007 00:25:14 GMT
Hi Karl,

I think you need to add the update options to the update command as children.  I.e.,

optionBuildDirectories = obuilder.withShortName("d")
                .withDescription("Build directories, like checkout does.")
        final Command updateCommand = cbuilder
                .withDescription("Bring work tree in sync with repository")
                .withChildren(new GroupBuilder().withOption(


    public void testChildCommandOptions() throws OptionException {
        Parser parser = new Parser();
        CommandLine commandLine = parser.parse(new String[]{
                "-d", "\"Parameter\"", "-nq", "update", "-d"

        List list = commandLine.getValues(optionCvsRoot);
        assertEquals(1, list.size());
        assertEquals("Parameter", list.get(0));

The only way I could figure out how to get the correct options out of the command line object
was be explicitly specifying the option objects, and not using a string lookup.

I think there should be a get by id lookup, as you can assign numeric ids to options.

Attached is a patch to CvsTest which includes above test.


Karl Heinz Marbaise <> wrote: Hi there,

i have begun to write some Unit Tests (CvsTest in the Source-Code) to
understand the CLI2 correctly but now i have reached a point where i
can't get out....

May be someone can give me hint:


I would like to simulate the following command line of CVS:

cvs -d "Parameter" -nq update -d

The "-nq" global options are working, but the second "-d" seemed not to be.
Here extracted some parts of the Code to create the command and it's

//Global option
optiond = new DefaultOptionBuilder()
    .withArgument(new ArgumentBuilder()

updateCommand = new CommandBuilder().withName("update").create();
//update Command - Options
updateOptiond = new DefaultOptionBuilder().withName("d").create();

Group updateCommandOptions = GroupBuilder()

I'm not sure if i'm doing this correct...

Kind regards
Karl Heinz Marbaise
SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl Heinz Marbaise        ICQ#: 135949029
Hauptstrasse 177                         USt.IdNr: DE191347579
52146 W├╝rselen                 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message