Marcosrico commented on code in PR #2523:
URL: https://github.com/apache/helix/pull/2523#discussion_r1220055547


##########
meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestStressZkClient.java:
##########
@@ -369,4 +383,47 @@ public void handleDataChange(String key, Object data, 
ChangeType changeType) {
     _zkMetaClient.recursiveDelete(zkParentKey);
     Assert.assertEquals(_zkMetaClient.countDirectChildren(zkParentKey), 0);
   }
+
+  @Test
+  public void testTransactionOps() {
+    String zkParentKey = "/stressZk_testTransactionOp";
+    _zkMetaClient.create(zkParentKey, "parent_node");
+
+    // Transaction Create
+    List<Op> ops = new ArrayList<>();
+    for (int i = 0; i < TEST_ITERATION_COUNT; i++) {
+      ops.add(Op.create(zkParentKey + "/" + i, new byte[0], PERSISTENT));
+    }
+    List<OpResult> opResults = _zkMetaClient.transactionOP(ops);
+    for (int i = 0; i < TEST_ITERATION_COUNT; i++) {
+      Assert.assertTrue(opResults.get(i) instanceof OpResult.CreateResult);
+    }
+    for (int i = 0; i < TEST_ITERATION_COUNT; i++) {
+      Assert.assertNotNull(_zkMetaClient.exists(zkParentKey + "/" + i));
+    }
+
+    // Transaction Set
+    List<Op> ops_set = new ArrayList<>();
+    for (int i = 0; i < TEST_ITERATION_COUNT; i++) {
+      ops_set.add(Op.set(zkParentKey + "/" + i, new byte[0], -1));
+    }
+    List<OpResult> opsResultSet = _zkMetaClient.transactionOP(ops_set);
+    for (int i = 0; i < TEST_ITERATION_COUNT; i++) {
+      Assert.assertTrue(opsResultSet.get(i) instanceof OpResult.SetDataResult);
+    }
+
+    // Transaction Delete
+    List<Op> ops_delete = new ArrayList<>();
+    for (int i = 0; i < TEST_ITERATION_COUNT; i++) {
+      ops_delete.add(Op.delete(zkParentKey + "/" + i, -1));
+    }
+    List<OpResult> opsResultDelete = _zkMetaClient.transactionOP(ops_delete);
+    for (int i = 0; i < TEST_ITERATION_COUNT; i++) {
+      Assert.assertTrue(opsResultDelete.get(i) instanceof 
OpResult.DeleteResult);
+    }

Review Comment:
   Just added, thanks for the comment!



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to