You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/11/06 20:00:14 UTC

svn commit: r592524 - in /incubator/cxf/trunk/tools/common/src: main/java/org/apache/cxf/tools/common/toolspec/parser/ test/java/org/apache/cxf/tools/common/toolspec/parser/ test/java/org/apache/cxf/tools/common/toolspec/parser/resources/

Author: dkulp
Date: Tue Nov  6 11:00:13 2007
New Revision: 592524

URL: http://svn.apache.org/viewvc?rev=592524&view=rev
Log:
Last minute fix to fix the output of the -? on the command line tools

Modified:
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
    incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParserTest.java
    incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/resources/testtool.xml

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java?rev=592524&r1=592523&r2=592524&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java Tue Nov  6 11:00:13 2007
@@ -230,10 +230,9 @@
                 addWhiteNamespace(strbuffer, optSpan - originalStrs[j].length());
                 strbuffer.append(" ");
                 if (originalStrs[j + 1].length() > totalLen - beforeDesSpan) {
-                    String tmp = originalStrs[j + 1].substring(0, totalLen - beforeDesSpan);
-                    strbuffer.append(tmp);
-                    originalStrs[j + 1] = originalStrs[j + 1].substring(totalLen - beforeDesSpan, 
-                                                                        originalStrs[j + 1].length());
+                    int lastIdx = totalLen - beforeDesSpan; 
+                    int lastIdx2 = splitAndAppendText(strbuffer, originalStrs[j + 1], 0, lastIdx);
+                    originalStrs[j + 1] = originalStrs[j + 1].substring(lastIdx2);
                     strbuffer.append(lineSeparator);
                 } else {
                     strbuffer.append(originalStrs[j + 1]);

Modified: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParserTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParserTest.java?rev=592524&r1=592523&r2=592524&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParserTest.java (original)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParserTest.java Tue Nov  6 11:00:13 2007
@@ -265,7 +265,8 @@
         String[] expected = new String[]{"[ -n <C++ Namespace> ]",
                                          "Namespace",
                                          "[ -impl ]",
-                                         "impl",
+                                         "impl - the impl that will be used by this tool to do "
+                                         + "whatever it is this tool does.",
                                          "[ -e <Enum Value> ]",
                                          "enum",
                                          "-r",
@@ -310,13 +311,15 @@
         String usage = parser.getFormattedDetailedUsage();
         assertNotNull(usage);
         StringTokenizer st1 = new StringTokenizer(usage, System.getProperty("line.separator"));
-        assertEquals(13, st1.countTokens());
+        assertEquals(14, st1.countTokens());
         
         while (st1.hasMoreTokens()) {
             String s = st1.nextToken();
             if (s.indexOf("java package") != -1) {
                 s = s.trim();
                 assertTrue(s.charAt(s.length() - 1) != 'o');
+            } else if (s.indexOf("impl - the") != -1) {
+                assertTrue(s.charAt(s.length() - 1) == 'o');
             }
         }
         

Modified: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/resources/testtool.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/resources/testtool.xml?rev=592524&r1=592523&r2=592524&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/resources/testtool.xml (original)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/parser/resources/testtool.xml Tue Nov  6 11:00:13 2007
@@ -39,6 +39,7 @@
       </option>
       
       <option id="impl" minOccurs="0">
+	<annotation>impl - the impl that will be used by this tool to do whatever it is this tool does.</annotation>
 	<switch>impl</switch>
       </option>