HBASE-3058 Fix REST tests on trunk

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1003256 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Gray 2010-09-30 20:58:07 +00:00
parent 8863ae5a0e
commit 69d1258e12
3 changed files with 28 additions and 1 deletions

View File

@ -558,6 +558,7 @@ Release 0.21.0 - Unreleased
condition
HBASE-3057 Race condition when closing regions that causes flakiness in
TestRestartCluster
HBASE-3058 Fix REST tests on trunk
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -58,12 +58,34 @@ public class RESTServlet implements Constants {
return instance;
}
/**
* @param conf Existing configuration to use in rest servlet
* @return the RESTServlet singleton instance
* @throws IOException
*/
public synchronized static RESTServlet getInstance(Configuration conf)
throws IOException {
if (instance == null) {
instance = new RESTServlet(conf);
}
return instance;
}
/**
* Constructor
* @throws IOException
*/
public RESTServlet() throws IOException {
this.conf = HBaseConfiguration.create();
this(HBaseConfiguration.create());
}
/**
* Constructor with existing configuration
* @param conf existing configuration
* @throws IOException.
*/
public RESTServlet(Configuration conf) throws IOException {
this.conf = conf;
this.pool = new HTablePool(conf, 10);
}

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.rest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClusterTestCase;
import org.apache.hadoop.util.StringUtils;
import org.mortbay.jetty.Server;
@ -54,6 +55,9 @@ public class HBaseRESTClusterTestBase extends HBaseClusterTestCase
return;
}
// Inject the conf from the test cluster by being first to make singleton
RESTServlet.getInstance(super.conf);
// set up the Jersey servlet container for Jetty
ServletHolder sh = new ServletHolder(ServletContainer.class);
sh.setInitParameter(