当前位置: 首页>>代码示例>>Java>>正文


Java VersionModel类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.rest.model.VersionModel的典型用法代码示例。如果您正苦于以下问题:Java VersionModel类的具体用法?Java VersionModel怎么用?Java VersionModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VersionModel类属于org.apache.hadoop.hbase.rest.model包,在下文中一共展示了VersionModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validate

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
private static void validate(VersionModel model) {
  assertNotNull(model);
  assertNotNull(model.getRESTVersion());
  assertEquals(model.getRESTVersion(), RESTServlet.VERSION_STRING);
  String osVersion = model.getOSVersion(); 
  assertNotNull(osVersion);
  assertTrue(osVersion.contains(System.getProperty("os.name")));
  assertTrue(osVersion.contains(System.getProperty("os.version")));
  assertTrue(osVersion.contains(System.getProperty("os.arch")));
  String jvmVersion = model.getJVMVersion();
  assertNotNull(jvmVersion);
  assertTrue(jvmVersion.contains(System.getProperty("java.vm.vendor")));
  assertTrue(jvmVersion.contains(System.getProperty("java.version")));
  assertTrue(jvmVersion.contains(System.getProperty("java.vm.version")));
  assertNotNull(model.getServerVersion());
  String jerseyVersion = model.getJerseyVersion();
  assertNotNull(jerseyVersion);
  assertEquals(jerseyVersion, ServletContainer.class.getPackage()
    .getImplementationVersion());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:TestVersionResource.java

示例2: validate

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
private static void validate(VersionModel model) {
  assertNotNull(model);
  assertNotNull(model.getRESTVersion());
  assertEquals(RESTServlet.VERSION_STRING, model.getRESTVersion());
  String osVersion = model.getOSVersion();
  assertNotNull(osVersion);
  assertTrue(osVersion.contains(System.getProperty("os.name")));
  assertTrue(osVersion.contains(System.getProperty("os.version")));
  assertTrue(osVersion.contains(System.getProperty("os.arch")));
  String jvmVersion = model.getJVMVersion();
  assertNotNull(jvmVersion);
  assertTrue(jvmVersion.contains(System.getProperty("java.vm.vendor")));
  assertTrue(jvmVersion.contains(System.getProperty("java.version")));
  assertTrue(jvmVersion.contains(System.getProperty("java.vm.version")));
  assertNotNull(model.getServerVersion());
  String jerseyVersion = model.getJerseyVersion();
  assertNotNull(jerseyVersion);
  // TODO: fix when we actually get a jersey version
  // assertEquals(jerseyVersion, ServletContainer.class.getPackage().getImplementationVersion());
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:TestVersionResource.java

示例3: get

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
/**
 * Build a response for a version request.
 * @param context servlet context
 * @param uriInfo (JAX-RS context variable) request URL
 * @return a response for a version request 
 */
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
  MIMETYPE_PROTOBUF_IETF})
public Response get(final @Context ServletContext context, 
    final @Context UriInfo uriInfo) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("GET " + uriInfo.getAbsolutePath());
  }
  servlet.getMetrics().incrementRequests(1);
  ResponseBuilder response = Response.ok(new VersionModel(context));
  response.cacheControl(cacheControl);
  servlet.getMetrics().incrementSucessfulGetRequests(1);
  return response.build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:VersionResource.java

示例4: getRestVersion

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
/**
 * @return string representing the rest api's version
 * @throws IOException
 *           if the endpoint does not exist, there is a timeout, or some other
 *           general failure mode
 */
public VersionModel getRestVersion() throws IOException {

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

  path.append("version/rest");

  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:

      VersionModel v = new VersionModel();
      return (VersionModel) v.getObjectFromMessage(response.getBody());
    case 404:
      throw new IOException("REST 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.toString()
          + " returned " + code);
    }
  }
  throw new IOException("get request to " + path.toString() + " timed out");
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:44,代码来源:RemoteAdmin.java

示例5: setUpBeforeClass

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
@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(
    VersionModel.class,
    StorageClusterVersionModel.class);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:TestVersionResource.java

示例6: testGetStargateVersionXML

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
@Test
public void testGetStargateVersionXML() throws IOException, JAXBException {
  Response response = client.get("/version", Constants.MIMETYPE_XML);
  assertTrue(response.getCode() == 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  VersionModel model = (VersionModel)
    context.createUnmarshaller().unmarshal(
      new ByteArrayInputStream(response.getBody()));
  validate(model);
  LOG.info("success retrieving Stargate version as XML");
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:TestVersionResource.java

示例7: getRestVersion

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
/**
 * @return string representing the rest api's version
 * @throws IOEXception
 *           if the endpoint does not exist, there is a timeout, or some other
 *           general failure mode
 */
public VersionModel getRestVersion() throws IOException {

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

  path.append("version/rest");

  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:

      VersionModel v = new VersionModel();
      return (VersionModel) v.getObjectFromMessage(response.getBody());
    case 404:
      throw new IOException("REST version not found");
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
      }
      break;
    default:
      throw new IOException("get request to " + path.toString()
          + " returned " + code);
    }
  }
  throw new IOException("get request to " + path.toString() + " timed out");
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:43,代码来源:RemoteAdmin.java

示例8: testGetRestVersion

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
@Test
public void testGetRestVersion() throws Exception {

  VersionModel RETURNED_REST_VERSION = remoteAdmin.getRestVersion();
  System.out.print("Returned version is: " + RETURNED_REST_VERSION);

  // Assert that it contains info about rest version, OS, JVM
  assertTrue("Returned REST version did not contain info about rest.",
      RETURNED_REST_VERSION.toString().contains("rest"));
  assertTrue("Returned REST version did not contain info about the JVM.",
      RETURNED_REST_VERSION.toString().contains("JVM"));
  assertTrue("Returned REST version did not contain info about OS.",
      RETURNED_REST_VERSION.toString().contains("OS"));
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:15,代码来源:TestRemoteAdmin.java

示例9: testGetStargateVersionXML

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
@Test
public void testGetStargateVersionXML() throws IOException, JAXBException {
  Response response = client.get("/version", Constants.MIMETYPE_XML);
  assertTrue(response.getCode() == 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  VersionModel model = (VersionModel)
    context.createUnmarshaller().unmarshal(
      new ByteArrayInputStream(response.getBody()));
  validate(model);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:11,代码来源:TestVersionResource.java

示例10: main

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
  Cluster cluster = new Cluster();
  for (String arg : args)
    cluster.add(arg, 8088);

  Client client = new Client(cluster);
  RemoteAdmin remoteAdmin = new RemoteAdmin(client, new Configuration());
  VersionModel restVersion = remoteAdmin.getRestVersion();
  System.out.println(restVersion.toString());
}
 
开发者ID:jan-zajic,项目名称:mesos-hbase,代码行数:12,代码来源:TestConnectToHbaseRest.java

示例11: get

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
/**
 * Build a response for a version request.
 * @param context servlet context
 * @param uriInfo (JAX-RS context variable) request URL
 * @return a response for a version request
 */
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
  MIMETYPE_PROTOBUF_IETF})
public Response get(final @Context ServletContext context,
    final @Context UriInfo uriInfo) {
  if (LOG.isTraceEnabled()) {
    LOG.trace("GET " + uriInfo.getAbsolutePath());
  }
  servlet.getMetrics().incrementRequests(1);
  ResponseBuilder response = Response.ok(new VersionModel(context));
  response.cacheControl(cacheControl);
  servlet.getMetrics().incrementSucessfulGetRequests(1);
  return response.build();
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:VersionResource.java

示例12: setUpBeforeClass

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
@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(
    VersionModel.class,
    StorageClusterVersionModel.class);
}
 
开发者ID:apache,项目名称:hbase,代码行数:11,代码来源:TestVersionResource.java

示例13: testGetStargateVersionXML

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
@Test
public void testGetStargateVersionXML() throws IOException, JAXBException {
  Response response = client.get("/version", Constants.MIMETYPE_XML);
  assertEquals(200, response.getCode());
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  VersionModel model = (VersionModel)
    context.createUnmarshaller().unmarshal(
      new ByteArrayInputStream(response.getBody()));
  validate(model);
  LOG.info("success retrieving Stargate version as XML");
}
 
开发者ID:apache,项目名称:hbase,代码行数:12,代码来源:TestVersionResource.java

示例14: testGetStargateVersionJSON

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
@Test
public void testGetStargateVersionJSON() throws IOException {
  Response response = client.get("/version", Constants.MIMETYPE_JSON);
  assertEquals(200, response.getCode());
  assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
  ObjectMapper mapper = new JacksonJaxbJsonProvider()
          .locateMapper(VersionModel.class, MediaType.APPLICATION_JSON_TYPE);
  VersionModel model
          = mapper.readValue(response.getBody(), VersionModel.class);
  validate(model);
  LOG.info("success retrieving Stargate version as JSON");
}
 
开发者ID:apache,项目名称:hbase,代码行数:13,代码来源:TestVersionResource.java

示例15: get

import org.apache.hadoop.hbase.rest.model.VersionModel; //导入依赖的package包/类
/**
 * Build a response for a version request.
 * @param context servlet context
 * @param uriInfo (JAX-RS context variable) request URL
 * @return a response for a version request 
 */
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
public Response get(final @Context ServletContext context, 
    final @Context UriInfo uriInfo) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("GET " + uriInfo.getAbsolutePath());
  }
  servlet.getMetrics().incrementRequests(1);
  ResponseBuilder response = Response.ok(new VersionModel(context));
  response.cacheControl(cacheControl);
  return response.build();
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:19,代码来源:VersionResource.java


注:本文中的org.apache.hadoop.hbase.rest.model.VersionModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。