Skip to content

Commit

Permalink
Add java doc for test
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblukose committed Oct 15, 2024
1 parent 019f66f commit 6033d9f
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ record = new ZNRecord("msg_1");
System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis()));
}

/**
* Test to ensure async setChildren fn with ttl configured works as expected. Test verifies general setChildren functionality
* and also verifies if the znodes created are configured with correct TTL.
*/
@Test
public void testAsyncSetChildrenWithTTL() {
System.setProperty("zookeeper.extendedTypesEnabled", "true");
Expand Down Expand Up @@ -457,6 +461,10 @@ public ZNRecord update(ZNRecord currentData) {
System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis()));
}

/**
* Test to ensure sync doUpdate fn with ttl configured works as expected. Test verifies general doUpdate functionality
* and also verifies if znode created are configured with correct TTL.
*/
@Test
public void testSyncDoUpdateWithTTL() {
System.setProperty("zookeeper.extendedTypesEnabled", "true");
Expand All @@ -472,6 +480,7 @@ public void testSyncDoUpdateWithTTL() {
ZkBaseDataAccessor<ZNRecord> accessor = Mockito.spy(new ZkBaseDataAccessor<ZNRecord>(_gZkClient));

AccessResult result = accessor.doUpdate(path, new ZNRecordUpdater(record), AccessOption.PERSISTENT_WITH_TTL);
// Fails as ttl is not provided when AccessOption.PERSISTENT_WITH_TTL is used
Assert.assertEquals(result._retCode, RetCode.ERROR);

result = accessor.doUpdate(path, new ZNRecordUpdater(record), AccessOption.PERSISTENT_WITH_TTL, ttl);
Expand Down

0 comments on commit 6033d9f

Please sign in to comment.