jiajunwang commented on a change in pull request #1190:
URL: https://github.com/apache/helix/pull/1190#discussion_r463229646
##########
File path:
helix-rest/src/test/java/org/apache/helix/rest/server/TestZooKeeperAccessor.java
##########
@@ -192,4 +191,33 @@ public void testGetStat() throws IOException {
// Clean up
_testBaseDataAccessor.remove(path, AccessOption.PERSISTENT);
}
+
+ @Test
+ public void testDelete() throws IOException {
+ String path = "/path";
+ String deletePath = path + "/delete";
+
+ try {
+ // 1. Create a persistent node. Delete shall fail.
+ _testBaseDataAccessor.create(deletePath, null, AccessOption.PERSISTENT);
+ // Verify with the REST endpoint
+ new
JerseyUriRequestBuilder("zookeeper{}?command=delete").format(deletePath)
+ .expectedReturnStatusCode(Response.Status.FORBIDDEN.getStatusCode());
+ Assert.assertTrue(_testBaseDataAccessor.exists(deletePath,
AccessOption.PERSISTENT));
+
+ // 2. Create a ephemeral node. Delete shall be done successfully.
+ _testBaseDataAccessor.remove(deletePath, AccessOption.PERSISTENT);
+ _testBaseDataAccessor.create(deletePath, null, AccessOption.EPHEMERAL);
+ // Verify with the REST endpoint
+ String data = new
JerseyUriRequestBuilder("zookeeper{}?command=delete").format(deletePath)
+ .isBodyReturnExpected(true).get(this);
+ Map<String, String> result = OBJECT_MAPPER.readValue(data,
HashMap.class);
+ Assert.assertEquals(result.get("path"), deletePath);
+ Assert.assertEquals(result.get("delete"), new Boolean(true).toString());
+ Assert.assertFalse(_testBaseDataAccessor.exists(deletePath,
AccessOption.PERSISTENT));
Review comment:
No use at all. There is no such thing in ZK lib. I think we shall clean
them up in a separate PR.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]