소스 검색

HDFS-5468. CacheAdmin help command does not recognize commands (Stephen Chu via Colin Patrick McCabe)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1539786 13f79535-47bb-0310-9956-ffa450edef68
Colin McCabe 11 년 전
부모
커밋
77afc605fd

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -354,6 +354,9 @@ Trunk (Unreleased)
 
     HDFS-5419. Fixup test-patch.sh warnings on HDFS-4949 branch. (wang)
 
+    HDFS-5468. CacheAdmin help command does not recognize commands  (Stephen
+    Chu via Colin Patrick McCabe)
+
 Release 2.3.0 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 2 - 3
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/CacheAdmin.java

@@ -261,13 +261,13 @@ public class CacheAdmin extends Configured implements Tool {
 
     @Override
     public String getShortUsage() {
-      return "[" + getName() + " <path>]\n";
+      return "[" + getName() + " -path <path>]\n";
     }
 
     @Override
     public String getLongUsage() {
       TableListing listing = getOptionDescriptionListing();
-      listing.addRow("<path>", "The path of the cache directives to remove.  " +
+      listing.addRow("-path <path>", "The path of the cache directives to remove.  " +
         "You must have write permission on the pool of the directive in order " +
         "to remove it.  To see a list of cache directives, use the " +
         "-listDirectives command.");
@@ -720,7 +720,6 @@ public class CacheAdmin extends Configured implements Tool {
         return 0;
       }
       String commandName = args.get(0);
-      commandName = commandName.replaceAll("^[-]*", "");
       Command command = determineCommand(commandName);
       if (command == null) {
         System.err.print("Sorry, I don't know the command '" +

+ 15 - 0
hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml

@@ -358,5 +358,20 @@
       </comparators>
     </test>
 
+    <test>
+      <description>Testing the help usage</description>
+      <test-commands>
+        <cache-admin-command>-help -addPool</cache-admin-command>
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>SubstringComparator</type>
+          <expected-output>Add a new cache pool.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+
   </tests>
 </configuration>