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


Java ZStat类代码示例

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


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

示例1: testGet

import org.apache.zookeeper.server.jersey.jaxb.ZStat; //导入依赖的package包/类
@Test
public void testGet() throws Exception {
    LOG.info("STARTING " + getName());

    if (expectedStat != null) {
        if (expectedStat.data64 != null || expectedStat.dataUtf8 == null) {
            zk.setData(expectedStat.path, expectedStat.data64, -1);
        } else {
            zk.setData(expectedStat.path,
                    expectedStat.dataUtf8.getBytes(), -1);
        }
    }

    ClientResponse cr = znodesr.path(path).queryParam("dataformat", encoding)
        .accept(accept).get(ClientResponse.class);
    assertEquals(expectedStatus, cr.getClientResponseStatus());

    if (expectedStat == null) {
        return;
    }

    ZStat zstat = cr.getEntity(ZStat.class);
    assertEquals(expectedStat, zstat);
    assertEquals(znodesr.path(path).toString(), zstat.uri);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:26,代码来源:GetTest.java

示例2: JAXBContextResolver

import org.apache.zookeeper.server.jersey.jaxb.ZStat; //导入依赖的package包/类
public JAXBContextResolver() throws Exception {
    Class[] typesArr =
        new Class[]{ZPath.class, ZStat.class, ZChildrenJSON.class};
    typesSet = new HashSet<Class>(Arrays.asList(typesArr));
    context = new JSONJAXBContext(
            JSONConfiguration.mapped()
                .arrays("children")
                .nonStrings("czxid")
                .nonStrings("mzxid")
                .nonStrings("ctime")
                .nonStrings("mtime")
                .nonStrings("version")
                .nonStrings("cversion")
                .nonStrings("aversion")
                .nonStrings("ephemeralOwner")
                .nonStrings("dataLength")
                .nonStrings("numChildren")
                .nonStrings("pzxid")
                .build(),
            typesArr);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:22,代码来源:JAXBContextResolver.java

示例3: testGet

import org.apache.zookeeper.server.jersey.jaxb.ZStat; //导入依赖的package包/类
@Test
public void testGet() throws Exception {
    if (expectedStat != null) {
        if (expectedStat.data64 != null || expectedStat.dataUtf8 == null) {
            zk.setData(expectedStat.path, expectedStat.data64, -1);
        } else {
            zk.setData(expectedStat.path,
                    expectedStat.dataUtf8.getBytes(), -1);
        }
    }

    ClientResponse cr = znodesr.path(path).queryParam("dataformat", encoding)
        .accept(accept).get(ClientResponse.class);
    Assert.assertEquals(expectedStatus, cr.getClientResponseStatus());

    if (expectedStat == null) {
        return;
    }

    ZStat zstat = cr.getEntity(ZStat.class);
    Assert.assertEquals(expectedStat, zstat);
    Assert.assertEquals(znodesr.path(path).toString(), zstat.uri);
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:24,代码来源:GetTest.java

示例4: testGet

import org.apache.zookeeper.server.jersey.jaxb.ZStat; //导入依赖的package包/类
@Test
public void testGet() throws Exception {
    LOG.info("STARTING " + getName());

    if (expectedStat != null) {
        if (expectedStat.data64 != null || expectedStat.dataUtf8 == null) {
            zk.setData(expectedStat.path, expectedStat.data64, -1);
        } else {
            zk.setData(expectedStat.path,
                    expectedStat.dataUtf8.getBytes(), -1);
        }
    }

    ClientResponse cr = r.path(path).queryParam("dataformat", encoding)
        .accept(accept).get(ClientResponse.class);
    assertEquals(expectedStatus, cr.getClientResponseStatus());

    if (expectedStat == null) {
        return;
    }

    ZStat zstat = cr.getEntity(ZStat.class);
    assertEquals(expectedStat, zstat);
    assertEquals(r.path(path).toString(), zstat.uri);
}
 
开发者ID:prodigeni,项目名称:zookeeper.dsc,代码行数:26,代码来源:GetTest.java

示例5: setZNode

import org.apache.zookeeper.server.jersey.jaxb.ZStat; //导入依赖的package包/类
@PUT
@Produces( { MediaType.APPLICATION_JSON, "application/javascript",
        MediaType.APPLICATION_XML })
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
public Response setZNode(
        @PathParam("path") String path,
        @QueryParam("callback") String callback,
        @DefaultValue("-1") @QueryParam("version") String versionParam,
        @DefaultValue("base64") @QueryParam("dataformat") String dataformat,
        @DefaultValue("false") @QueryParam("null") String setNull,
        @Context UriInfo ui, byte[] data) throws InterruptedException,
        KeeperException {
    ensurePathNotNull(path);

    int version;
    try {
        version = Integer.parseInt(versionParam);
    } catch (NumberFormatException e) {
        throw new WebApplicationException(Response.status(
                Response.Status.BAD_REQUEST).entity(
                new ZError(ui.getRequestUri().toString(), path
                        + " bad version " + versionParam)).build());
    }

    if (setNull.equals("true")) {
        data = null;
    }

    Stat stat = zk.setData(path, data, version);

    ZStat zstat = new ZStat(path, ui.getAbsolutePath().toString(), null,
            null, stat.getCzxid(), stat.getMzxid(), stat.getCtime(), stat
                    .getMtime(), stat.getVersion(), stat.getCversion(),
            stat.getAversion(), stat.getEphemeralOwner(), stat
                    .getDataLength(), stat.getNumChildren(), stat
                    .getPzxid());

    return Response.status(Response.Status.OK).entity(
            new JSONWithPadding(zstat, callback)).build();
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:41,代码来源:ZNodeResource.java

示例6: data

import org.apache.zookeeper.server.jersey.jaxb.ZStat; //导入依赖的package包/类
@Parameters
public static Collection<Object[]> data() throws Exception {
    String baseZnode = Base.createBaseZNode();

    return Arrays.asList(new Object[][] {
      {MediaType.APPLICATION_JSON, baseZnode + "/s-t1", "utf8",
          ClientResponse.Status.OK,
          new ZStat(baseZnode + "/s-t1", null, null), null },
      {MediaType.APPLICATION_JSON, baseZnode + "/s-t2", "utf8",
          ClientResponse.Status.OK,
          new ZStat(baseZnode + "/s-t2", null, null), new byte[0] },
      {MediaType.APPLICATION_JSON, baseZnode + "/s-t3", "utf8",
          ClientResponse.Status.OK,
          new ZStat(baseZnode + "/s-t3", null, null), "foobar".getBytes() },
      {MediaType.APPLICATION_JSON, baseZnode + "/s-t4", "base64",
          ClientResponse.Status.OK,
          new ZStat(baseZnode + "/s-t4", null, null), null },
      {MediaType.APPLICATION_JSON, baseZnode + "/s-t5", "base64",
          ClientResponse.Status.OK,
          new ZStat(baseZnode + "/s-t5", null, null), new byte[0] },
      {MediaType.APPLICATION_JSON, baseZnode + "/s-t6", "base64",
          ClientResponse.Status.OK,
          new ZStat(baseZnode + "/s-t6", null, null),
          "foobar".getBytes() },
      {MediaType.APPLICATION_JSON, baseZnode + "/dkdkdkd", "utf8",
          ClientResponse.Status.NOT_FOUND, null, null },
      {MediaType.APPLICATION_JSON, baseZnode + "/dkdkdkd", "base64",
          ClientResponse.Status.NOT_FOUND, null, null },
      });
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:31,代码来源:SetTest.java

示例7: SetTest

import org.apache.zookeeper.server.jersey.jaxb.ZStat; //导入依赖的package包/类
public SetTest(String accept, String path, String encoding,
        ClientResponse.Status status, ZStat expectedStat, byte[] data)
{
    this.accept = accept;
    this.path = path;
    this.encoding = encoding;
    this.expectedStatus = status;
    this.expectedStat = expectedStat;
    this.data = data;
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:11,代码来源:SetTest.java

示例8: data

import org.apache.zookeeper.server.jersey.jaxb.ZStat; //导入依赖的package包/类
@Parameters
public static Collection<Object[]> data() throws Exception {
    String baseZnode = Base.createBaseZNode();

 return Arrays.asList(new Object[][] {
  {MediaType.APPLICATION_JSON, baseZnode, "utf8",
      ClientResponse.Status.OK, new ZStat(baseZnode, null, null) },
  {MediaType.APPLICATION_JSON, baseZnode, "utf8",
      ClientResponse.Status.OK, new ZStat(baseZnode, null, "") },
  {MediaType.APPLICATION_JSON, baseZnode, "utf8",
      ClientResponse.Status.OK, new ZStat(baseZnode, null, "foo") },
  {MediaType.APPLICATION_JSON, baseZnode, "base64",
      ClientResponse.Status.OK, new ZStat(baseZnode, null, null) },
  {MediaType.APPLICATION_JSON, baseZnode, "base64",
      ClientResponse.Status.OK, new ZStat(baseZnode, "".getBytes(), null) },
  {MediaType.APPLICATION_JSON, baseZnode, "base64",
      ClientResponse.Status.OK, new ZStat(baseZnode, "".getBytes(), null) },
  {MediaType.APPLICATION_JSON, baseZnode, "base64",
          ClientResponse.Status.OK, new ZStat(baseZnode, "foo".getBytes(), null) },
  {MediaType.APPLICATION_JSON, baseZnode + "abaddkdk", "utf8",
                  ClientResponse.Status.NOT_FOUND, null },
  {MediaType.APPLICATION_JSON, baseZnode + "abaddkdk", "base64",
          ClientResponse.Status.NOT_FOUND, null },

  {MediaType.APPLICATION_XML, baseZnode, "utf8",
              ClientResponse.Status.OK, new ZStat(baseZnode, null, "foo") },
  {MediaType.APPLICATION_XML, baseZnode, "base64",
                  ClientResponse.Status.OK,
                  new ZStat(baseZnode, "foo".getBytes(), null) },
  {MediaType.APPLICATION_XML, baseZnode + "abaddkdk", "utf8",
                  ClientResponse.Status.NOT_FOUND, null },
  {MediaType.APPLICATION_XML, baseZnode + "abaddkdk", "base64",
          ClientResponse.Status.NOT_FOUND, null }

 });
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:37,代码来源:GetTest.java

示例9: GetTest

import org.apache.zookeeper.server.jersey.jaxb.ZStat; //导入依赖的package包/类
public GetTest(String accept, String path, String encoding,
        ClientResponse.Status status, ZStat stat)
{
    this.accept = accept;
    this.path = path;
    this.encoding = encoding;
    this.expectedStatus = status;
    this.expectedStat = stat;
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:10,代码来源:GetTest.java


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