@@ -63,6 +63,7 @@ public class Slf4JAuditLoggerTest extends QuorumPeerTestBase {
63
63
@ BeforeAll
64
64
public static void setUpBeforeClass () throws Exception {
65
65
System .setProperty (ZKAuditProvider .AUDIT_ENABLE , "true" );
66
+ System .setProperty ("zookeeper.extendedTypesEnabled" , "true" );
66
67
// setup the logger to capture all logs
67
68
LoggerTestTool loggerTestTool = new LoggerTestTool (Slf4jAuditLogger .class );
68
69
os = loggerTestTool .getOutputStream ();
@@ -103,6 +104,32 @@ public void testCreateAuditLogs()
103
104
null , createMode ), readAuditLog (os ));
104
105
}
105
106
107
+ @ Test
108
+ public void testCreateWithTtlAuditLogs ()
109
+ throws KeeperException , InterruptedException , IOException {
110
+ final CreateMode createMode = CreateMode .PERSISTENT_WITH_TTL ;
111
+ final String path = "/createTtlPath" ;
112
+ zk .create (path , "" .getBytes (), ZooDefs .Ids .OPEN_ACL_UNSAFE ,
113
+ createMode , null , 3600 );
114
+ // success log
115
+ verifyLog (
116
+ getAuditLog (AuditConstants .OP_CREATE , path , Result .SUCCESS ,
117
+ null , createMode .toString ().toLowerCase ()), readAuditLog (os ));
118
+ }
119
+
120
+ @ Test
121
+ public void testCreateSeqWithTtlAuditLogs ()
122
+ throws KeeperException , InterruptedException , IOException {
123
+ final CreateMode createMode = CreateMode .PERSISTENT_SEQUENTIAL_WITH_TTL ;
124
+ String path = "/createTtlPath" ;
125
+ path = zk .create (path , "" .getBytes (), ZooDefs .Ids .OPEN_ACL_UNSAFE ,
126
+ createMode , null , 3600 );
127
+ // success log
128
+ verifyLog (
129
+ getAuditLog (AuditConstants .OP_CREATE , path , Result .SUCCESS ,
130
+ null , createMode .toString ().toLowerCase ()), readAuditLog (os ));
131
+ }
132
+
106
133
@ Test
107
134
public void testDeleteAuditLogs ()
108
135
throws InterruptedException , IOException , KeeperException {
@@ -406,6 +433,7 @@ private void waitForDeletion(ZooKeeper zooKeeper, String path)
406
433
407
434
@ AfterAll
408
435
public static void tearDownAfterClass () {
436
+ System .clearProperty ("zookeeper.extendedTypesEnabled" );
409
437
System .clearProperty (ZKAuditProvider .AUDIT_ENABLE );
410
438
for (int i = 0 ; i < SERVER_COUNT ; i ++) {
411
439
try {
0 commit comments