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:
parent
374723813f
commit
7975f85146
|
@ -656,6 +656,7 @@ Release 0.21.0 - Unreleased
|
|||
HBASE-3203 We can get an order to open a region while shutting down
|
||||
and it'll hold up regionserver shutdown
|
||||
HBASE-3204 Reenable deferred log flush
|
||||
HBASE-3195 [rest] Fix TestTransform breakage on Hudson
|
||||
|
||||
|
||||
IMPROVEMENTS
|
||||
|
@ -1114,6 +1115,7 @@ Release 0.21.0 - Unreleased
|
|||
HBASE-3201 Add accounting of empty regioninfo_qualifier rows in meta to
|
||||
hbasefsck.
|
||||
|
||||
|
||||
NEW FEATURES
|
||||
HBASE-1961 HBase EC2 scripts
|
||||
HBASE-1982 [EC2] Handle potentially large and uneven instance startup times
|
||||
|
|
|
@ -28,6 +28,8 @@ import org.apache.commons.cli.PosixParser;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
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.List;
|
||||
|
@ -97,7 +99,8 @@ public class Main implements Constants {
|
|||
|
||||
// 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);
|
||||
|
||||
Server server = new Server(port);
|
||||
|
|
|
@ -23,7 +23,6 @@ package org.apache.hadoop.hbase.rest;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.client.HTablePool;
|
||||
import org.apache.hadoop.hbase.rest.metrics.RESTMetrics;
|
||||
|
||||
|
@ -41,9 +40,7 @@ public class RESTServlet implements Constants {
|
|||
* @throws IOException
|
||||
*/
|
||||
public synchronized static RESTServlet getInstance() throws IOException {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new RESTServlet();
|
||||
}
|
||||
assert(INSTANCE != null);
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
|
@ -64,14 +61,6 @@ public class RESTServlet implements Constants {
|
|||
if (INSTANCE != null) INSTANCE = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @throws IOException
|
||||
*/
|
||||
RESTServlet() throws IOException {
|
||||
this(HBaseConfiguration.create());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with existing configuration
|
||||
* @param conf existing configuration
|
||||
|
|
|
@ -33,19 +33,14 @@ public class HBaseRESTTestingUtility {
|
|||
|
||||
static final Log LOG = LogFactory.getLog(HBaseRESTTestingUtility.class);
|
||||
|
||||
private Configuration conf;
|
||||
private int testServletPort;
|
||||
private Server server;
|
||||
|
||||
public HBaseRESTTestingUtility(Configuration conf) {
|
||||
this.conf = conf;
|
||||
}
|
||||
|
||||
public int getServletPort() {
|
||||
return testServletPort;
|
||||
}
|
||||
|
||||
public void startServletContainer() throws Exception {
|
||||
public void startServletContainer(Configuration conf) throws Exception {
|
||||
if (server != null) {
|
||||
LOG.error("ServletContainer already running");
|
||||
return;
|
||||
|
|
|
@ -66,7 +66,7 @@ public class TestRowResource {
|
|||
|
||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
private static final HBaseRESTTestingUtility REST_TEST_UTIL =
|
||||
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration());
|
||||
new HBaseRESTTestingUtility();
|
||||
private static Client client;
|
||||
private static JAXBContext context;
|
||||
private static Marshaller marshaller;
|
||||
|
@ -75,7 +75,7 @@ public class TestRowResource {
|
|||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(3);
|
||||
REST_TEST_UTIL.startServletContainer();
|
||||
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
|
||||
context = JAXBContext.newInstance(
|
||||
CellModel.class,
|
||||
CellSetModel.class,
|
||||
|
|
|
@ -63,7 +63,7 @@ public class TestScannerResource {
|
|||
|
||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
private static final HBaseRESTTestingUtility REST_TEST_UTIL =
|
||||
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration());
|
||||
new HBaseRESTTestingUtility();
|
||||
private static Client client;
|
||||
private static JAXBContext context;
|
||||
private static Marshaller marshaller;
|
||||
|
@ -147,7 +147,7 @@ public class TestScannerResource {
|
|||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(3);
|
||||
REST_TEST_UTIL.startServletContainer();
|
||||
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
|
||||
client = new Client(new Cluster().add("localhost",
|
||||
REST_TEST_UTIL.getServletPort()));
|
||||
context = JAXBContext.newInstance(
|
||||
|
|
|
@ -108,7 +108,7 @@ public class TestScannersWithFilters {
|
|||
|
||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
private static final HBaseRESTTestingUtility REST_TEST_UTIL =
|
||||
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration());
|
||||
new HBaseRESTTestingUtility();
|
||||
private static Client client;
|
||||
private static JAXBContext context;
|
||||
private static Marshaller marshaller;
|
||||
|
@ -119,7 +119,7 @@ public class TestScannersWithFilters {
|
|||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(3);
|
||||
REST_TEST_UTIL.startServletContainer();
|
||||
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
|
||||
context = JAXBContext.newInstance(
|
||||
CellModel.class,
|
||||
CellSetModel.class,
|
||||
|
|
|
@ -48,14 +48,14 @@ public class TestSchemaResource {
|
|||
|
||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
private static final HBaseRESTTestingUtility REST_TEST_UTIL =
|
||||
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration());
|
||||
new HBaseRESTTestingUtility();
|
||||
private static Client client;
|
||||
private static JAXBContext context;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(3);
|
||||
REST_TEST_UTIL.startServletContainer();
|
||||
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
|
||||
client = new Client(new Cluster().add("localhost",
|
||||
REST_TEST_UTIL.getServletPort()));
|
||||
context = JAXBContext.newInstance(
|
||||
|
|
|
@ -44,16 +44,15 @@ public class TestStatusResource {
|
|||
|
||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
private static final HBaseRESTTestingUtility REST_TEST_UTIL =
|
||||
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration());
|
||||
new HBaseRESTTestingUtility();
|
||||
private static Client client;
|
||||
private static JAXBContext context;
|
||||
|
||||
private static void validate(StorageClusterStatusModel model) {
|
||||
assertNotNull(model);
|
||||
assertTrue(model.getRegions() >= 2);
|
||||
assertTrue(model.getRegions() >= 1);
|
||||
assertTrue(model.getRequests() >= 0);
|
||||
// TODO: testing average load is flaky but not a stargate issue, revisit
|
||||
// assertTrue(model.getAverageLoad() >= 1.0);
|
||||
assertTrue(model.getAverageLoad() >= 0.0);
|
||||
assertNotNull(model.getLiveNodes());
|
||||
assertNotNull(model.getDeadNodes());
|
||||
assertFalse(model.getLiveNodes().isEmpty());
|
||||
|
@ -62,7 +61,6 @@ public class TestStatusResource {
|
|||
assertNotNull(node.getName());
|
||||
assertTrue(node.getStartCode() > 0L);
|
||||
assertTrue(node.getRequests() >= 0);
|
||||
assertFalse(node.getRegions().isEmpty());
|
||||
for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
|
||||
if (Bytes.equals(region.getName(), ROOT_REGION_NAME)) {
|
||||
foundRoot = true;
|
||||
|
@ -77,8 +75,8 @@ public class TestStatusResource {
|
|||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(2); // some tests depend on having only 2 RS
|
||||
REST_TEST_UTIL.startServletContainer();
|
||||
TEST_UTIL.startMiniCluster(3);
|
||||
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
|
||||
client = new Client(new Cluster().add("localhost",
|
||||
REST_TEST_UTIL.getServletPort()));
|
||||
context = JAXBContext.newInstance(StorageClusterStatusModel.class);
|
||||
|
|
|
@ -65,14 +65,14 @@ public class TestTableResource {
|
|||
|
||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
private static final HBaseRESTTestingUtility REST_TEST_UTIL =
|
||||
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration());
|
||||
new HBaseRESTTestingUtility();
|
||||
private static Client client;
|
||||
private static JAXBContext context;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(3);
|
||||
REST_TEST_UTIL.startServletContainer();
|
||||
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
|
||||
client = new Client(new Cluster().add("localhost",
|
||||
REST_TEST_UTIL.getServletPort()));
|
||||
context = JAXBContext.newInstance(
|
||||
|
|
|
@ -50,13 +50,13 @@ public class TestTransform {
|
|||
|
||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
private static final HBaseRESTTestingUtility REST_TEST_UTIL =
|
||||
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration());
|
||||
new HBaseRESTTestingUtility();
|
||||
private static Client client;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(3);
|
||||
REST_TEST_UTIL.startServletContainer();
|
||||
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
|
||||
client = new Client(new Cluster().add("localhost",
|
||||
REST_TEST_UTIL.getServletPort()));
|
||||
HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
|
||||
|
|
|
@ -48,14 +48,14 @@ public class TestVersionResource {
|
|||
|
||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
private static final HBaseRESTTestingUtility REST_TEST_UTIL =
|
||||
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration());
|
||||
new HBaseRESTTestingUtility();
|
||||
private static Client client;
|
||||
private static JAXBContext context;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(3);
|
||||
REST_TEST_UTIL.startServletContainer();
|
||||
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
|
||||
client = new Client(new Cluster().add("localhost",
|
||||
REST_TEST_UTIL.getServletPort()));
|
||||
context = JAXBContext.newInstance(
|
||||
|
|
|
@ -52,14 +52,14 @@ public class TestRemoteAdmin {
|
|||
|
||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
private static final HBaseRESTTestingUtility REST_TEST_UTIL =
|
||||
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration());
|
||||
new HBaseRESTTestingUtility();
|
||||
private static HBaseAdmin localAdmin;
|
||||
private static RemoteAdmin remoteAdmin;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(3);
|
||||
REST_TEST_UTIL.startServletContainer();
|
||||
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
|
||||
localAdmin = TEST_UTIL.getHBaseAdmin();
|
||||
remoteAdmin = new RemoteAdmin(new Client(
|
||||
new Cluster().add("localhost", REST_TEST_UTIL.getServletPort())),
|
||||
|
|
|
@ -70,13 +70,13 @@ public class TestRemoteTable {
|
|||
|
||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
private static final HBaseRESTTestingUtility REST_TEST_UTIL =
|
||||
new HBaseRESTTestingUtility(TEST_UTIL.getConfiguration());
|
||||
new HBaseRESTTestingUtility();
|
||||
private static RemoteHTable remoteTable;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(3);
|
||||
REST_TEST_UTIL.startServletContainer();
|
||||
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
|
||||
HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
|
||||
LOG.info("Admin Connection=" + admin.getConnection() + ", " +
|
||||
admin.getConnection().getZooKeeperWatcher());
|
||||
|
|
Loading…
Reference in New Issue