kezhuw commented on code in PR #512:
URL: https://github.com/apache/curator/pull/512#discussion_r1915849281


##########
curator-framework/src/test/java/org/apache/curator/framework/imps/TestCompressionInTransactionOld.java:
##########
@@ -172,4 +172,59 @@ public void testCreateCompressedAndUncompressed() throws 
Exception {
             CloseableUtils.closeQuietly(client);
         }
     }
+
+    @Test
+    public void testGlobalCompression() throws Exception {
+        final String path1 = "/a";
+        final String path2 = "/b";
+
+        final byte[] data1 = "here's a string".getBytes();
+        final byte[] data2 = "here's another string".getBytes();
+
+        CuratorFramework client = CuratorFrameworkFactory.builder()
+                .connectString(server.getConnectString())
+                .retryPolicy(new RetryOneTime(1))
+                .enableCompression()
+                .build();
+        try {
+            client.start();
+
+            // Create the nodes
+            client.inTransaction()
+                    .create()
+                    .forPath(path1, data1)
+                    .and()
+                    .create()
+                    .forPath(path2, data2)
+                    .and()
+                    .commit();
+
+            // Check they exist
+            assertNotNull(client.checkExists().forPath(path1));
+            assertNotEquals(data1.length, 
client.checkExists().forPath(path1).getDataLength());
+            assertNotNull(client.checkExists().forPath(path2));
+            assertNotEquals(data2.length, 
client.checkExists().forPath(path2).getDataLength());
+            assertArrayEquals(data1, 
client.getData().decompressed().forPath(path1));
+            assertArrayEquals(data2, 
client.getData().decompressed().forPath(path2));
+
+            // Set the nodes, path1 compressed, path2 uncompressed.
+            client.inTransaction()
+                    .setData()
+                    .forPath(path1, data2)
+                    .and()
+                    .setData()
+                    .forPath(path2, data1)

Review Comment:
   The code and comment diverge here.



-- 
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: commits-unsubscr...@curator.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to