You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2014/04/18 00:42:03 UTC

git commit: ACCUMULO-2690 expanding test to validate giant read as well

Repository: accumulo
Updated Branches:
  refs/heads/1.6.0-SNAPSHOT 8e3dc7b47 -> 8d6432bec


ACCUMULO-2690 expanding test to validate giant read as well


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 8d6432bec3d479eb15c3609a66b588ccfc7e5308
Parents: 8e3dc7b
Author: John Vines <vi...@apache.org>
Authored: Thu Apr 17 18:41:39 2014 -0400
Committer: John Vines <vi...@apache.org>
Committed: Thu Apr 17 18:41:39 2014 -0400

----------------------------------------------------------------------
 .../core/security/crypto/BlockedIOStreamTest.java       | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/8d6432be/core/src/test/java/org/apache/accumulo/core/security/crypto/BlockedIOStreamTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/security/crypto/BlockedIOStreamTest.java b/core/src/test/java/org/apache/accumulo/core/security/crypto/BlockedIOStreamTest.java
index a116110..17a20da 100644
--- a/core/src/test/java/org/apache/accumulo/core/security/crypto/BlockedIOStreamTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/security/crypto/BlockedIOStreamTest.java
@@ -17,6 +17,7 @@
 package org.apache.accumulo.core.security.crypto;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertArrayEquals;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -136,7 +137,16 @@ public class BlockedIOStreamTest {
     baos.close();
 
     int blocks = (int) Math.ceil(size / (blockSize - 4.0));
-    assertEquals(blocks * 16, baos.toByteArray().length);
+    byte[] byteStream = baos.toByteArray();
+
+    assertEquals(blocks * 16, byteStream.length);
+
+    DataInputStream blockIn = new DataInputStream(new BlockedInputStream(new ByteArrayInputStream(byteStream), blockSize, blockSize));
+    byte[] giantRead = new byte[size];
+    blockIn.readFully(giantRead, 0, size);
+    blockIn.close();
+
+    assertArrayEquals(giant, giantRead);
   }
 
 }