BewareMyPower commented on code in PR #21417:
URL: https://github.com/apache/pulsar/pull/21417#discussion_r1368417411


##########
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TableViewTest.java:
##########
@@ -129,6 +129,27 @@ private Set<String> publishMessages(String topic, int 
count, boolean enableBatch
         return keys;
     }
 
+    @Test
+    public void testRefreshAPI() throws Exception {
+        String topic = "persistent://public/default/testRefreshAPI";
+        admin.topics().createPartitionedTopic(topic, 3);
+        int count = 50;
+        Set<String> keys = this.publishMessages(topic, count, false);
+        @Cleanup
+        TableView<byte[]> tv = pulsarClient.newTableViewBuilder(Schema.BYTES)
+                .topic(topic)
+                .autoUpdatePartitionsInterval(60, TimeUnit.SECONDS)

Review Comment:
   ```suggestion
   ```



##########
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TableViewTest.java:
##########
@@ -129,6 +129,27 @@ private Set<String> publishMessages(String topic, int 
count, boolean enableBatch
         return keys;
     }
 
+    @Test
+    public void testRefreshAPI() throws Exception {
+        String topic = "persistent://public/default/testRefreshAPI";
+        admin.topics().createPartitionedTopic(topic, 3);
+        int count = 50;
+        Set<String> keys = this.publishMessages(topic, count, false);
+        @Cleanup
+        TableView<byte[]> tv = pulsarClient.newTableViewBuilder(Schema.BYTES)
+                .topic(topic)
+                .autoUpdatePartitionsInterval(60, TimeUnit.SECONDS)
+                .create();
+        log.info("start tv size: {}", tv.size());
+        tv.forEachAndListen((k, v) -> log.info("{} -> {}", k, new String(v)));
+        // Call the refresh API to update the tableview. After this operation,
+        // there is no need to use 'Awaitility.await()' when assert the size 
and keys of 'tv'.
+        tv.refresh();
+        assertEquals(tv.size(), count);
+        assertEquals(tv.keySet(), keys);
+        tv.forEachAndListen((k, v) -> log.info("checkpoint {} -> {}", k, new 
String(v)));

Review Comment:
   ```suggestion
   ```



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

Reply via email to