use of org.apache.zookeeper.server.jersey.jaxb.ZSession in project zookeeper by apache.
the class SessionTest method testCreateEphemeralZNode.
@Test
public void testCreateEphemeralZNode() throws KeeperException, InterruptedException, IOException {
ZSession session = createSession("30");
WebResource wr = znodesr.path("/").queryParam("op", "create").queryParam("name", "ephemeral-test").queryParam("ephemeral", "true").queryParam("session", session.id).queryParam("null", "true");
Builder b = wr.accept(MediaType.APPLICATION_JSON);
ClientResponse cr = b.post(ClientResponse.class);
Assert.assertEquals(ClientResponse.Status.CREATED, cr.getClientResponseStatus());
Stat stat = new Stat();
zk.getData("/ephemeral-test", false, stat);
ZooKeeper sessionZK = ZooKeeperService.getClient(CONTEXT_PATH, session.id);
Assert.assertEquals(stat.getEphemeralOwner(), sessionZK.getSessionId());
}
Aggregations