Skip to content

Commit

Permalink
Add test coverage
Browse files Browse the repository at this point in the history
Test might fail. I couldn't figure out
how to run it locally, so I might need
to iterate on the remote CI.
  • Loading branch information
michaeljmarshall committed Apr 5, 2024
1 parent 20f1f83 commit e2fd831
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ public void testQueueBrowsers() throws Exception {
try (Connection connection = factory.createConnection()) {
connection.start();
try (Session session = connection.createSession(); ) {
Queue destination =
session.createQueue("persistent://public/default/test-" + UUID.randomUUID());
String topicName = "persistent://public/default/test-" + UUID.randomUUID();
Queue destination = session.createQueue(topicName);

try (MessageProducer producer = session.createProducer(destination); ) {
for (int i = 0; i < numMessages; i++) {
Expand Down Expand Up @@ -203,6 +203,12 @@ public void testQueueBrowsers() throws Exception {
count++;
}
assertEquals(1, count);
TopicStats stats = cluster.getService().getAdminClient().topics().getStats(topicName);
assertTrue(destination instanceof PulsarQueue);
PulsarQueue queue = (PulsarQueue) destination;
String subscriptionName = queue.extractSubscriptionName();
// Validate QueueBrowser is connected using subscription name
assertEquals(stats.getSubscriptions().get(subscriptionName).getConsumers().size(), 1);
}

// scan again without calling hasMoreElements explicitly
Expand Down

0 comments on commit e2fd831

Please sign in to comment.