You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by wa...@apache.org on 2016/08/23 17:32:20 UTC

[16/50] [abbrv] hadoop git commit: HDFS-10783. The option '-maxSize' and '-step' fail in OfflineImageViewer. Contributed by Yiqun Lin.

HDFS-10783. The option '-maxSize' and '-step' fail in OfflineImageViewer. Contributed by Yiqun Lin.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e90f3359
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e90f3359
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e90f3359

Branch: refs/heads/YARN-3368
Commit: e90f3359de299ef5e3a54ca71070e3dfe1dbb98c
Parents: 0d5997d
Author: Akira Ajisaka <aa...@apache.org>
Authored: Tue Aug 23 19:56:27 2016 +0900
Committer: Akira Ajisaka <aa...@apache.org>
Committed: Tue Aug 23 19:57:23 2016 +0900

----------------------------------------------------------------------
 .../offlineImageViewer/OfflineImageViewer.java   |  2 ++
 .../TestOfflineImageViewer.java                  | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e90f3359/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageViewer.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageViewer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageViewer.java
index 7f81ba8..770cde1 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageViewer.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageViewer.java
@@ -186,6 +186,8 @@ public class OfflineImageViewer {
     
     options.addOption("p", "processor", true, "");
     options.addOption("h", "help", false, "");
+    options.addOption("maxSize", true, "");
+    options.addOption("step", true, "");
     options.addOption("skipBlocks", false, "");
     options.addOption("printToScreen", false, "");
     options.addOption("delimiter", true, "");

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e90f3359/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java
index b9aa7f3..a7c30ec 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java
@@ -601,4 +601,23 @@ public class TestOfflineImageViewer {
             "FileDistribution", "-maxSize", "23", "-step", "4"});
     assertEquals(0, status);
   }
+
+  @Test
+  public void testOfflineImageViewerMaxSizeAndStepOptions() throws Exception {
+    final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+    final PrintStream out = new PrintStream(bytes);
+    final PrintStream oldOut = System.out;
+    try {
+      System.setOut(out);
+      // Add the -h option to make the test only for option parsing,
+      // and don't need to do the following operations.
+      OfflineImageViewer.main(new String[] {"-i", "-", "-o", "-", "-p",
+          "FileDistribution", "-maxSize", "512", "-step", "8", "-h"});
+      Assert.assertFalse(bytes.toString().contains(
+          "Error parsing command-line options: "));
+    } finally {
+      System.setOut(oldOut);
+      IOUtils.closeStream(out);
+    }
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org