HBASE-3195 [rest] Fix TestTransform breakage on Hudson

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1031928 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Kyle Purtell 2010-11-06 02:05:03 +00:00
parent 374723813f
commit 7975f85146
14 changed files with 31 additions and 44 deletions

View File

@ -656,6 +656,7 @@ Release 0.21.0 - Unreleased
HBASE-3203 We can get an order to open a region while shutting down HBASE-3203 We can get an order to open a region while shutting down
and it'll hold up regionserver shutdown and it'll hold up regionserver shutdown
HBASE-3204 Reenable deferred log flush HBASE-3204 Reenable deferred log flush
HBASE-3195 [rest] Fix TestTransform breakage on Hudson
IMPROVEMENTS IMPROVEMENTS
@ -1114,6 +1115,7 @@ Release 0.21.0 - Unreleased
HBASE-3201 Add accounting of empty regioninfo_qualifier rows in meta to HBASE-3201 Add accounting of empty regioninfo_qualifier rows in meta to
hbasefsck. hbasefsck.
NEW FEATURES NEW FEATURES
HBASE-1961 HBase EC2 scripts HBASE-1961 HBase EC2 scripts
HBASE-1982 [EC2] Handle potentially large and uneven instance startup times HBASE-1982 [EC2] Handle potentially large and uneven instance startup times

View File

@ -28,6 +28,8 @@ import org.apache.commons.cli.PosixParser;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -97,7 +99,8 @@ public class Main implements Constants {
// set up Jetty and run the embedded server // set up Jetty and run the embedded server
RESTServlet servlet = RESTServlet.getInstance(); Configuration conf = HBaseConfiguration.create();
RESTServlet servlet = RESTServlet.getInstance(conf);
port = servlet.getConfiguration().getInt("hbase.rest.port", port); port = servlet.getConfiguration().getInt("hbase.rest.port", port);
Server server = new Server(port); Server server = new Server(port);

View File

@ -23,7 +23,6 @@ package org.apache.hadoop.hbase.rest;
import java.io.IOException; import java.io.IOException;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HTablePool; import org.apache.hadoop.hbase.client.HTablePool;
import org.apache.hadoop.hbase.rest.metrics.RESTMetrics; import org.apache.hadoop.hbase.rest.metrics.RESTMetrics;
@ -41,9 +40,7 @@ public class RESTServlet implements Constants {
* @throws IOException * @throws IOException
*/ */
public synchronized static RESTServlet getInstance() throws IOException { public synchronized static RESTServlet getInstance() throws IOException {
if (INSTANCE == null) { assert(INSTANCE != null);
INSTANCE = new RESTServlet();
}
return INSTANCE; return INSTANCE;
} }
@ -64,14 +61,6 @@ public class RESTServlet implements Constants {
if (INSTANCE != null) INSTANCE = null; if (INSTANCE != null) INSTANCE = null;
} }
/**
* Constructor
* @throws IOException
*/
RESTServlet() throws IOException {
this(HBaseConfiguration.create());
}
/** /**
* Constructor with existing configuration * Constructor with existing configuration
* @param conf existing configuration * @param conf existing configuration

View File

@ -33,19 +33,14 @@ public class HBaseRESTTestingUtility {
static final Log LOG = LogFactory.getLog(HBaseRESTTestingUtility.class); static final Log LOG = LogFactory.getLog(HBaseRESTTestingUtility.class);
private Configuration conf;
private int testServletPort; private int testServletPort;
private Server server; private Server server;
public HBaseRESTTestingUtility(Configuration conf) {
this.conf = conf;
}
public int getServletPort() { public int getServletPort() {
return testServletPort; return testServletPort;
} }
public void startServletContainer() throws Exception { public void startServletContainer(Configuration conf) throws Exception {
if (server != null) { if (server != null) {
LOG.error("ServletContainer already running"); LOG.error("ServletContainer already running");
return; return;

View File

@ -66,7 +66,7 @@ public class TestRowResource {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final HBaseRESTTestingUtility REST_TEST_UTIL = private static final HBaseRESTTestingUtility REST_TEST_UTIL =
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration()); new HBaseRESTTestingUtility();
private static Client client; private static Client client;
private static JAXBContext context; private static JAXBContext context;
private static Marshaller marshaller; private static Marshaller marshaller;
@ -75,7 +75,7 @@ public class TestRowResource {
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniCluster(3);
REST_TEST_UTIL.startServletContainer(); REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
context = JAXBContext.newInstance( context = JAXBContext.newInstance(
CellModel.class, CellModel.class,
CellSetModel.class, CellSetModel.class,

View File

@ -63,7 +63,7 @@ public class TestScannerResource {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final HBaseRESTTestingUtility REST_TEST_UTIL = private static final HBaseRESTTestingUtility REST_TEST_UTIL =
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration()); new HBaseRESTTestingUtility();
private static Client client; private static Client client;
private static JAXBContext context; private static JAXBContext context;
private static Marshaller marshaller; private static Marshaller marshaller;
@ -147,7 +147,7 @@ public class TestScannerResource {
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniCluster(3);
REST_TEST_UTIL.startServletContainer(); REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
client = new Client(new Cluster().add("localhost", client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort())); REST_TEST_UTIL.getServletPort()));
context = JAXBContext.newInstance( context = JAXBContext.newInstance(

View File

@ -108,7 +108,7 @@ public class TestScannersWithFilters {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final HBaseRESTTestingUtility REST_TEST_UTIL = private static final HBaseRESTTestingUtility REST_TEST_UTIL =
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration()); new HBaseRESTTestingUtility();
private static Client client; private static Client client;
private static JAXBContext context; private static JAXBContext context;
private static Marshaller marshaller; private static Marshaller marshaller;
@ -119,7 +119,7 @@ public class TestScannersWithFilters {
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniCluster(3);
REST_TEST_UTIL.startServletContainer(); REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
context = JAXBContext.newInstance( context = JAXBContext.newInstance(
CellModel.class, CellModel.class,
CellSetModel.class, CellSetModel.class,

View File

@ -48,14 +48,14 @@ public class TestSchemaResource {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final HBaseRESTTestingUtility REST_TEST_UTIL = private static final HBaseRESTTestingUtility REST_TEST_UTIL =
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration()); new HBaseRESTTestingUtility();
private static Client client; private static Client client;
private static JAXBContext context; private static JAXBContext context;
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniCluster(3);
REST_TEST_UTIL.startServletContainer(); REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
client = new Client(new Cluster().add("localhost", client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort())); REST_TEST_UTIL.getServletPort()));
context = JAXBContext.newInstance( context = JAXBContext.newInstance(

View File

@ -44,16 +44,15 @@ public class TestStatusResource {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final HBaseRESTTestingUtility REST_TEST_UTIL = private static final HBaseRESTTestingUtility REST_TEST_UTIL =
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration()); new HBaseRESTTestingUtility();
private static Client client; private static Client client;
private static JAXBContext context; private static JAXBContext context;
private static void validate(StorageClusterStatusModel model) { private static void validate(StorageClusterStatusModel model) {
assertNotNull(model); assertNotNull(model);
assertTrue(model.getRegions() >= 2); assertTrue(model.getRegions() >= 1);
assertTrue(model.getRequests() >= 0); assertTrue(model.getRequests() >= 0);
// TODO: testing average load is flaky but not a stargate issue, revisit assertTrue(model.getAverageLoad() >= 0.0);
// assertTrue(model.getAverageLoad() >= 1.0);
assertNotNull(model.getLiveNodes()); assertNotNull(model.getLiveNodes());
assertNotNull(model.getDeadNodes()); assertNotNull(model.getDeadNodes());
assertFalse(model.getLiveNodes().isEmpty()); assertFalse(model.getLiveNodes().isEmpty());
@ -62,7 +61,6 @@ public class TestStatusResource {
assertNotNull(node.getName()); assertNotNull(node.getName());
assertTrue(node.getStartCode() > 0L); assertTrue(node.getStartCode() > 0L);
assertTrue(node.getRequests() >= 0); assertTrue(node.getRequests() >= 0);
assertFalse(node.getRegions().isEmpty());
for (StorageClusterStatusModel.Node.Region region: node.getRegions()) { for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
if (Bytes.equals(region.getName(), ROOT_REGION_NAME)) { if (Bytes.equals(region.getName(), ROOT_REGION_NAME)) {
foundRoot = true; foundRoot = true;
@ -77,8 +75,8 @@ public class TestStatusResource {
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniCluster(2); // some tests depend on having only 2 RS TEST_UTIL.startMiniCluster(3);
REST_TEST_UTIL.startServletContainer(); REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
client = new Client(new Cluster().add("localhost", client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort())); REST_TEST_UTIL.getServletPort()));
context = JAXBContext.newInstance(StorageClusterStatusModel.class); context = JAXBContext.newInstance(StorageClusterStatusModel.class);

View File

@ -65,14 +65,14 @@ public class TestTableResource {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final HBaseRESTTestingUtility REST_TEST_UTIL = private static final HBaseRESTTestingUtility REST_TEST_UTIL =
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration()); new HBaseRESTTestingUtility();
private static Client client; private static Client client;
private static JAXBContext context; private static JAXBContext context;
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniCluster(3);
REST_TEST_UTIL.startServletContainer(); REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
client = new Client(new Cluster().add("localhost", client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort())); REST_TEST_UTIL.getServletPort()));
context = JAXBContext.newInstance( context = JAXBContext.newInstance(

View File

@ -50,13 +50,13 @@ public class TestTransform {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final HBaseRESTTestingUtility REST_TEST_UTIL = private static final HBaseRESTTestingUtility REST_TEST_UTIL =
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration()); new HBaseRESTTestingUtility();
private static Client client; private static Client client;
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniCluster(3);
REST_TEST_UTIL.startServletContainer(); REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
client = new Client(new Cluster().add("localhost", client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort())); REST_TEST_UTIL.getServletPort()));
HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();

View File

@ -48,14 +48,14 @@ public class TestVersionResource {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final HBaseRESTTestingUtility REST_TEST_UTIL = private static final HBaseRESTTestingUtility REST_TEST_UTIL =
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration()); new HBaseRESTTestingUtility();
private static Client client; private static Client client;
private static JAXBContext context; private static JAXBContext context;
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniCluster(3);
REST_TEST_UTIL.startServletContainer(); REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
client = new Client(new Cluster().add("localhost", client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort())); REST_TEST_UTIL.getServletPort()));
context = JAXBContext.newInstance( context = JAXBContext.newInstance(

View File

@ -52,14 +52,14 @@ public class TestRemoteAdmin {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final HBaseRESTTestingUtility REST_TEST_UTIL = private static final HBaseRESTTestingUtility REST_TEST_UTIL =
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration()); new HBaseRESTTestingUtility();
private static HBaseAdmin localAdmin; private static HBaseAdmin localAdmin;
private static RemoteAdmin remoteAdmin; private static RemoteAdmin remoteAdmin;
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniCluster(3);
REST_TEST_UTIL.startServletContainer(); REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
localAdmin = TEST_UTIL.getHBaseAdmin(); localAdmin = TEST_UTIL.getHBaseAdmin();
remoteAdmin = new RemoteAdmin(new Client( remoteAdmin = new RemoteAdmin(new Client(
new Cluster().add("localhost", REST_TEST_UTIL.getServletPort())), new Cluster().add("localhost", REST_TEST_UTIL.getServletPort())),

View File

@ -70,13 +70,13 @@ public class TestRemoteTable {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final HBaseRESTTestingUtility REST_TEST_UTIL = private static final HBaseRESTTestingUtility REST_TEST_UTIL =
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration()); new HBaseRESTTestingUtility();
private static RemoteHTable remoteTable; private static RemoteHTable remoteTable;
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniCluster(3);
REST_TEST_UTIL.startServletContainer(); REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
LOG.info("Admin Connection=" + admin.getConnection() + ", " + LOG.info("Admin Connection=" + admin.getConnection() + ", " +
admin.getConnection().getZooKeeperWatcher()); admin.getConnection().getZooKeeperWatcher());