From d1176f5791fe8eac43c2ffde48fda7c989646f26 Mon Sep 17 00:00:00 2001 From: Andrew Kyle Purtell Date: Fri, 4 Feb 2011 17:35:51 +0000 Subject: [PATCH] HBASE-2824 A filter that randomly includes rows based on a configured chance; Clarify test git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1067235 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop/hbase/filter/TestRandomRowFilter.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/apache/hadoop/hbase/filter/TestRandomRowFilter.java b/src/test/java/org/apache/hadoop/hbase/filter/TestRandomRowFilter.java index 80145421080..c36e21c7578 100644 --- a/src/test/java/org/apache/hadoop/hbase/filter/TestRandomRowFilter.java +++ b/src/test/java/org/apache/hadoop/hbase/filter/TestRandomRowFilter.java @@ -30,12 +30,12 @@ import junit.framework.TestCase; import org.apache.hadoop.hbase.util.Bytes; public class TestRandomRowFilter extends TestCase { - protected RandomRowFilter halfChanceFilter; + protected RandomRowFilter quarterChanceFilter; @Override protected void setUp() throws Exception { super.setUp(); - halfChanceFilter = new RandomRowFilter(0.25f); + quarterChanceFilter = new RandomRowFilter(0.25f); } /** @@ -47,7 +47,7 @@ public class TestRandomRowFilter extends TestCase { int included = 0; int max = 1000000; for (int i = 0; i < max; i++) { - if (!halfChanceFilter.filterRowKey(Bytes.toBytes("row"), 0, Bytes + if (!quarterChanceFilter.filterRowKey(Bytes.toBytes("row"), 0, Bytes .toBytes("row").length)) { included++; } @@ -66,10 +66,10 @@ public class TestRandomRowFilter extends TestCase { * @throws Exception */ public void testSerialization() throws Exception { - RandomRowFilter newFilter = serializationTest(halfChanceFilter); + RandomRowFilter newFilter = serializationTest(quarterChanceFilter); // use epsilon float comparison assertTrue("float should be equal", Math.abs(newFilter.getChance() - - halfChanceFilter.getChance()) < 0.000001f); + - quarterChanceFilter.getChance()) < 0.000001f); } private RandomRowFilter serializationTest(RandomRowFilter filter)