HBASE-9909 TestHFilePerformance should not be a unit test, but a tool

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1539766 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Enis Soztutar 2013-11-07 19:10:25 +00:00
parent a01ff38061
commit 3c55ae85c4
1 changed files with 34 additions and 14 deletions

View File

@ -23,21 +23,21 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Random; import java.util.Random;
import junit.framework.TestCase; import org.apache.commons.cli.CommandLine;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.MediumTests; import org.apache.hadoop.hbase.util.AbstractHBaseTool;
import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.SequenceFile; import org.apache.hadoop.io.SequenceFile;
import org.apache.hadoop.io.compress.CompressionCodec; import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.io.compress.GzipCodec; import org.apache.hadoop.io.compress.GzipCodec;
import org.junit.experimental.categories.Category; import org.apache.hadoop.util.ToolRunner;
/** /**
* Set of long-running tests to measure performance of HFile. * Set of long-running tests to measure performance of HFile.
@ -47,22 +47,25 @@ import org.junit.experimental.categories.Category;
* Remove after tfile is committed and use the tfile version of this class * Remove after tfile is committed and use the tfile version of this class
* instead.</p> * instead.</p>
*/ */
@Category(MediumTests.class) public class TestHFilePerformance extends AbstractHBaseTool {
public class TestHFilePerformance extends TestCase { private HBaseTestingUtility TEST_UTIL;
private static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static String ROOT_DIR;
private static String ROOT_DIR =
TEST_UTIL.getDataTestDir("TestHFilePerformance").toString();
private FileSystem fs; private FileSystem fs;
private Configuration conf;
private long startTimeEpoch; private long startTimeEpoch;
private long finishTimeEpoch; private long finishTimeEpoch;
private DateFormat formatter; private DateFormat formatter;
@Override @Override
public void setUp() throws IOException { public void setConf(Configuration conf) {
conf = new Configuration(); super.setConf(conf);
fs = FileSystem.get(conf); try {
fs = FileSystem.get(conf);
} catch (IOException e) {
throw new RuntimeException(e);
}
formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
TEST_UTIL = new HBaseTestingUtility(conf);
ROOT_DIR = TEST_UTIL.getDataTestDir("TestHFilePerformance").toString();
} }
public void startTime() { public void startTime() {
@ -394,5 +397,22 @@ public class TestHFilePerformance extends TestCase {
" better number."); " better number.");
} }
} @Override
protected void addOptions() {
}
@Override
protected void processOptions(CommandLine cmd) {
}
@Override
protected int doWork() throws Exception {
testRunComparisons();
return 0;
}
public static void main(String[] args) throws Exception {
int ret = ToolRunner.run(HBaseConfiguration.create(), new TestHFilePerformance(), args);
System.exit(ret);
}
}