This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new ea1a556299 ARTEMIS-4387 Improving Consumer Memory Leak test with a non 
empty string
ea1a556299 is described below

commit ea1a55629919084e79cc3e2f0897983e95917c3a
Author: Clebert Suconic <clebertsuco...@apache.org>
AuthorDate: Mon Aug 14 13:51:36 2023 -0400

    ARTEMIS-4387 Improving Consumer Memory Leak test with a non empty string
---
 .../activemq/artemis/tests/leak/CoreClientLeakTest.java    | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git 
a/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/CoreClientLeakTest.java
 
b/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/CoreClientLeakTest.java
index 05322e95ca..f63cd54ada 100644
--- 
a/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/CoreClientLeakTest.java
+++ 
b/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/CoreClientLeakTest.java
@@ -52,12 +52,14 @@ public class CoreClientLeakTest extends ActiveMQTestBase {
    }
 
    @Test
-   public void testConsumerCreatedWithEmptyFilterString() throws Exception {
+   public void testConsumerFiltered() throws Exception {
 
       ServerLocator locator = 
ActiveMQClient.createServerLocator("tcp://localhost:61616");
       SimpleString queue = RandomUtil.randomSimpleString();
       SimpleString address = RandomUtil.randomSimpleString();
-      SimpleString filter = SimpleString.toSimpleString("");
+      SimpleString emptyString = SimpleString.toSimpleString("");
+      SimpleString dummyFilter = SimpleString.toSimpleString("dummy=true");
+
 
       try (ClientSessionFactory sf = createSessionFactory(locator);
            ClientSession clientSession = sf.createSession()) {
@@ -66,8 +68,14 @@ public class CoreClientLeakTest extends ActiveMQTestBase {
             clientSession.createQueue(new 
QueueConfiguration(queue).setAddress(address).setDurable(true));
             CheckLeak checkLeak = new CheckLeak();
             int initialSimpleString = 0;
+
             for (int i = 0; i < 500; i++) {
-               ClientConsumer consumer = clientSession.createConsumer(queue, 
filter);
+               ClientConsumer consumer;
+               if (i % 2 == 0) {
+                  consumer = clientSession.createConsumer(queue, emptyString);
+               } else {
+                  consumer = clientSession.createConsumer(queue, dummyFilter);
+               }
                consumer.close();
                consumer = null; // setting it to null to release the consumer 
earlier before the checkLeak call bellow
                if (i == 100) {

Reply via email to