Skip to Content.
Sympa Menu

notify-dpml - r892 - in trunk/main/util/cli/src/test/net/dpml/cli: . application bug builder commandline option validation

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r892 - in trunk/main/util/cli/src/test/net/dpml/cli: . application bug builder commandline option validation
  • Date: Mon, 9 Jan 2006 06:06:37 +0100

Author: mcconnell
Date: 2006-01-09 06:06:32 +0100 (Mon, 09 Jan 2006)
New Revision: 892

Modified:
trunk/main/util/cli/src/test/net/dpml/cli/AbstractCommandLineTestCase.java
trunk/main/util/cli/src/test/net/dpml/cli/DocumentationTest.java
trunk/main/util/cli/src/test/net/dpml/cli/application/CpTest.java
trunk/main/util/cli/src/test/net/dpml/cli/application/CvsTest.java
trunk/main/util/cli/src/test/net/dpml/cli/application/LsTest.java
trunk/main/util/cli/src/test/net/dpml/cli/bug/Bug15046Test.java

trunk/main/util/cli/src/test/net/dpml/cli/bug/BugLoopingOptionLookAlikeTest.java
trunk/main/util/cli/src/test/net/dpml/cli/builder/ArgumentBuilderTest.java

trunk/main/util/cli/src/test/net/dpml/cli/builder/DefaultOptionBuilderTest.java

trunk/main/util/cli/src/test/net/dpml/cli/commandline/DefaultingCommandLineTest.java
trunk/main/util/cli/src/test/net/dpml/cli/option/ArgumentTest.java
trunk/main/util/cli/src/test/net/dpml/cli/validation/DateValidatorTest.java
Log:
checkstyle ...

Modified:
trunk/main/util/cli/src/test/net/dpml/cli/AbstractCommandLineTestCase.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/AbstractCommandLineTestCase.java
2006-01-09 04:12:29 UTC (rev 891)
+++
trunk/main/util/cli/src/test/net/dpml/cli/AbstractCommandLineTestCase.java
2006-01-09 05:06:32 UTC (rev 892)
@@ -40,7 +40,7 @@
*/
public abstract class AbstractCommandLineTestCase extends AbstractCLITestCase
{
- private static final ResourceHelper resources =
ResourceHelper.getResourceHelper( );
+ private static final ResourceHelper RESOURCES =
ResourceHelper.getResourceHelper( );

/**
* DOCUMENT ME!
@@ -217,7 +217,7 @@
}
catch( IllegalStateException e )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.ARGUMENT_TOO_MANY_VALUES ),
e.getMessage( ) );
}
@@ -245,7 +245,7 @@
}
catch( IllegalStateException e )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.ARGUMENT_TOO_MANY_VALUES ),
e.getMessage( ) );
}
@@ -269,7 +269,7 @@
}
catch( IllegalStateException e )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.ARGUMENT_TOO_MANY_VALUES ),
e.getMessage( ) );
}
@@ -295,7 +295,7 @@
}
catch( IllegalStateException e )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.ARGUMENT_TOO_MANY_VALUES ),
e.getMessage( ) );
}
@@ -521,7 +521,7 @@
}
catch( IllegalStateException ise )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.ARGUMENT_TOO_MANY_VALUES ),
ise.getMessage( ) );
}
@@ -533,7 +533,7 @@
}
catch( IllegalStateException ise )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.ARGUMENT_TOO_MANY_VALUES ),
ise.getMessage( ) );
}
@@ -566,7 +566,7 @@
}
catch( IllegalStateException ise )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.SWITCH_ALREADY_SET ), ise.getMessage(
) );
}
}
@@ -574,7 +574,7 @@
/**
* DOCUMENT ME!
*/
- public final void testSwitches_True( )
+ public final void testSwitchesTrue( )
{
final Option option = new PropertyOption( );
final List args = AbstractCLITestCase.list( );
@@ -590,7 +590,7 @@
/**
* DOCUMENT ME!
*/
- public final void testSwitches_False( )
+ public final void testSwitchesFalse( )
{
final Option option = new PropertyOption( );
final List args = AbstractCLITestCase.list( );
@@ -608,7 +608,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public final void testGetOptions_Order( ) throws OptionException
+ public final void testGetOptionsOrder( ) throws OptionException
{
final Option help = DefaultOptionTest.buildHelpOption( );
final Option login = CommandTest.buildLoginCommand( );
@@ -672,7 +672,7 @@
*
* @throws OptionException DOCUMENT ME!
*/
- public final void testGetOptionCount_Strings( ) throws OptionException
+ public final void testGetOptionCountStrings( ) throws OptionException
{
final Option help = DefaultOptionTest.buildHelpOption( );
final Option login = CommandTest.buildLoginCommand( );

Modified: trunk/main/util/cli/src/test/net/dpml/cli/DocumentationTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/DocumentationTest.java
2006-01-09 04:12:29 UTC (rev 891)
+++ trunk/main/util/cli/src/test/net/dpml/cli/DocumentationTest.java
2006-01-09 05:06:32 UTC (rev 892)
@@ -322,9 +322,9 @@
//setLogFile();
}
List targetList = cl.getValues( targets );
- for( Iterator i = targetList.iterator( ); i.hasNext( ); )
+ for( Iterator i = targetList.iterator(); i.hasNext();)
{
- String target = (String) i.next( );
+ String target = (String) i.next();
//doTarget(target);
}


Modified: trunk/main/util/cli/src/test/net/dpml/cli/application/CpTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/application/CpTest.java
2006-01-09 04:12:29 UTC (rev 891)
+++ trunk/main/util/cli/src/test/net/dpml/cli/application/CpTest.java
2006-01-09 05:06:32 UTC (rev 892)
@@ -109,36 +109,37 @@
public class CpTest extends TestCase
{
/** Option Builder */
- private static final DefaultOptionBuilder oBuilder = new
DefaultOptionBuilder( );
+ private static final DefaultOptionBuilder OPTION_BUILDER = new
DefaultOptionBuilder( );

/** Argument Builder */
- private static final ArgumentBuilder aBuilder = new ArgumentBuilder( );
+ private static final ArgumentBuilder ARGUMENT_BUILDER = new
ArgumentBuilder( );

/** Group Builder */
- private static final GroupBuilder gBuilder = new GroupBuilder( );
- private Group options;
- private ArgumentImpl source;
- private ArgumentImpl dest;
- private Argument targets;
- private Option archive;
- private Option backup;
- private Option noDereference;
- private Option force;
- private Option interactive;
- private Option link;
- private Option preserve;
- private Option parents;
- private Option recursive1;
- private Option sparse;
- private Option recursive2;
- private Option symbolicLink;
- private Option suffix;
- private Option update;
- private Option verbose;
- private Option versionControl;
- private Option oneFileSystem;
- private Option help;
- private Option version;
+ private static final GroupBuilder GROUP_BUILDER = new GroupBuilder( );
+
+ private Group m_options;
+ private ArgumentImpl m_source;
+ private ArgumentImpl m_dest;
+ private Argument m_targets;
+ private Option m_archive;
+ private Option m_backup;
+ private Option m_noDereference;
+ private Option m_force;
+ private Option m_interactive;
+ private Option m_link;
+ private Option m_preserve;
+ private Option m_parents;
+ private Option m_recursive1;
+ private Option m_sparse;
+ private Option m_recursive2;
+ private Option m_symbolicLink;
+ private Option m_suffix;
+ private Option m_update;
+ private Option m_verbose;
+ private Option m_versionControl;
+ private Option m_oneFileSystem;
+ private Option m_help;
+ private Option m_version;

/**
* DOCUMENT ME!
@@ -155,108 +156,108 @@
*/
public void setUp( )
{
- source = (ArgumentImpl) aBuilder.withName( "SOURCE" ).withMinimum( 1
)
+ m_source = (ArgumentImpl) ARGUMENT_BUILDER.withName( "SOURCE"
).withMinimum( 1 )
.create( );
- dest = (ArgumentImpl) aBuilder.withName( "DEST" ).withMinimum( 1 )
+ m_dest = (ArgumentImpl) ARGUMENT_BUILDER.withName( "DEST"
).withMinimum( 1 )
.withMaximum( 1 ).create( );
- targets = new SourceDestArgument( source, dest );
+ m_targets = new SourceDestArgument( m_source, m_dest );

- archive = oBuilder.withShortName( "a" ).withLongName( "archive" )
+ m_archive = OPTION_BUILDER.withShortName( "a" ).withLongName(
"archive" )
.withDescription( "same as -dpR" ).create( );

- backup = oBuilder.withShortName( "b" ).withLongName( "backup" )
+ m_backup = OPTION_BUILDER.withShortName( "b" ).withLongName(
"backup" )
.withDescription( "make backup before removal" )
.create( );

- noDereference = oBuilder.withShortName( "d" )
+ m_noDereference = OPTION_BUILDER.withShortName( "d" )
.withLongName( "no-dereference" )
.withDescription( "preserve links" ).create(
);

- force = oBuilder.withShortName( "f" ).withLongName( "force" )
+ m_force = OPTION_BUILDER.withShortName( "f" ).withLongName( "force" )
.withDescription( "remove existing destinations,
never prompt" )
.create( );

- interactive = oBuilder.withShortName( "i" ).withLongName(
"interactive" )
+ m_interactive = OPTION_BUILDER.withShortName( "i" ).withLongName(
"interactive" )
.withDescription( "prompt before overwrite" )
.create( );

- link = oBuilder.withShortName( "l" ).withLongName( "link" )
+ m_link = OPTION_BUILDER.withShortName( "l" ).withLongName( "link" )
.withDescription( "link files instead of copying" )
.create( );

- preserve = oBuilder.withShortName( "p" ).withLongName( "preserve" )
+ m_preserve = OPTION_BUILDER.withShortName( "p" ).withLongName(
"preserve" )
.withDescription( "preserve file attributes if
possible" )
.create( );

- parents = oBuilder.withShortName( "P" ).withLongName( "parents" )
+ m_parents = OPTION_BUILDER.withShortName( "P" ).withLongName(
"parents" )
.withDescription( "append source path to
DIRECTORY" )
.create( );

- recursive1 = oBuilder.withShortName( "r" )
+ m_recursive1 = OPTION_BUILDER.withShortName( "r" )
.withDescription( "copy recursively,
non-directories as files" )
.create( );

- sparse = oBuilder.withLongName( "sparse" )
+ m_sparse = OPTION_BUILDER.withLongName( "sparse" )
.withDescription( "control creation of sparse
files" )
- .withArgument( aBuilder.withName( "WHEN" )
+ .withArgument( ARGUMENT_BUILDER.withName( "WHEN" )
.withMinimum( 1
).withMaximum( 1 )
.withInitialSeparator( '=' )
.create( ) ).create( );

- recursive2 = oBuilder.withShortName( "R" ).withLongName( "recursive"
)
+ m_recursive2 = OPTION_BUILDER.withShortName( "R" ).withLongName(
"recursive" )
.withDescription( "copy directories
recursively" )
.create( );

- symbolicLink = oBuilder.withShortName( "s" )
+ m_symbolicLink = OPTION_BUILDER.withShortName( "s" )
.withLongName( "symbolic-link" )
.withDescription( "make symbolic links
instead of copying" )
.create( );

- suffix = oBuilder.withShortName( "S" ).withLongName( "suffix" )
+ m_suffix = OPTION_BUILDER.withShortName( "S" ).withLongName(
"suffix" )
.withDescription( "override the usual backup
suffix" )
- .withArgument( aBuilder.withName( "SUFFIX" )
+ .withArgument( ARGUMENT_BUILDER.withName( "SUFFIX" )
.withMinimum( 1
).withMaximum( 1 )
.create( ) ).create( );

- update = oBuilder.withShortName( "u" ).withLongName( "update" )
+ m_update = OPTION_BUILDER.withShortName( "u" ).withLongName(
"update" )
.withDescription( "copy only when the SOURCE file
is newer than the destination file or when the destination file is missing" )
.create( );

- verbose = oBuilder.withShortName( "v" ).withLongName( "verbose" )
+ m_verbose = OPTION_BUILDER.withShortName( "v" ).withLongName(
"verbose" )
.withDescription( "explain what is being done" )
.create( );

- versionControl = oBuilder.withShortName( "V" )
+ m_versionControl = OPTION_BUILDER.withShortName( "V" )
.withLongName( "version-contol" )
.withDescription( "explain what is being
done" )
- .withArgument( aBuilder.withName( "WORD" )
+ .withArgument( ARGUMENT_BUILDER.withName(
"WORD" )

.withInitialSeparator( '=' )
.withMinimum( 1 )
.withMaximum( 1 )
.create( )
).create( );

- oneFileSystem = oBuilder.withShortName( "x" )
+ m_oneFileSystem = OPTION_BUILDER.withShortName( "x" )
.withLongName( "one-file-system" )
.withDescription( "stay on this file system"
)
.create( );

- help = oBuilder.withLongName( "help" )
+ m_help = OPTION_BUILDER.withLongName( "help" )
.withDescription( "display this help and exit"
).create( );

- version = oBuilder.withLongName( "version" )
+ m_version = OPTION_BUILDER.withLongName( "version" )
.withDescription( "output version information and
exit" )
.create( );

- options = gBuilder.withOption( archive ).withOption( backup )
- .withOption( noDereference ).withOption( force )
- .withOption( interactive ).withOption( link )
- .withOption( preserve ).withOption( parents )
- .withOption( recursive1 ).withOption( sparse )
- .withOption( recursive2 ).withOption( symbolicLink
)
- .withOption( suffix ).withOption( update )
- .withOption( verbose ).withOption( versionControl )
- .withOption( oneFileSystem ).withOption( help )
- .withOption( version ).withOption( targets )
+ m_options = GROUP_BUILDER.withOption( m_archive ).withOption(
m_backup )
+ .withOption( m_noDereference ).withOption( m_force
)
+ .withOption( m_interactive ).withOption( m_link )
+ .withOption( m_preserve ).withOption( m_parents )
+ .withOption( m_recursive1 ).withOption( m_sparse )
+ .withOption( m_recursive2 ).withOption(
m_symbolicLink )
+ .withOption( m_suffix ).withOption( m_update )
+ .withOption( m_verbose ).withOption(
m_versionControl )
+ .withOption( m_oneFileSystem ).withOption( m_help )
+ .withOption( m_version ).withOption( m_targets )
.withName( "OPTIONS" ).create( );
}

@@ -266,7 +267,7 @@
public void testNoSource( )
{
Parser parser = new Parser( );
- parser.setGroup( options );
+ parser.setGroup( m_options );

try
{
@@ -288,14 +289,14 @@
{
final String[] args = new String[]{"source1", "dest1"};
final Parser parser = new Parser( );
- parser.setGroup( options );
+ parser.setGroup( m_options );

final CommandLine commandLine = parser.parse( args );

- assertTrue( commandLine.getValues( source ).contains( "source1" ) );
- assertEquals( 1, commandLine.getValues( source ).size( ) );
- assertTrue( commandLine.getValues( dest ).contains( "dest1" ) );
- assertEquals( 1, commandLine.getValues( dest ).size( ) );
+ assertTrue( commandLine.getValues( m_source ).contains( "source1" )
);
+ assertEquals( 1, commandLine.getValues( m_source ).size( ) );
+ assertTrue( commandLine.getValues( m_dest ).contains( "dest1" ) );
+ assertEquals( 1, commandLine.getValues( m_dest ).size( ) );
}

/**
@@ -310,17 +311,17 @@
"source1", "source2", "source3", "dest1"
};
final Parser parser = new Parser( );
- parser.setGroup( options );
+ parser.setGroup( m_options );

final CommandLine commandLine = parser.parse( args );

- assertTrue( commandLine.getValues( source ).contains( "source1" ) );
- assertTrue( commandLine.getValues( source ).contains( "source2" ) );
- assertTrue( commandLine.getValues( source ).contains( "source3" ) );
- assertEquals( 3, commandLine.getValues( source ).size( ) );
+ assertTrue( commandLine.getValues( m_source ).contains( "source1" )
);
+ assertTrue( commandLine.getValues( m_source ).contains( "source2" )
);
+ assertTrue( commandLine.getValues( m_source ).contains( "source3" )
);
+ assertEquals( 3, commandLine.getValues( m_source ).size( ) );

- assertTrue( commandLine.getValues( dest ).contains( "dest1" ) );
- assertEquals( 1, commandLine.getValues( dest ).size( ) );
+ assertTrue( commandLine.getValues( m_dest ).contains( "dest1" ) );
+ assertEquals( 1, commandLine.getValues( m_dest ).size( ) );
}

/**
@@ -332,7 +333,7 @@
{
final StringWriter out = new StringWriter( );
final HelpFormatter helpFormatter = new HelpFormatter( );
- helpFormatter.setGroup( options );
+ helpFormatter.setGroup( m_options );
helpFormatter.setPrintWriter( new PrintWriter( out ) );
helpFormatter.print( );


Modified: trunk/main/util/cli/src/test/net/dpml/cli/application/CvsTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/application/CvsTest.java
2006-01-09 04:12:29 UTC (rev 891)
+++ trunk/main/util/cli/src/test/net/dpml/cli/application/CvsTest.java
2006-01-09 05:06:32 UTC (rev 892)
@@ -43,193 +43,146 @@
final CommandBuilder cbuilder = new CommandBuilder( );
final GroupBuilder gbuilder = new GroupBuilder( );

- final Group commands = gbuilder.withName( "commands" )
- .withOption( cbuilder.withName( "add"
)
- .withName( "ad" )
- .withName( "new"
)
-
.withDescription( "Add a new file/directory to the repository" )
- .create( ) )
- .withOption( cbuilder.withName(
"admin" )
- .withName( "adm"
)
- .withName( "rcs"
)
-
.withDescription( "Administration front end for rcs" )
- .create( ) )
- .withOption( cbuilder.withName(
- "annotate" ).withName( "ann" )
-
.withDescription( "Show last revision where each line was modified" )
- .create( ) )
- .withOption( cbuilder.withName(
- "checkout" ).withName( "co" ).withName( "get" )
-
.withDescription( "Checkout sources for editing" )
- .create( ) )
- .withOption( cbuilder.withName(
"commit" )
- .withName( "ci" )
- .withName( "com"
)
-
.withDescription( "Check files into the repository" )
- .create( ) )
- .withOption( cbuilder.withName(
"diff" )
- .withName( "di" )
- .withName( "dif"
)
-
.withDescription( "Show differences between revisions" )
- .create( ) )
- .withOption( cbuilder.withName(
"edit" )
-
.withDescription( "Get ready to edit a watched file" )
- .create( ) )
- .withOption( cbuilder.withName(
- "editors" )
-
.withDescription( "See who is editing a watched file" )
- .create( ) )
- .withOption( cbuilder.withName(
"export" )
- .withName( "exp"
)
- .withName( "ex" )
-
.withDescription( "Export sources from CVS, similar to checkout" )
- .create( ) )
- .withOption( cbuilder.withName(
- "history" ).withName( "hi" ).withName( "his" )
-
.withDescription( "Show repository access history" )
- .create( ) )
- .withOption( cbuilder.withName(
"import" )
- .withName( "im" )
- .withName( "imp"
)
-
.withDescription( "Import sources into CVS, using vendor branches" )
- .create( ) )
- .withOption( cbuilder.withName(
"init" )
-
.withDescription( "Create a CVS repository if it doesn't exist" )
- .create( ) )
- .withOption( cbuilder.withName( "log"
)
- .withName( "lo" )
- .withName(
"rlog" )
-
.withDescription( "Print out history information for files" )
- .create( ) )
- .withOption( cbuilder.withName(
"login" )
- .withName(
"logon" )
- .withName( "lgn"
)
-
.withDescription( "Prompt for password for authenticating server" )
- .create( ) )
- .withOption( cbuilder.withName(
"logout" )
-
.withDescription( "Removes entry in .cvspass for remote repository" )
- .create( ) )
- .withOption( cbuilder.withName(
"rdiff" )
- .withName(
"patch" )
- .withName( "pa" )
-
.withDescription( "Create 'patch' format diffs between releases" )
- .create( ) )
- .withOption( cbuilder.withName(
- "release" ).withName( "re" ).withName( "rel" )
-
.withDescription( "Indicate that a Module is no longer in use" )
- .create( ) )
- .withOption( cbuilder.withName(
"remove" )
- .withName( "rm" )
- .withName(
"delete" )
-
.withDescription( "Remove an entry from the repository" )
- .create( ) )
- .withOption( cbuilder.withName(
"rtag" )
- .withName( "rt" )
- .withName(
"rfreeze" )
-
.withDescription( "Add a symbolic tag to a module" )
- .create( ) )
- .withOption( cbuilder.withName(
"status" )
- .withName( "st" )
- .withName(
"stat" )
-
.withDescription( "Display status information on checked out files" )
- .create( ) )
- .withOption( cbuilder.withName( "tag"
)
- .withName( "ta" )
- .withName(
"freeze" )
-
.withDescription( "Add a symbolic tag to checked out version of files" )
- .create( ) )
- .withOption( cbuilder.withName(
"unedit" )
-
.withDescription( "Undo an edit command" )
- .create( ) )
- .withOption( cbuilder.withName(
"update" )
- .withName( "up" )
- .withName( "upd"
)
-
.withDescription( "Bring work tree in sync with repository" )
- .create( ) )
- .withOption( cbuilder.withName(
"watch" )
-
.withDescription( "Set watches" )
- .create( ) )
- .withOption( cbuilder.withName(
- "watchers" ).withDescription( "See who is watching a
file" )
- .create( ) )
- .withOption( cbuilder.withName(
- "version" ).withName( "ve" ).withName( "ver" )
-
.withDescription( "????" )
- .create( ) )
- .withOption(
ArgumentTest.buildTargetsArgument( ) )
- .create( );
+ final Group commands =
+ gbuilder
+ .withName( "commands" )
+ .withOption( cbuilder.withName( "add" )
+ .withName( "ad" ).withName( "new" ).withDescription( "Add a new
file/directory to the repository" )
+ .create( ) )
+ .withOption(
+ cbuilder
+ .withName( "admin" ).withName( "adm" ).withName( "rcs" )
+ .withDescription( "Administration front end for rcs"
).create( ) )
+ .withOption(
+ cbuilder.withName( "annotate" ).withName( "ann" )
+ .withDescription( "Show last revision where each line was
modified" )
+ .create( ) )
+ .withOption(
+ cbuilder.withName( "checkout" ).withName( "co" ).withName(
"get" )
+ .withDescription( "Checkout sources for editing" )
+ .create( ) )
+ .withOption(
+ cbuilder.withName( "commit" ).withName( "ci" ).withName( "com"
)
+ .withDescription( "Check files into the repository" )
+ .create( ) )
+ .withOption(
+ cbuilder.withName( "diff" ).withName( "di" ).withName( "dif" )
+ .withDescription( "Show differences between revisions"
).create( ) )
+ .withOption(
+ cbuilder.withName( "edit" )
+ .withDescription( "Get ready to edit a watched file"
).create( ) )
+ .withOption(
+ cbuilder.withName( "editors" )
+ .withDescription( "See who is editing a watched file"
).create( ) )
+ .withOption(
+ cbuilder.withName( "export" ).withName( "exp" ).withName( "ex"
)
+ .withDescription( "Export sources from CVS, similar to
checkout" ).create( ) )
+ .withOption(
+ cbuilder.withName( "history" ).withName( "hi" ).withName(
"his" )
+ .withDescription( "Show repository access history" ).create(
) )
+ .withOption(
+ cbuilder.withName( "import" )
+ .withName( "im" )
+ .withName( "imp" )
+ .withDescription( "Import sources into CVS, using vendor
branches" )
+ .create( ) )
+ .withOption(
+ cbuilder.withName( "init" )
+ .withDescription( "Create a CVS repository if it doesn't
exist" ).create( ) )
+ .withOption(
+ cbuilder.withName( "log" ).withName( "lo" ).withName( "rlog" )
+ .withDescription( "Print out history information for files"
).create( ) )
+ .withOption(
+ cbuilder.withName( "login" ).withName( "logon" ).withName(
"lgn" )
+ .withDescription( "Prompt for password for authenticating
server" ).create( ) )
+ .withOption(
+ cbuilder.withName( "logout" )
+ .withDescription( "Removes entry in .cvspass for remote
repository" ).create( ) )
+ .withOption(
+ cbuilder.withName( "rdiff" ).withName( "patch" ).withName(
"pa" )
+ .withDescription( "Create 'patch' format diffs between
releases" ).create( ) )
+ .withOption(
+ cbuilder.withName( "release" ).withName( "re" ).withName(
"rel" )
+ .withDescription( "Indicate that a Module is no longer in
use" ).create( ) )
+ .withOption(
+ cbuilder.withName( "remove" ).withName( "rm" ).withName(
"delete" )
+ .withDescription( "Remove an entry from the repository"
).create( ) )
+ .withOption(
+ cbuilder.withName( "rtag" ).withName( "rt" ).withName(
"rfreeze" )
+ .withDescription( "Add a symbolic tag to a module" ).create(
) )
+ .withOption(
+ cbuilder.withName( "status" ).withName( "st" ).withName(
"stat" )
+ .withDescription( "Display status information on checked out
files" ).create( ) )
+ .withOption(
+ cbuilder.withName( "tag" ).withName( "ta" ).withName( "freeze"
)
+ .withDescription( "Add a symbolic tag to checked out version
of files" ).create( ) )
+ .withOption(
+ cbuilder.withName( "unedit" ).withDescription( "Undo an edit
command" ).create( ) )
+ .withOption(
+ cbuilder.withName( "update" ).withName( "up" ).withName( "upd"
)
+ .withDescription( "Bring work tree in sync with repository"
).create( ) )
+ .withOption(
+ cbuilder.withName( "watch" ).withDescription( "Set watches"
).create( ) )
+ .withOption(
+ cbuilder.withName( "watchers" ).withDescription( "See who is
watching a file" ).create( ) )
+ .withOption(
+ cbuilder.withName( "version" ).withName( "ve" ).withName(
"ver" )
+ .withDescription( "????" ).create( ) )
+ .withOption( ArgumentTest.buildTargetsArgument( ) ).create();

- final Group cvsOptions = new GroupBuilder( ).withName(
"cvs-options" )
- .withOption(
obuilder.withShortName(
- "H" )
-
.withDescription( "Displays usage information for command." )
-
.create( ) )
- .withOption(
obuilder.withShortName(
- "Q" ).withDescription( "Cause CVS to be really quiet." )
-
.create( ) )
- .withOption(
obuilder.withShortName(
- "q" ).withDescription( "Cause CVS to be somewhat quiet."
)
-
.create( ) )
- .withOption(
obuilder.withShortName(
- "r" ).withDescription( "Make checked-out files
read-only." )
-
.create( ) )
- .withOption(
obuilder.withShortName(
- "w" )
-
.withDescription( "Make checked-out files read-write (default)." )
-
.create( ) )
- .withOption(
obuilder.withShortName(
- "l" ).withDescription( "Turn history logging off."
).create( ) )
- .withOption(
obuilder.withShortName(
- "n" )
-
.withDescription( "Do not execute anything that will change the disk." )
-
.create( ) )
- .withOption(
obuilder.withShortName(
- "t" )
-
.withDescription( "Show trace of program execution -- try with -n." )
-
.create( ) )
- .withOption(
obuilder.withShortName(
- "v" ).withDescription( "CVS version and copyright." )
-
.create( ) )
- .withOption(
obuilder.withLongName(
- "crlf" )
-
.withDescription( "Use the Dos line feed for text files (default)." )
-
.create( ) )
- .withOption(
obuilder.withLongName(
- "lf" )
-
.withDescription( "Use the Unix line feed for text files." )
-
.create( ) )
- .withOption(
obuilder.withShortName(
- "T" ).withDescription( "Use 'tmpdir' for temporary
files." )
-
.withArgument( abuilder.withName(
- "tmpdir" ).create( ) ).create( ) )
- .withOption(
obuilder.withShortName(
- "e" )
-
.withDescription( "Use 'editor' for editing log information." )
-
.withArgument( abuilder.withName(
- "editor" ).create( ) ).create( ) )
- .withOption(
obuilder.withShortName(
- "d" )
-
.withDescription( "Overrides $CVSROOT as the root of the CVS tree." )
-
.withArgument( abuilder.withName(
- "CVS_root" ).create( ) ).create( ) )
- .withOption(
obuilder.withShortName(
- "f" ).withDescription( "Do not use the ~/.cvsrc file." )
-
.create( ) )
- .withOption(
obuilder.withShortName(
- "z" )
-
.withDescription( "Use compression level '#' for net traffic." )
-
.withArgument( abuilder.withName(
- "#" ).create( ) ).create( ) )
- .withOption(
obuilder.withShortName(
- "a" ).withDescription( "Authenticate all net traffic." )
-
.create( ) )
- .withOption(
obuilder.withShortName(
- "s" ).withDescription( "Set CVS user variable." )
-
.withArgument( abuilder.withName(
- "VAR=VAL" ).create( ) ).create( ) )
- .withOption( commands )
- .create( );
-
+ final Group cvsOptions =
+ new GroupBuilder()
+ .withName( "cvs-options" )
+ .withOption(
+ obuilder
+ .withShortName( "H" )
+ .withDescription( "Displays usage information for command."
).create( ) )
+ .withOption(
+ obuilder.withShortName( "Q" ).withDescription( "Cause CVS to
be really quiet." ).create( ) )
+ .withOption(
+ obuilder.withShortName( "q" ).withDescription( "Cause CVS to
be somewhat quiet." ).create( ) )
+ .withOption(
+ obuilder.withShortName( "r" ).withDescription( "Make
checked-out files read-only." ).create( ) )
+ .withOption(
+ obuilder.withShortName( "w" )
+ .withDescription( "Make checked-out files read-write
(default)." ).create( ) )
+ .withOption( obuilder.withShortName( "l" ).withDescription(
"Turn history logging off." ).create( ) )
+ .withOption(
+ obuilder.withShortName( "n" )
+ .withDescription( "Do not execute anything that will change
the disk." ).create( ) )
+ .withOption(
+ obuilder.withShortName( "t" )
+ .withDescription( "Show trace of program execution -- try
with -n." ).create( ) )
+ .withOption(
+ obuilder.withShortName( "v" ).withDescription( "CVS version
and copyright." ).create( ) )
+ .withOption(
+ obuilder.withLongName( "crlf" )
+ .withDescription( "Use the Dos line feed for text files
(default)." ).create( ) )
+ .withOption(
+ obuilder.withLongName( "lf" ).withDescription( "Use the Unix
line feed for text files." ).create( ) )
+ .withOption(
+ obuilder.withShortName( "T" )
+ .withDescription( "Use 'tmpdir' for temporary files."
).withArgument(
+ abuilder.withName( "tmpdir" ).create( ) ).create( ) )
+ .withOption(
+ obuilder.withShortName( "e" ).withDescription( "Use 'editor'
for editing log information." )
+ .withArgument(
+ abuilder.withName( "editor" ).create( ) ).create( ) )
+ .withOption(
+ obuilder.withShortName( "d" )
+ .withDescription( "Overrides $CVSROOT as the root of the CVS
tree." )
+ .withArgument( abuilder.withName( "CVS_root" ).create( )
).create( ) )
+ .withOption(
+ obuilder.withShortName( "f" ).withDescription( "Do not use the
~/.cvsrc file." ).create( ) )
+ .withOption(
+ obuilder.withShortName( "z" ).withDescription( "Use
compression level '#' for net traffic." )
+ .withArgument( abuilder.withName( "#" ).create( ) ).create(
) )
+ .withOption( obuilder.withShortName( "a" ).withDescription(
"Authenticate all net traffic." ).create( ) )
+ .withOption(
+ obuilder.withShortName( "s" ).withDescription( "Set CVS user
variable." ).withArgument(
+ abuilder.withName( "VAR=VAL" ).create( ) ).create( ) )
+ .withOption( commands )
+ .create( );
assertNotNull( cvsOptions );
}
}

Modified: trunk/main/util/cli/src/test/net/dpml/cli/application/LsTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/application/LsTest.java
2006-01-09 04:12:29 UTC (rev 891)
+++ trunk/main/util/cli/src/test/net/dpml/cli/application/LsTest.java
2006-01-09 05:06:32 UTC (rev 892)
@@ -127,14 +127,14 @@
public class LsTest extends TestCase
{
/** Option Builder */
- private static final DefaultOptionBuilder oBuilder = new
DefaultOptionBuilder( );
+ private static final DefaultOptionBuilder OPTION_BUILDER = new
DefaultOptionBuilder( );

/** Argument Builder */
- private static final ArgumentBuilder aBuilder = new ArgumentBuilder( );
+ private static final ArgumentBuilder ARGUMENT_BUILDER = new
ArgumentBuilder( );

/** Group Builder */
- private static final GroupBuilder gBuilder = new GroupBuilder( );
- private static Group options;
+ private static final GroupBuilder GROUP_BUILDER = new GroupBuilder( );
+ private static Group m_OPTIONS;

/**
* Required ctor.
@@ -162,20 +162,20 @@
*/
public void setUp( )
{
- if( LsTest.options == null )
+ if( LsTest.m_OPTIONS == null )
{
- final Option a = oBuilder.withShortName( "a" ).withLongName(
"all" )
+ final Option a = OPTION_BUILDER.withShortName( "a"
).withLongName( "all" )
.withDescription( "do not hide entries
starting with ." )
.create( );

- final Option blockSize = oBuilder.withLongName( "block-size" )
+ final Option blockSize = OPTION_BUILDER.withLongName(
"block-size" )
.withRequired( false )
.withDescription( "use
SIZE-byte blocks" )
- .withArgument(
aBuilder.withMaximum(
+ .withArgument(
ARGUMENT_BUILDER.withMaximum(
1 ).withMinimum( 1 ).withInitialSeparator( '='
).create( ) )
.create( );

- final Option c = oBuilder.withShortName( "c" ).withRequired(
false )
+ final Option c = OPTION_BUILDER.withShortName( "c"
).withRequired( false )
.withDescription( "with -lt: sort by,
and show, ctime (time of last modification of file status information) with
-l:show ctime and sort by name otherwise: sort by ctime" )
.create( );

@@ -184,16 +184,16 @@
colors.add( "always" );
colors.add( "auto" );

- final Option color = oBuilder.withLongName( "color" )
+ final Option color = OPTION_BUILDER.withLongName( "color" )
.withRequired( false )
.withDescription( "control whether
color is used to distinguish file types. WHEN may be `never', `always', or
`auto'" )
- .withArgument(
aBuilder.withMaximum( 1 )
+ .withArgument(
ARGUMENT_BUILDER.withMaximum( 1 )

.withMinimum( 1 )

.withInitialSeparator( '=' )

.withValidator( new EnumValidator(
colors ) ).create( ) ).create( );

- LsTest.options = gBuilder.withOption( a ).withOption( blockSize )
+ LsTest.m_OPTIONS = GROUP_BUILDER.withOption( a ).withOption(
blockSize )
.withOption( c ).withOption( color )
.create( );
}
@@ -208,7 +208,7 @@
{
// create the command line parser
Parser parser = new Parser( );
- parser.setGroup( options );
+ parser.setGroup( m_OPTIONS );

CommandLine line = parser.parse( new String[]
{

Modified: trunk/main/util/cli/src/test/net/dpml/cli/bug/Bug15046Test.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/bug/Bug15046Test.java
2006-01-09 04:12:29 UTC (rev 891)
+++ trunk/main/util/cli/src/test/net/dpml/cli/bug/Bug15046Test.java
2006-01-09 05:06:32 UTC (rev 892)
@@ -30,6 +30,8 @@
*/
public class Bug15046Test extends TestCase
{
+ private static final String[] CLI_ARGS = new String[]{"-z", "c"};
+
/**
* Creates a new Bug15046Test object.
*
@@ -47,8 +49,6 @@
*/
public void testParamNamedAsOption( ) throws Exception
{
- final String[] CLI_ARGS = new String[]{"-z", "c"};
-
DefaultOptionBuilder obuilder = new DefaultOptionBuilder( );
ArgumentBuilder abuilder = new ArgumentBuilder( );


Modified:
trunk/main/util/cli/src/test/net/dpml/cli/bug/BugLoopingOptionLookAlikeTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/bug/BugLoopingOptionLookAlikeTest.java
2006-01-09 04:12:29 UTC (rev 891)
+++
trunk/main/util/cli/src/test/net/dpml/cli/bug/BugLoopingOptionLookAlikeTest.java
2006-01-09 05:06:32 UTC (rev 892)
@@ -58,7 +58,7 @@

try
{
- parser.parse( new String[]{"-abcdef", "testfile.txt ",} );
+ parser.parse( new String[]{"-abcdef", "testfile.txt ", } );
fail( "OptionException" );
}
catch( OptionException e )
@@ -75,14 +75,14 @@
{
final ArgumentBuilder abuilder = new ArgumentBuilder( );
final GroupBuilder gbuilder = new GroupBuilder( );
- final Argument inputfile_opt = abuilder.withName( "input" )
+ final Argument inputfileOpt = abuilder.withName( "input" )
.withMinimum( 1
).withMaximum( 1 )
.create( );
- final Argument outputfile_opt = abuilder.withName( "output" )
+ final Argument outputfileOpt = abuilder.withName( "output" )
.withMinimum( 1
).withMaximum( 1 )
.create( );
- final Argument targets = new SourceDestArgument( inputfile_opt,
- outputfile_opt );
+ final Argument targets = new SourceDestArgument( inputfileOpt,
+ outputfileOpt );
final Group options = gbuilder.withOption( targets ).create( );
final Parser parser = new Parser( );
parser.setGroup( options );

Modified:
trunk/main/util/cli/src/test/net/dpml/cli/builder/ArgumentBuilderTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/builder/ArgumentBuilderTest.java
2006-01-09 04:12:29 UTC (rev 891)
+++
trunk/main/util/cli/src/test/net/dpml/cli/builder/ArgumentBuilderTest.java
2006-01-09 05:06:32 UTC (rev 892)
@@ -22,7 +22,7 @@
import net.dpml.cli.resource.ResourceHelper;

//import net.dpml.cli.validation.DateValidator;
-import net.dpml.cli.validation.Validator;
+//import net.dpml.cli.validation.Validator;

import java.util.ArrayList;
import java.util.List;
@@ -35,8 +35,8 @@
*/
public class ArgumentBuilderTest extends TestCase
{
- private static final ResourceHelper resources =
ResourceHelper.getResourceHelper( );
- private ArgumentBuilder argumentBuilder;
+ private static final ResourceHelper RESOURCES =
ResourceHelper.getResourceHelper( );
+ private ArgumentBuilder m_argumentBuilder;

/*
* @see TestCase#setUp()
@@ -48,7 +48,7 @@
*/
protected void setUp( ) throws Exception
{
- this.argumentBuilder = new ArgumentBuilder( );
+ this.m_argumentBuilder = new ArgumentBuilder( );
}

/**
@@ -56,10 +56,10 @@
*/
public void testConsumeRemaining( )
{
- this.argumentBuilder.withConsumeRemaining( "--" );
- this.argumentBuilder.withName( "arg" );
+ this.m_argumentBuilder.withConsumeRemaining( "--" );
+ this.m_argumentBuilder.withName( "arg" );

- ArgumentImpl arg = (ArgumentImpl) this.argumentBuilder.create( );
+ ArgumentImpl arg = (ArgumentImpl) this.m_argumentBuilder.create( );

assertEquals( "incorrect consume remaining token", "--",
arg.getConsumeRemaining( ) );
@@ -72,13 +72,13 @@
{
try
{
- this.argumentBuilder.withConsumeRemaining( null );
+ this.m_argumentBuilder.withConsumeRemaining( null );
fail( "cannot use null consume remaining token" );
}
catch( IllegalArgumentException exp )
{
assertEquals( "wrong exception message",
- resources.getMessage(
+ RESOURCES.getMessage(

ResourceConstants.ARGUMENT_BUILDER_NULL_CONSUME_REMAINING ),
exp.getMessage( ) );
}
@@ -91,13 +91,13 @@
{
try
{
- this.argumentBuilder.withConsumeRemaining( "" );
+ this.m_argumentBuilder.withConsumeRemaining( "" );
fail( "cannot use empty string consume remaining token" );
}
catch( IllegalArgumentException exp )
{
assertEquals( "wrong exception message",
- resources.getMessage(
+ RESOURCES.getMessage(

ResourceConstants.ARGUMENT_BUILDER_EMPTY_CONSUME_REMAINING ),
exp.getMessage( ) );
}
@@ -108,10 +108,10 @@
*/
public void testDefault( )
{
- this.argumentBuilder.withDefault( "defaultString" );
- this.argumentBuilder.withName( "arg" );
+ this.m_argumentBuilder.withDefault( "defaultString" );
+ this.m_argumentBuilder.withName( "arg" );

- ArgumentImpl arg = (ArgumentImpl) this.argumentBuilder.create( );
+ ArgumentImpl arg = (ArgumentImpl) this.m_argumentBuilder.create( );

assertEquals( "incorrect number of default values", 1,
arg.getDefaultValues( ).size( ) );
@@ -124,11 +124,11 @@
*/
public void testDefaultX2( )
{
- this.argumentBuilder.withDefault( "defaultString1" );
- this.argumentBuilder.withDefault( "defaultString2" );
- this.argumentBuilder.withName( "arg" );
+ this.m_argumentBuilder.withDefault( "defaultString1" );
+ this.m_argumentBuilder.withDefault( "defaultString2" );
+ this.m_argumentBuilder.withName( "arg" );

- ArgumentImpl arg = (ArgumentImpl) this.argumentBuilder.create( );
+ ArgumentImpl arg = (ArgumentImpl) this.m_argumentBuilder.create( );

assertEquals( "incorrect number of default values", 2,
arg.getDefaultValues( ).size( ) );
@@ -145,13 +145,13 @@
{
try
{
- this.argumentBuilder.withDefault( null );
+ this.m_argumentBuilder.withDefault( null );
fail( "cannot use null default" );
}
catch( IllegalArgumentException exp )
{
assertEquals( "wrong exception message",
- resources.getMessage(
+ RESOURCES.getMessage(
ResourceConstants.ARGUMENT_BUILDER_NULL_DEFAULT ),
exp.getMessage( ) );
}
@@ -166,10 +166,10 @@
defaults.add( "one" );
defaults.add( "two" );

- this.argumentBuilder.withDefaults( defaults );
- this.argumentBuilder.withName( "arg" );
+ this.m_argumentBuilder.withDefaults( defaults );
+ this.m_argumentBuilder.withName( "arg" );

- ArgumentImpl arg = (ArgumentImpl) this.argumentBuilder.create( );
+ ArgumentImpl arg = (ArgumentImpl) this.m_argumentBuilder.create( );

assertEquals( "incorrect number of default values", 2,
arg.getDefaultValues( ).size( ) );
@@ -188,13 +188,13 @@
{
try
{
- this.argumentBuilder.withDefaults( null );
+ this.m_argumentBuilder.withDefaults( null );
fail( "cannot use null defaults" );
}
catch( IllegalArgumentException exp )
{
assertEquals( "wrong exception message",
- resources.getMessage(
+ RESOURCES.getMessage(
ResourceConstants.ARGUMENT_BUILDER_NULL_DEFAULTS ),
exp.getMessage( ) );
}
@@ -205,10 +205,10 @@
*/
public void testId( )
{
- this.argumentBuilder.withId( 1 );
- this.argumentBuilder.withName( "arg" );
+ this.m_argumentBuilder.withId( 1 );
+ this.m_argumentBuilder.withName( "arg" );

- ArgumentImpl arg = (ArgumentImpl) this.argumentBuilder.create( );
+ ArgumentImpl arg = (ArgumentImpl) this.m_argumentBuilder.create( );

assertEquals( "incorrect id", 1, arg.getId( ) );
}
@@ -218,10 +218,10 @@
*/
public void testInitialSeparator( )
{
- this.argumentBuilder.withInitialSeparator( ',' );
- this.argumentBuilder.withName( "arg" );
+ this.m_argumentBuilder.withInitialSeparator( ',' );
+ this.m_argumentBuilder.withName( "arg" );

- ArgumentImpl arg = (ArgumentImpl) this.argumentBuilder.create( );
+ ArgumentImpl arg = (ArgumentImpl) this.m_argumentBuilder.create( );

assertEquals( "incorrect initial separator", ',',
arg.getInitialSeparator( ) );
@@ -232,10 +232,10 @@
*/
public void testMaximum( )
{
- this.argumentBuilder.withMaximum( 1 );
- this.argumentBuilder.withName( "arg" );
+ this.m_argumentBuilder.withMaximum( 1 );
+ this.m_argumentBuilder.withName( "arg" );

- ArgumentImpl arg = (ArgumentImpl) this.argumentBuilder.create( );
+ ArgumentImpl arg = (ArgumentImpl) this.m_argumentBuilder.create( );

assertEquals( "incorrect maximum", 1, arg.getMaximum( ) );
}
@@ -247,13 +247,13 @@
{
try
{
- this.argumentBuilder.withMaximum( -1 );
+ this.m_argumentBuilder.withMaximum( -1 );
fail( "cannot use negative maximum" );
}
catch( IllegalArgumentException exp )
{
assertEquals( "wrong exception message",
- resources.getMessage(
+ RESOURCES.getMessage(
ResourceConstants.ARGUMENT_BUILDER_NEGATIVE_MAXIMUM ),
exp.getMessage( ) );
}
@@ -264,10 +264,10 @@
*/
public void testMinimum( )
{
- this.argumentBuilder.withMinimum( 1 );
- this.argumentBuilder.withName( "arg" );
+ this.m_argumentBuilder.withMinimum( 1 );
+ this.m_argumentBuilder.withName( "arg" );

- ArgumentImpl arg = (ArgumentImpl) this.argumentBuilder.create( );
+ ArgumentImpl arg = (ArgumentImpl) this.m_argumentBuilder.create( );

assertEquals( "incorrect maximum", 1, arg.getMinimum( ) );
}
@@ -279,13 +279,13 @@
{
try
{
- this.argumentBuilder.withMinimum( -1 );
+ this.m_argumentBuilder.withMinimum( -1 );
fail( "cannot use negative minimum" );
}
catch( IllegalArgumentException exp )
{
assertEquals( "wrong exception message",
- resources.getMessage(
+ RESOURCES.getMessage(
ResourceConstants.ARGUMENT_BUILDER_NEGATIVE_MINIMUM ),
exp.getMessage( ) );
}
@@ -296,9 +296,9 @@
*/
public void testName( )
{
- this.argumentBuilder.withName( "arg" );
+ this.m_argumentBuilder.withName( "arg" );

- ArgumentImpl arg = (ArgumentImpl) this.argumentBuilder.create( );
+ ArgumentImpl arg = (ArgumentImpl) this.m_argumentBuilder.create( );

assertEquals( "incorrect preferred name", "arg",
arg.getPreferredName( ) );
@@ -311,13 +311,13 @@
{
try
{
- this.argumentBuilder.withName( null );
+ this.m_argumentBuilder.withName( null );
fail( "cannot use null name" );
}
catch( IllegalArgumentException exp )
{
assertEquals( "wrong exception message",
- resources.getMessage(
+ RESOURCES.getMessage(
ResourceConstants.ARGUMENT_BUILDER_NULL_NAME ),
exp.getMessage( ) );
}
@@ -330,13 +330,13 @@
{
try
{
- this.argumentBuilder.withName( "" );
+ this.m_argumentBuilder.withName( "" );
fail( "cannot use empty name" );
}
catch( IllegalArgumentException exp )
{
assertEquals( "wrong exception message",
- resources.getMessage(
+ RESOURCES.getMessage(
ResourceConstants.ARGUMENT_BUILDER_EMPTY_NAME ),
exp.getMessage( ) );
}
@@ -347,10 +347,10 @@
*/
public void testSubsequentSeparator( )
{
- this.argumentBuilder.withSubsequentSeparator( ':' );
- this.argumentBuilder.withName( "arg" );
+ this.m_argumentBuilder.withSubsequentSeparator( ':' );
+ this.m_argumentBuilder.withName( "arg" );

- ArgumentImpl arg = (ArgumentImpl) this.argumentBuilder.create( );
+ ArgumentImpl arg = (ArgumentImpl) this.m_argumentBuilder.create( );

assertEquals( "incorrect subsequent separator", ':',
arg.getSubsequentSeparator( ) );
@@ -364,13 +364,13 @@
{
try
{
- this.argumentBuilder.withValidator( null );
+ this.m_argumentBuilder.withValidator( null );
fail( "cannot use null validator" );
}
catch( IllegalArgumentException exp )
{
assertEquals( "wrong exception message",
- resources.getMessage(
+ RESOURCES.getMessage(
ResourceConstants.ARGUMENT_BUILDER_NULL_VALIDATOR ),
exp.getMessage( ) );
}

Modified:
trunk/main/util/cli/src/test/net/dpml/cli/builder/DefaultOptionBuilderTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/builder/DefaultOptionBuilderTest.java
2006-01-09 04:12:29 UTC (rev 891)
+++
trunk/main/util/cli/src/test/net/dpml/cli/builder/DefaultOptionBuilderTest.java
2006-01-09 05:06:32 UTC (rev 892)
@@ -31,8 +31,8 @@
*/
public class DefaultOptionBuilderTest extends TestCase
{
- private static final ResourceHelper resources =
ResourceHelper.getResourceHelper( );
- private DefaultOptionBuilder defaultOptionBuilder;
+ private static final ResourceHelper RESOURCES =
ResourceHelper.getResourceHelper( );
+ private DefaultOptionBuilder m_defaultOptionBuilder;

/*
* @see TestCase#setUp()
@@ -44,7 +44,7 @@
*/
protected void setUp( ) throws Exception
{
- this.defaultOptionBuilder = new DefaultOptionBuilder( );
+ m_defaultOptionBuilder = new DefaultOptionBuilder( );
}

/*
@@ -53,7 +53,7 @@
/**
* DOCUMENT ME!
*/
- public void testNew_NullShortPrefix( )
+ public void testNewNullShortPrefix( )
{
try
{
@@ -62,7 +62,7 @@
}
catch( IllegalArgumentException e )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.OPTION_ILLEGAL_SHORT_PREFIX ),
e.getMessage( ) );
}
@@ -74,7 +74,7 @@
/**
* DOCUMENT ME!
*/
- public void testNew_EmptyShortPrefix( )
+ public void testNewEmptyShortPrefix( )
{
try
{
@@ -83,7 +83,7 @@
}
catch( IllegalArgumentException e )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.OPTION_ILLEGAL_SHORT_PREFIX ),
e.getMessage( ) );
}
@@ -95,7 +95,7 @@
/**
* DOCUMENT ME!
*/
- public void testNew_NullLongPrefix( )
+ public void testNewNullLongPrefix( )
{
try
{
@@ -104,7 +104,7 @@
}
catch( IllegalArgumentException e )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.OPTION_ILLEGAL_LONG_PREFIX ),
e.getMessage( ) );
}
@@ -116,7 +116,7 @@
/**
* DOCUMENT ME!
*/
- public void testNew_EmptyLongPrefix( )
+ public void testNewEmptyLongPrefix( )
{
try
{
@@ -125,7 +125,7 @@
}
catch( IllegalArgumentException e )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.OPTION_ILLEGAL_LONG_PREFIX ),
e.getMessage( ) );
}
@@ -138,25 +138,23 @@
{
try
{
- this.defaultOptionBuilder.create( );
+ m_defaultOptionBuilder.create( );
fail( "options must have a name" );
}
catch( IllegalStateException e )
{
- assertEquals( resources.getMessage(
+ assertEquals( RESOURCES.getMessage(
ResourceConstants.OPTION_NO_NAME ), e.getMessage( ) );
}

- this.defaultOptionBuilder.withShortName( "j" );
- this.defaultOptionBuilder.create( );
- this.defaultOptionBuilder.withLongName( "jkeyes" );
- this.defaultOptionBuilder.create( );
+ m_defaultOptionBuilder.withShortName( "j" );
+ m_defaultOptionBuilder.create( );
+ m_defaultOptionBuilder.withLongName( "jkeyes" );
+ m_defaultOptionBuilder.create( );

- {
- DefaultOptionBuilder builder = new DefaultOptionBuilder( "-",
"--",
+ DefaultOptionBuilder builder = new DefaultOptionBuilder( "-", "--",
true );
- builder.withShortName( "mx" );
- }
+ builder.withShortName( "mx" );
}

/**
@@ -165,20 +163,20 @@
public void testName( )
{
// withLongName && this.preferred != null
- {
- this.defaultOptionBuilder.withShortName( "a" );
- this.defaultOptionBuilder.withLongName( "apples" );
- }
+ //{
+ m_defaultOptionBuilder.withShortName( "a" );
+ m_defaultOptionBuilder.withLongName( "apples" );
+ //}
// withShortName && this.preferred != null
- {
- this.defaultOptionBuilder.withLongName( "apples" );
- this.defaultOptionBuilder.withShortName( "a" );
- }
+ //{
+ m_defaultOptionBuilder.withLongName( "apples" );
+ m_defaultOptionBuilder.withShortName( "a" );
+ //}
// withShortName && this.preferred != null
- {
- this.defaultOptionBuilder.withLongName( "apples" );
- this.defaultOptionBuilder.withShortName( "a" );
- }
+ //{
+ m_defaultOptionBuilder.withLongName( "apples" );
+ m_defaultOptionBuilder.withShortName( "a" );
+ //}
}

/**
@@ -187,10 +185,10 @@
public void testWithDescription( )
{
String description = "desc";
- this.defaultOptionBuilder.withShortName( "a" );
- this.defaultOptionBuilder.withDescription( description );
+ m_defaultOptionBuilder.withShortName( "a" );
+ m_defaultOptionBuilder.withDescription( description );

- DefaultOption opt = this.defaultOptionBuilder.create( );
+ DefaultOption opt = m_defaultOptionBuilder.create( );
assertEquals( "wrong description found", description,
opt.getDescription( ) );
}
@@ -198,27 +196,33 @@
/**
* DOCUMENT ME!
*/
- public void testWithRequired( )
+
+ public void testWithRequired2( )
{
- {
- boolean required = false;
- this.defaultOptionBuilder.withShortName( "a" );
- this.defaultOptionBuilder.withRequired( required );
+ doTestWithRequired1();
+ doTestWithRequired2();
+ }
+
+ private void doTestWithRequired1( )
+ {
+ boolean required = false;
+ m_defaultOptionBuilder.withShortName( "a" );
+ m_defaultOptionBuilder.withRequired( required );

- DefaultOption opt = this.defaultOptionBuilder.create( );
- assertEquals( "wrong required found", required, opt.isRequired(
) );
- }
+ DefaultOption opt = m_defaultOptionBuilder.create( );
+ assertEquals( "wrong required found", required, opt.isRequired( ) );
+ }

- {
- boolean required = true;
- this.defaultOptionBuilder.withShortName( "a" );
- this.defaultOptionBuilder.withRequired( required );
+ private void doTestWithRequired2( )
+ {
+ boolean required = true;
+ m_defaultOptionBuilder.withShortName( "a" );
+ m_defaultOptionBuilder.withRequired( required );

- DefaultOption opt = this.defaultOptionBuilder.create( );
- assertEquals( "wrong required found", required, opt.isRequired(
) );
- }
+ DefaultOption opt = m_defaultOptionBuilder.create( );
+ assertEquals( "wrong required found", required, opt.isRequired( ) );
}
-
+
/**
* DOCUMENT ME!
*/
@@ -226,21 +230,19 @@
{
GroupBuilder gbuilder = new GroupBuilder( );

- this.defaultOptionBuilder.withShortName( "a" );
- this.defaultOptionBuilder.withRequired( true );
+ m_defaultOptionBuilder.withShortName( "a" );
+ m_defaultOptionBuilder.withRequired( true );

- DefaultOption opt = this.defaultOptionBuilder.create( );
+ DefaultOption opt = m_defaultOptionBuilder.create( );

Group group = gbuilder.withName( "withchildren" ).withOption( opt )
.create( );

- {
- this.defaultOptionBuilder.withShortName( "b" );
- this.defaultOptionBuilder.withChildren( group );
+ m_defaultOptionBuilder.withShortName( "b" );
+ m_defaultOptionBuilder.withChildren( group );

- DefaultOption option = this.defaultOptionBuilder.create( );
- assertEquals( "wrong children found", group, option.getChildren(
) );
- }
+ DefaultOption option = m_defaultOptionBuilder.create( );
+ assertEquals( "wrong children found", group, option.getChildren( )
);
}

/**
@@ -253,11 +255,11 @@

Argument arg = abuilder.create( );

- this.defaultOptionBuilder.withShortName( "a" );
- this.defaultOptionBuilder.withRequired( true );
- this.defaultOptionBuilder.withArgument( arg );
+ m_defaultOptionBuilder.withShortName( "a" );
+ m_defaultOptionBuilder.withRequired( true );
+ m_defaultOptionBuilder.withArgument( arg );

- DefaultOption opt = this.defaultOptionBuilder.create( );
+ DefaultOption opt = m_defaultOptionBuilder.create( );

assertEquals( "wrong argument found", arg, opt.getArgument( ) );
}
@@ -267,10 +269,10 @@
*/
public void testWithId( )
{
- this.defaultOptionBuilder.withShortName( "a" );
- this.defaultOptionBuilder.withId( 0 );
+ m_defaultOptionBuilder.withShortName( "a" );
+ m_defaultOptionBuilder.withId( 0 );

- DefaultOption opt = this.defaultOptionBuilder.create( );
+ DefaultOption opt = m_defaultOptionBuilder.create( );

assertEquals( "wrong id found", 0, opt.getId( ) );
}

Modified:
trunk/main/util/cli/src/test/net/dpml/cli/commandline/DefaultingCommandLineTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/commandline/DefaultingCommandLineTest.java
2006-01-09 04:12:29 UTC (rev 891)
+++
trunk/main/util/cli/src/test/net/dpml/cli/commandline/DefaultingCommandLineTest.java
2006-01-09 05:06:32 UTC (rev 892)
@@ -31,13 +31,13 @@
*/
public class DefaultingCommandLineTest extends AbstractCommandLineTestCase
{
- private CommandLine first;
- private CommandLine second;
- private Option inFirst = new DefaultOptionBuilder( ).withLongName(
+ private CommandLine m_first;
+ private CommandLine m_second;
+ private Option m_inFirst = new DefaultOptionBuilder( ).withLongName(
"infirst" ).create( );
- private Option inBoth = new DefaultOptionBuilder( ).withLongName(
"inboth" )
+ private Option m_inBoth = new DefaultOptionBuilder( ).withLongName(
"inboth" )
.create( );
- private Option inSecond = new DefaultOptionBuilder( ).withLongName(
+ private Option m_inSecond = new DefaultOptionBuilder( ).withLongName(
"insecond" ).create( );

/* (non-Javadoc)
@@ -79,30 +79,30 @@
WriteableCommandLine writeable;

writeable = new WriteableCommandLineImpl( m_root, new ArrayList( )
);
- writeable.addOption( inFirst );
- writeable.addOption( inBoth );
- writeable.addProperty( "infirst", "infirst first value" );
- writeable.addProperty( "inboth", "inboth first value" );
- writeable.addSwitch( inFirst, true );
- writeable.addSwitch( inBoth, true );
- writeable.addValue( inFirst, "infirst first value 1" );
- writeable.addValue( inFirst, "infirst first value 2" );
- writeable.addValue( inBoth, "inboth first value 1" );
- writeable.addValue( inBoth, "inboth first value 2" );
- first = writeable;
+ writeable.addOption( m_inFirst );
+ writeable.addOption( m_inBoth );
+ writeable.addProperty( "infirst", "infirst m_first value" );
+ writeable.addProperty( "inboth", "inboth m_first value" );
+ writeable.addSwitch( m_inFirst, true );
+ writeable.addSwitch( m_inBoth, true );
+ writeable.addValue( m_inFirst, "infirst m_first value 1" );
+ writeable.addValue( m_inFirst, "infirst m_first value 2" );
+ writeable.addValue( m_inBoth, "inboth m_first value 1" );
+ writeable.addValue( m_inBoth, "inboth m_first value 2" );
+ m_first = writeable;

writeable = new WriteableCommandLineImpl( m_root, new ArrayList( )
);
- writeable.addOption( inSecond );
- writeable.addOption( inBoth );
- writeable.addProperty( "insecond", "insecond second value" );
- writeable.addProperty( "inboth", "inboth second value" );
- writeable.addSwitch( inSecond, true );
- writeable.addSwitch( inBoth, true );
- writeable.addValue( inSecond, "insecond second value 1" );
- writeable.addValue( inSecond, "insecond second value 2" );
- writeable.addValue( inBoth, "inboth second value 1" );
- writeable.addValue( inBoth, "inboth second value 2" );
- second = writeable;
+ writeable.addOption( m_inSecond );
+ writeable.addOption( m_inBoth );
+ writeable.addProperty( "insecond", "insecond m_second value" );
+ writeable.addProperty( "inboth", "inboth m_second value" );
+ writeable.addSwitch( m_inSecond, true );
+ writeable.addSwitch( m_inBoth, true );
+ writeable.addValue( m_inSecond, "insecond m_second value 1" );
+ writeable.addValue( m_inSecond, "insecond m_second value 2" );
+ writeable.addValue( m_inBoth, "inboth m_second value 1" );
+ writeable.addValue( m_inBoth, "inboth m_second value 2" );
+ m_second = writeable;
}

/**
@@ -116,15 +116,15 @@
i = defaults.commandLines( );
assertFalse( i.hasNext( ) );

- defaults.appendCommandLine( first );
+ defaults.appendCommandLine( m_first );
i = defaults.commandLines( );
- assertSame( first, i.next( ) );
+ assertSame( m_first, i.next( ) );
assertFalse( i.hasNext( ) );

- defaults.appendCommandLine( second );
+ defaults.appendCommandLine( m_second );
i = defaults.commandLines( );
- assertSame( first, i.next( ) );
- assertSame( second, i.next( ) );
+ assertSame( m_first, i.next( ) );
+ assertSame( m_second, i.next( ) );
assertFalse( i.hasNext( ) );
}

@@ -139,15 +139,15 @@
i = defaults.commandLines( );
assertFalse( i.hasNext( ) );

- defaults.insertCommandLine( 0, first );
+ defaults.insertCommandLine( 0, m_first );
i = defaults.commandLines( );
- assertSame( first, i.next( ) );
+ assertSame( m_first, i.next( ) );
assertFalse( i.hasNext( ) );

- defaults.insertCommandLine( 0, second );
+ defaults.insertCommandLine( 0, m_second );
i = defaults.commandLines( );
- assertSame( second, i.next( ) );
- assertSame( first, i.next( ) );
+ assertSame( m_second, i.next( ) );
+ assertSame( m_first, i.next( ) );
assertFalse( i.hasNext( ) );
}

@@ -157,8 +157,8 @@
public void testTriggers( )
{
final DefaultingCommandLine defaults = new DefaultingCommandLine( );
- defaults.appendCommandLine( first );
- defaults.appendCommandLine( second );
+ defaults.appendCommandLine( m_first );
+ defaults.appendCommandLine( m_second );

Set set = defaults.getOptionTriggers( );
Iterator iter = set.iterator( );

Modified: trunk/main/util/cli/src/test/net/dpml/cli/option/ArgumentTest.java
===================================================================
--- trunk/main/util/cli/src/test/net/dpml/cli/option/ArgumentTest.java
2006-01-09 04:12:29 UTC (rev 891)
+++ trunk/main/util/cli/src/test/net/dpml/cli/option/ArgumentTest.java
2006-01-09 05:06:32 UTC (rev 892)
@@ -79,7 +79,6 @@
ArgumentImpl.DEFAULT_CONSUME_REMAINING, null, 0 );
}

- //public static Argument buildDateLimitArgument() {
/**
* DOCUMENT ME!
*
@@ -418,12 +417,14 @@
*/
public void testRequired( )
{
+ if( true )
{
final Argument arg = buildBoundsArgument( );

assertTrue( "not required", arg.isRequired( ) );
}

+ if( true )
{
final Argument arg = buildTargetsArgument( );


Modified:
trunk/main/util/cli/src/test/net/dpml/cli/validation/DateValidatorTest.java
===================================================================
---
trunk/main/util/cli/src/test/net/dpml/cli/validation/DateValidatorTest.java
2006-01-09 04:12:29 UTC (rev 891)
+++
trunk/main/util/cli/src/test/net/dpml/cli/validation/DateValidatorTest.java
2006-01-09 05:06:32 UTC (rev 892)
@@ -191,6 +191,7 @@
final DateValidator validator = new DateValidator( m_formats );
final Calendar cal = Calendar.getInstance( );

+ if( true )
{
final Object[] array = new Object[]{"23/12/03", "2002-10-12"};
final List list = Arrays.asList( array );
@@ -204,6 +205,7 @@
validator.validate( list );
}

+ if( true )
{
final Object[] array = new Object[]{"23/12/03", "2002-10-12"};
final List list = Arrays.asList( array );
@@ -252,6 +254,7 @@
final DateValidator validator = new DateValidator( m_formats );
final Calendar cal = Calendar.getInstance( );

+ if( true )
{
final Object[] array = new Object[]{"23/12/03", "2002-10-12"};
final List list = Arrays.asList( array );
@@ -265,6 +268,7 @@
validator.validate( list );
}

+ if( true )
{
final Object[] array = new Object[]{"23/12/03", "2004-10-12"};
final List list = Arrays.asList( array );




  • r892 - in trunk/main/util/cli/src/test/net/dpml/cli: . application bug builder commandline option validation, mcconnell at BerliOS, 01/09/2006

Archive powered by MHonArc 2.6.24.

Top of Page