From f6ae53870f2cec77c5f784aa63727a8c2c6eac83 Mon Sep 17 00:00:00 2001 From: Zhihong Yu Date: Tue, 11 Mar 2014 23:28:47 +0000 Subject: [PATCH] HBASE-10723 Convert TestExplicitColumnTracker to junit4 test git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1576542 13f79535-47bb-0310-9956-ffa450edef68 --- .../TestExplicitColumnTracker.java | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java index c259312b41d..2dbf27933be 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java @@ -19,6 +19,8 @@ package org.apache.hadoop.hbase.regionserver; +import static org.junit.Assert.assertEquals; + import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -28,12 +30,12 @@ import java.util.Arrays; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; import org.apache.hadoop.hbase.util.Bytes; +import org.junit.Test; import org.junit.experimental.categories.Category; @Category(SmallTests.class) -public class TestExplicitColumnTracker extends HBaseTestCase { - private boolean PRINT = false; +public class TestExplicitColumnTracker { private final byte[] col1 = Bytes.toBytes("col1"); private final byte[] col2 = Bytes.toBytes("col2"); @@ -62,18 +64,11 @@ public class TestExplicitColumnTracker extends HBaseTestCase { assertEquals(expected.size(), result.size()); for(int i=0; i< expected.size(); i++){ assertEquals(expected.get(i), result.get(i)); - if(PRINT){ - System.out.println("Expected " +expected.get(i) + ", actual " + - result.get(i)); - } } } + @Test public void testGet_SingleVersion() throws IOException{ - if(PRINT){ - System.out.println("SingleVersion"); - } - //Create tracker TreeSet columns = new TreeSet(Bytes.BYTES_COMPARATOR); //Looking for every other @@ -98,11 +93,8 @@ public class TestExplicitColumnTracker extends HBaseTestCase { runTest(maxVersions, columns, scanner, expected, 0); } + @Test public void testGet_MultiVersion() throws IOException{ - if(PRINT){ - System.out.println("\nMultiVersion"); - } - //Create tracker TreeSet columns = new TreeSet(Bytes.BYTES_COMPARATOR); //Looking for every other @@ -153,11 +145,8 @@ public class TestExplicitColumnTracker extends HBaseTestCase { runTest(maxVersions, columns, scanner, expected, 0); } + @Test public void testGet_MultiVersionWithLookAhead() throws IOException{ - if(PRINT){ - System.out.println("\nMultiVersion"); - } - //Create tracker TreeSet columns = new TreeSet(Bytes.BYTES_COMPARATOR); //Looking for every other @@ -211,6 +200,7 @@ public class TestExplicitColumnTracker extends HBaseTestCase { /** * hbase-2259 */ + @Test public void testStackOverflow() throws IOException{ int maxVersions = 1; TreeSet columns = new TreeSet(Bytes.BYTES_COMPARATOR); @@ -237,6 +227,7 @@ public class TestExplicitColumnTracker extends HBaseTestCase { /** * Regression test for HBASE-2545 */ + @Test public void testInfiniteLoop() throws IOException { TreeSet columns = new TreeSet(Bytes.BYTES_COMPARATOR); columns.addAll(Arrays.asList(new byte[][] {