Author: jgray
Date: Thu Sep 30 20:58:07 2010
New Revision: 1003256
URL: http://svn.apache.org/viewvc?rev=1003256&view=rev
Log:
HBASE-3058 Fix REST tests on trunk
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java
Modified: hbase/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1003256&r1=1003255&r2=1003256&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Sep 30 20:58:07 2010
@@ -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
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java?rev=1003256&r1=1003255&r2=1003256&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java Thu
Sep 30 20:58:07 2010
@@ -59,11 +59,33 @@ public class RESTServlet implements Cons
}
/**
+ * @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);
}
Modified:
hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java?rev=1003256&r1=1003255&r2=1003256&view=diff
==============================================================================
---
hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java
(original)
+++
hbase/trunk/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTClusterTestBase.java
Thu Sep 30 20:58:07 2010
@@ -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 ex
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(