Java 类org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel 实例源码

项目:ditb    文件:TestStatusResource.java   
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() + ">= 1", model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundMeta);
}
项目:LCIndex-HBase-0.94.16    文件:TestStatusResource.java   
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundRoot = false, foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), ROOT_REGION_NAME)) {
        foundRoot = true;
      } else if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundRoot);
  assertTrue(foundMeta);
}
项目:HIndex    文件:TestStatusResource.java   
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() + ">= 1", model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundMeta);
}
项目:IRIndex    文件:TestStatusResource.java   
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundRoot = false, foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), ROOT_REGION_NAME)) {
        foundRoot = true;
      } else if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundRoot);
  assertTrue(foundMeta);
}
项目:hbase    文件:TestStatusResource.java   
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() + ">= 1", model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundMeta);
}
项目:hbase    文件:TestStatusResource.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  conf = TEST_UTIL.getConfiguration();
  TEST_UTIL.startMiniCluster(1, 1);
  TEST_UTIL.createTable(TableName.valueOf("TestStatusResource"), Bytes.toBytes("D"));
  TEST_UTIL.createTable(TableName.valueOf("TestStatusResource2"), Bytes.toBytes("D"));
  REST_TEST_UTIL.startServletContainer(conf);
  Cluster cluster = new Cluster();
  cluster.add("localhost", REST_TEST_UTIL.getServletPort());
  client = new Client(cluster);
  context = JAXBContext.newInstance(StorageClusterStatusModel.class);
  TEST_UTIL.waitFor(6000, new Waiter.Predicate<IOException>() {
    @Override
    public boolean evaluate() throws IOException {
      return TEST_UTIL.getMiniHBaseCluster().getClusterStatus().getAverageLoad() > 0;
    }
  });
}
项目:PyroDB    文件:TestStatusResource.java   
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() + ">= 1", model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundMeta);
}
项目:c5    文件:TestStatusResource.java   
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() + ">= 1", model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundMeta);
}
项目:HBase-Research    文件:TestRemoteAdmin.java   
@Test
public void testClusterStatus() throws Exception {

  ClusterStatus status = TEST_UTIL.getHBaseClusterInterface()
      .getClusterStatus();
  StorageClusterStatusModel returnedStatus = remoteAdmin.getClusterStatus();
  assertEquals(
      "Region count from cluster status and returned status did not match up. ",
      status.getRegionsCount(), returnedStatus.getRegions());
  assertEquals(
      "Dead server count from cluster status and returned status did not match up. ",
      status.getDeadServers(), returnedStatus.getDeadNodes().size());
  assertEquals(
      "Number of requests from cluster status and returned status did not match up. ",
      status.getRequestsCount(), returnedStatus.getRequests());
}
项目:HBase-Research    文件:TestStatusResource.java   
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundRoot = false, foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), ROOT_REGION_NAME)) {
        foundRoot = true;
      } else if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundRoot);
  assertTrue(foundMeta);
}
项目:hbase-0.94.8-qod    文件:TestRemoteAdmin.java   
@Test
public void testClusterStatus() throws Exception {

  ClusterStatus status = TEST_UTIL.getHBaseClusterInterface()
      .getClusterStatus();
  StorageClusterStatusModel returnedStatus = remoteAdmin.getClusterStatus();
  assertEquals(
      "Region count from cluster status and returned status did not match up. ",
      status.getRegionsCount(), returnedStatus.getRegions());
  assertEquals(
      "Dead server count from cluster status and returned status did not match up. ",
      status.getDeadServers(), returnedStatus.getDeadNodes().size());
  assertEquals(
      "Number of requests from cluster status and returned status did not match up. ",
      status.getRequestsCount(), returnedStatus.getRequests());
}
项目:hbase-0.94.8-qod    文件:TestStatusResource.java   
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundRoot = false, foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), ROOT_REGION_NAME)) {
        foundRoot = true;
      } else if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundRoot);
  assertTrue(foundMeta);
}
项目:hbase-0.94.8-qod    文件:TestRemoteAdmin.java   
@Test
public void testClusterStatus() throws Exception {

  ClusterStatus status = TEST_UTIL.getHBaseClusterInterface()
      .getClusterStatus();
  StorageClusterStatusModel returnedStatus = remoteAdmin.getClusterStatus();
  assertEquals(
      "Region count from cluster status and returned status did not match up. ",
      status.getRegionsCount(), returnedStatus.getRegions());
  assertEquals(
      "Dead server count from cluster status and returned status did not match up. ",
      status.getDeadServers(), returnedStatus.getDeadNodes().size());
  assertEquals(
      "Number of requests from cluster status and returned status did not match up. ",
      status.getRequestsCount(), returnedStatus.getRequests());
}
项目:hbase-0.94.8-qod    文件:TestStatusResource.java   
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundRoot = false, foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), ROOT_REGION_NAME)) {
        foundRoot = true;
      } else if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundRoot);
  assertTrue(foundMeta);
}
项目:DominoHBase    文件:TestStatusResource.java   
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundRoot = false, foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), ROOT_REGION_NAME)) {
        foundRoot = true;
      } else if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundRoot);
  assertTrue(foundMeta);
}
项目:hindex    文件:TestRemoteAdmin.java   
@Test
public void testClusterStatus() throws Exception {

  ClusterStatus status = TEST_UTIL.getHBaseClusterInterface()
      .getClusterStatus();
  StorageClusterStatusModel returnedStatus = remoteAdmin.getClusterStatus();
  assertEquals(
      "Region count from cluster status and returned status did not match up. ",
      status.getRegionsCount(), returnedStatus.getRegions());
  assertEquals(
      "Dead server count from cluster status and returned status did not match up. ",
      status.getDeadServers(), returnedStatus.getDeadNodes().size());
  assertEquals(
      "Number of requests from cluster status and returned status did not match up. ",
      status.getRequestsCount(), returnedStatus.getRequests());
}
项目:hindex    文件:TestStatusResource.java   
private static void validate(StorageClusterStatusModel model) {
  assertNotNull(model);
  assertTrue(model.getRegions() >= 1);
  assertTrue(model.getRequests() >= 0);
  assertTrue(model.getAverageLoad() >= 0.0);
  assertNotNull(model.getLiveNodes());
  assertNotNull(model.getDeadNodes());
  assertFalse(model.getLiveNodes().isEmpty());
  boolean foundRoot = false, foundMeta = false;
  for (StorageClusterStatusModel.Node node: model.getLiveNodes()) {
    assertNotNull(node.getName());
    assertTrue(node.getStartCode() > 0L);
    assertTrue(node.getRequests() >= 0);
    for (StorageClusterStatusModel.Node.Region region: node.getRegions()) {
      if (Bytes.equals(region.getName(), ROOT_REGION_NAME)) {
        foundRoot = true;
      } else if (Bytes.equals(region.getName(), META_REGION_NAME)) {
        foundMeta = true;
      }
    }
  }
  assertTrue(foundRoot);
  assertTrue(foundMeta);
}
项目:ditb    文件:RemoteAdmin.java   
/**
 * @return string representing the cluster's version
 * @throws IOException if the endpoint does not exist, there is a timeout, or some other general failure mode
 */
public StorageClusterStatusModel getClusterStatus() throws IOException {

    StringBuilder path = new StringBuilder();
    path.append('/');
    if (accessToken !=null) {
        path.append(accessToken);
        path.append('/');
    }

  path.append("status/cluster");

  int code = 0;
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(path.toString(),
        Constants.MIMETYPE_PROTOBUF);
    code = response.getCode();
    switch (code) {
    case 200:
      StorageClusterStatusModel s = new StorageClusterStatusModel();
      return (StorageClusterStatusModel) s.getObjectFromMessage(response
          .getBody());
    case 404:
      throw new IOException("Cluster version not found");
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
        throw (InterruptedIOException)new InterruptedIOException().initCause(e);
      }
      break;
    default:
      throw new IOException("get request to " + path + " returned " + code);
    }
  }
  throw new IOException("get request to " + path + " timed out");
}
项目:ditb    文件:TestStatusResource.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster();
  REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
  client = new Client(new Cluster().add("localhost", 
    REST_TEST_UTIL.getServletPort()));
  context = JAXBContext.newInstance(StorageClusterStatusModel.class);
}
项目:ditb    文件:TestStatusResource.java   
@Test
public void testGetClusterStatusXML() throws IOException, JAXBException {
  Response response = client.get("/status/cluster", Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  StorageClusterStatusModel model = (StorageClusterStatusModel)
    context.createUnmarshaller().unmarshal(
      new ByteArrayInputStream(response.getBody()));
  validate(model);
}
项目:LCIndex-HBase-0.94.16    文件:RemoteAdmin.java   
/**
 * @return string representing the cluster's version
 * @throws IOEXception if the endpoint does not exist, there is a timeout, or some other general failure mode
 */
public StorageClusterStatusModel getClusterStatus() throws IOException {

    StringBuilder path = new StringBuilder();
    path.append('/');
    if (accessToken !=null) {
        path.append(accessToken);
        path.append('/');
    }

  path.append("status/cluster");

  int code = 0;
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(path.toString(),
        Constants.MIMETYPE_PROTOBUF);
    code = response.getCode();
    switch (code) {
    case 200:
      StorageClusterStatusModel s = new StorageClusterStatusModel();
      return (StorageClusterStatusModel) s.getObjectFromMessage(response
          .getBody());
    case 404:
      throw new IOException("Cluster version not found");
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
      }
      break;
    default:
      throw new IOException("get request to " + path + " returned " + code);
    }
  }
  throw new IOException("get request to " + path + " timed out");
}
项目:LCIndex-HBase-0.94.16    文件:TestRemoteAdmin.java   
@Test
public void testClusterStatus() throws Exception {

  ClusterStatus status = TEST_UTIL.getHBaseClusterInterface()
      .getClusterStatus();
  StorageClusterStatusModel returnedStatus = remoteAdmin.getClusterStatus();
  assertEquals(
      "Region count from cluster status and returned status did not match up. ",
      status.getRegionsCount(), returnedStatus.getRegions());
  assertEquals(
      "Dead server count from cluster status and returned status did not match up. ",
      status.getDeadServers(), returnedStatus.getDeadNodes().size());
}
项目:LCIndex-HBase-0.94.16    文件:TestStatusResource.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster();
  REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
  client = new Client(new Cluster().add("localhost", 
    REST_TEST_UTIL.getServletPort()));
  context = JAXBContext.newInstance(StorageClusterStatusModel.class);
}
项目:LCIndex-HBase-0.94.16    文件:TestStatusResource.java   
@Test
public void testGetClusterStatusXML() throws IOException, JAXBException {
  Response response = client.get("/status/cluster", Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  StorageClusterStatusModel model = (StorageClusterStatusModel)
    context.createUnmarshaller().unmarshal(
      new ByteArrayInputStream(response.getBody()));
  validate(model);
}
项目:HIndex    文件:RemoteAdmin.java   
/**
 * @return string representing the cluster's version
 * @throws IOEXception if the endpoint does not exist, there is a timeout, or some other general failure mode
 */
public StorageClusterStatusModel getClusterStatus() throws IOException {

    StringBuilder path = new StringBuilder();
    path.append('/');
    if (accessToken !=null) {
        path.append(accessToken);
        path.append('/');
    }

  path.append("status/cluster");

  int code = 0;
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(path.toString(),
        Constants.MIMETYPE_PROTOBUF);
    code = response.getCode();
    switch (code) {
    case 200:
      StorageClusterStatusModel s = new StorageClusterStatusModel();
      return (StorageClusterStatusModel) s.getObjectFromMessage(response
          .getBody());
    case 404:
      throw new IOException("Cluster version not found");
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
      }
      break;
    default:
      throw new IOException("get request to " + path + " returned " + code);
    }
  }
  throw new IOException("get request to " + path + " timed out");
}
项目:HIndex    文件:TestStatusResource.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster();
  REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
  client = new Client(new Cluster().add("localhost", 
    REST_TEST_UTIL.getServletPort()));
  context = JAXBContext.newInstance(StorageClusterStatusModel.class);
}
项目:HIndex    文件:TestStatusResource.java   
@Test
public void testGetClusterStatusXML() throws IOException, JAXBException {
  Response response = client.get("/status/cluster", Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  StorageClusterStatusModel model = (StorageClusterStatusModel)
    context.createUnmarshaller().unmarshal(
      new ByteArrayInputStream(response.getBody()));
  validate(model);
}
项目:IRIndex    文件:RemoteAdmin.java   
/**
 * @return string representing the cluster's version
 * @throws IOEXception if the endpoint does not exist, there is a timeout, or some other general failure mode
 */
public StorageClusterStatusModel getClusterStatus() throws IOException {

    StringBuilder path = new StringBuilder();
    path.append('/');
    if (accessToken !=null) {
        path.append(accessToken);
        path.append('/');
    }

  path.append("status/cluster");

  int code = 0;
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(path.toString(),
        Constants.MIMETYPE_PROTOBUF);
    code = response.getCode();
    switch (code) {
    case 200:
      StorageClusterStatusModel s = new StorageClusterStatusModel();
      return (StorageClusterStatusModel) s.getObjectFromMessage(response
          .getBody());
    case 404:
      throw new IOException("Cluster version not found");
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
      }
      break;
    default:
      throw new IOException("get request to " + path + " returned " + code);
    }
  }
  throw new IOException("get request to " + path + " timed out");
}
项目:IRIndex    文件:TestRemoteAdmin.java   
@Test
public void testClusterStatus() throws Exception {

  ClusterStatus status = TEST_UTIL.getHBaseClusterInterface()
      .getClusterStatus();
  StorageClusterStatusModel returnedStatus = remoteAdmin.getClusterStatus();
  assertEquals(
      "Region count from cluster status and returned status did not match up. ",
      status.getRegionsCount(), returnedStatus.getRegions());
  assertEquals(
      "Dead server count from cluster status and returned status did not match up. ",
      status.getDeadServers(), returnedStatus.getDeadNodes().size());
}
项目:IRIndex    文件:TestStatusResource.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster();
  REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
  client = new Client(new Cluster().add("localhost", 
    REST_TEST_UTIL.getServletPort()));
  context = JAXBContext.newInstance(StorageClusterStatusModel.class);
}
项目:IRIndex    文件:TestStatusResource.java   
@Test
public void testGetClusterStatusXML() throws IOException, JAXBException {
  Response response = client.get("/status/cluster", Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  StorageClusterStatusModel model = (StorageClusterStatusModel)
    context.createUnmarshaller().unmarshal(
      new ByteArrayInputStream(response.getBody()));
  validate(model);
}
项目:hbase    文件:RemoteAdmin.java   
/**
 * @return string representing the cluster's version
 * @throws IOException if the endpoint does not exist, there is a timeout, or some other general failure mode
 */
public StorageClusterStatusModel getClusterStatus() throws IOException {

    StringBuilder path = new StringBuilder();
    path.append('/');
    if (accessToken !=null) {
        path.append(accessToken);
        path.append('/');
    }

  path.append("status/cluster");

  int code = 0;
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(path.toString(),
        Constants.MIMETYPE_PROTOBUF);
    code = response.getCode();
    switch (code) {
    case 200:
      StorageClusterStatusModel s = new StorageClusterStatusModel();
      return (StorageClusterStatusModel) s.getObjectFromMessage(response
          .getBody());
    case 404:
      throw new IOException("Cluster version not found");
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
        throw (InterruptedIOException)new InterruptedIOException().initCause(e);
      }
      break;
    default:
      throw new IOException("get request to " + path + " returned " + code);
    }
  }
  throw new IOException("get request to " + path + " timed out");
}
项目:hbase    文件:TestStatusResource.java   
@Test
public void testGetClusterStatusXML() throws IOException, JAXBException {
  Response response = client.get("/status/cluster", Constants.MIMETYPE_XML);
  assertEquals(200, response.getCode());
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  StorageClusterStatusModel model = (StorageClusterStatusModel)
    context.createUnmarshaller().unmarshal(
      new ByteArrayInputStream(response.getBody()));
  validate(model);
}
项目:RStore    文件:StorageClusterStatusResource.java   
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
public Response get(final @Context UriInfo uriInfo) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("GET " + uriInfo.getAbsolutePath());
  }
  servlet.getMetrics().incrementRequests(1);
  try {
    HBaseAdmin admin = new HBaseAdmin(servlet.getConfiguration());
    ClusterStatus status = admin.getClusterStatus();
    StorageClusterStatusModel model = new StorageClusterStatusModel();
    model.setRegions(status.getRegionsCount());
    model.setRequests(status.getRequestsCount());
    model.setAverageLoad(status.getAverageLoad());
    for (ServerName info: status.getServers()) {
      HServerLoad load = status.getLoad(info);
      StorageClusterStatusModel.Node node =
        model.addLiveNode(
          info.getHostname() + ":" +
          Integer.toString(info.getPort()),
          info.getStartcode(), load.getUsedHeapMB(),
          load.getMaxHeapMB());
      node.setRequests(load.getNumberOfRequests());
      for (HServerLoad.RegionLoad region: load.getRegionsLoad().values()) {
        node.addRegion(region.getName(), region.getStores(),
          region.getStorefiles(), region.getStorefileSizeMB(),
          region.getMemStoreSizeMB(), region.getStorefileIndexSizeMB());
      }
    }
    for (ServerName name: status.getDeadServerNames()) {
      model.addDeadNode(name.toString());
    }
    ResponseBuilder response = Response.ok(model);
    response.cacheControl(cacheControl);
    return response.build();
  } catch (IOException e) {
    throw new WebApplicationException(e, 
                Response.Status.SERVICE_UNAVAILABLE);
  }
}
项目:PyroDB    文件:RemoteAdmin.java   
/**
 * @return string representing the cluster's version
 * @throws IOEXception if the endpoint does not exist, there is a timeout, or some other general failure mode
 */
public StorageClusterStatusModel getClusterStatus() throws IOException {

    StringBuilder path = new StringBuilder();
    path.append('/');
    if (accessToken !=null) {
        path.append(accessToken);
        path.append('/');
    }

  path.append("status/cluster");

  int code = 0;
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(path.toString(),
        Constants.MIMETYPE_PROTOBUF);
    code = response.getCode();
    switch (code) {
    case 200:
      StorageClusterStatusModel s = new StorageClusterStatusModel();
      return (StorageClusterStatusModel) s.getObjectFromMessage(response
          .getBody());
    case 404:
      throw new IOException("Cluster version not found");
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
        throw (InterruptedIOException)new InterruptedIOException().initCause(e);
      }
      break;
    default:
      throw new IOException("get request to " + path + " returned " + code);
    }
  }
  throw new IOException("get request to " + path + " timed out");
}
项目:PyroDB    文件:TestStatusResource.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster();
  REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
  client = new Client(new Cluster().add("localhost", 
    REST_TEST_UTIL.getServletPort()));
  context = JAXBContext.newInstance(StorageClusterStatusModel.class);
}
项目:PyroDB    文件:TestStatusResource.java   
@Test
public void testGetClusterStatusXML() throws IOException, JAXBException {
  Response response = client.get("/status/cluster", Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  StorageClusterStatusModel model = (StorageClusterStatusModel)
    context.createUnmarshaller().unmarshal(
      new ByteArrayInputStream(response.getBody()));
  validate(model);
}
项目:c5    文件:RemoteAdmin.java   
/**
 * @return string representing the cluster's version
 * @throws IOEXception if the endpoint does not exist, there is a timeout, or some other general failure mode
 */
public StorageClusterStatusModel getClusterStatus() throws IOException {

    StringBuilder path = new StringBuilder();
    path.append('/');
    if (accessToken !=null) {
        path.append(accessToken);
        path.append('/');
    }

  path.append("status/cluster");

  int code = 0;
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(path.toString(),
        Constants.MIMETYPE_PROTOBUF);
    code = response.getCode();
    switch (code) {
    case 200:
      StorageClusterStatusModel s = new StorageClusterStatusModel();
      return (StorageClusterStatusModel) s.getObjectFromMessage(response
          .getBody());
    case 404:
      throw new IOException("Cluster version not found");
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
      }
      break;
    default:
      throw new IOException("get request to " + path + " returned " + code);
    }
  }
  throw new IOException("get request to " + path + " timed out");
}
项目:c5    文件:TestStatusResource.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster();
  REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
  client = new Client(new Cluster().add("localhost", 
    REST_TEST_UTIL.getServletPort()));
  context = JAXBContext.newInstance(StorageClusterStatusModel.class);
}
项目:c5    文件:TestStatusResource.java   
@Test
public void testGetClusterStatusXML() throws IOException, JAXBException {
  Response response = client.get("/status/cluster", Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  StorageClusterStatusModel model = (StorageClusterStatusModel)
    context.createUnmarshaller().unmarshal(
      new ByteArrayInputStream(response.getBody()));
  validate(model);
}