accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1478069 - /accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/util/shell/TableDiskUsageTest.java
Date Wed, 01 May 2013 16:08:09 GMT
Author: ecn
Date: Wed May  1 16:08:09 2013
New Revision: 1478069

URL: http://svn.apache.org/r1478069
Log:
ACCUMULO-1334 add disk usage to the API

Added:
    accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/util/shell/TableDiskUsageTest.java
  (with props)

Added: accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/util/shell/TableDiskUsageTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/util/shell/TableDiskUsageTest.java?rev=1478069&view=auto
==============================================================================
--- accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/util/shell/TableDiskUsageTest.java
(added)
+++ accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/util/shell/TableDiskUsageTest.java
Wed May  1 16:08:09 2013
@@ -0,0 +1,23 @@
+package org.apache.accumulo.core.util.shell;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.accumulo.core.util.TableDiskUsage;
+import org.junit.Test;
+
+public class TableDiskUsageTest {
+  
+  @Test
+  public void testHumanReadableBytes() {
+    assertEquals("1000B", TableDiskUsage.humanReadableBytes(1000));
+    assertEquals(" 1.0K", TableDiskUsage.humanReadableBytes(1024));
+    assertEquals(" 1.5K", TableDiskUsage.humanReadableBytes(1024 + (1024 / 2)));
+    assertEquals("1024K", TableDiskUsage.humanReadableBytes(1024 * 1024 - 1));
+    assertEquals(" 1.0M", TableDiskUsage.humanReadableBytes(1024 * 1024));
+    assertEquals(" 1.5M", TableDiskUsage.humanReadableBytes(1024 * 1024 + (1024 * 1024 /
2)));
+    assertEquals("1024M", TableDiskUsage.humanReadableBytes(1073741823));
+    assertEquals(" 1.0G", TableDiskUsage.humanReadableBytes(1073741824));
+    assertEquals("1024G", TableDiskUsage.humanReadableBytes(1099511627775l));
+    assertEquals(" 1.0T", TableDiskUsage.humanReadableBytes(1099511627776l));
+  }
+}

Propchange: accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/util/shell/TableDiskUsageTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message