codelipenghui commented on code in PR #17416:
URL: https://github.com/apache/pulsar/pull/17416#discussion_r961742675
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/systopic/PartitionedSystemTopicTest.java:
##########
@@ -235,4 +235,27 @@ private void testSetBacklogCausedCreatingProducerFailure()
throws Exception {
Assert.fail("failed to create producer");
}
}
+
+ @Test
+ public void testGetTopic() throws Exception {
Review Comment:
One question about the test.
Why the test should be added to the `PartitionedSystemTopicTest.java`?
Looks like they are unrelated.
The `BrokerServiceTest` looks more reasonable
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/systopic/PartitionedSystemTopicTest.java:
##########
@@ -235,4 +235,27 @@ private void testSetBacklogCausedCreatingProducerFailure()
throws Exception {
Assert.fail("failed to create producer");
}
}
+
+ @Test
+ public void testGetTopic() throws Exception {
+ final String ns = "prop/ns-test";
+ admin.namespaces().createNamespace(ns, 2);
+ final String topicName = ns + "/topic-1";
+
admin.topics().createNonPartitionedTopic(String.format("persistent://%s",
topicName));
+ Producer<String> producer1 =
pulsarClient.newProducer(Schema.STRING).topic(topicName).create();
+ producer1.close();
+ PersistentTopic persistentTopic = (PersistentTopic)
pulsar.getBrokerService().getTopic(topicName.toString(), false).get().get();
+ persistentTopic.close().join();
+ List<String> topics = new ArrayList<>();
+ topics.addAll(pulsar.getBrokerService().getTopics().keys());
Review Comment:
```suggestion
List<String> topics = new
ArrayList<>(pulsar.getBrokerService().getTopics().keys());
```
--
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]