[ 
https://issues.apache.org/jira/browse/ARTEMIS-3423?focusedWorklogId=639300&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-639300
 ]

ASF GitHub Bot logged work on ARTEMIS-3423:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/Aug/21 16:40
            Start Date: 18/Aug/21 16:40
    Worklog Time Spent: 10m 
      Work Description: gemmellr commented on a change in pull request #3697:
URL: https://github.com/apache/activemq-artemis/pull/3697#discussion_r691184948



##########
File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSharedDurableConsumerTest.java
##########
@@ -138,4 +140,46 @@ public void 
testSharedDurableConsumerWithArtemisClientAndAMQPClient() throws Exc
       testSharedDurableConsumer(connection, connection2);
 
    }
+
+   @Test(timeout = 30000)
+   public void testSharedDurableConsumerWithSelector() throws JMSException {

Review comment:
       ```suggestion
      public void testSharedDurableConsumerWithSelectorChange() throws 
JMSException {
   ```
   Clarify it doesnt test the selector behaviour itself, only the effect of 
changing it.

##########
File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSharedDurableConsumerTest.java
##########
@@ -138,4 +140,46 @@ public void 
testSharedDurableConsumerWithArtemisClientAndAMQPClient() throws Exc
       testSharedDurableConsumer(connection, connection2);
 
    }
+
+   @Test(timeout = 30000)
+   public void testSharedDurableConsumerWithSelector() throws JMSException {
+      SimpleString qName = amqpUseCoreSubscriptionNaming ? new 
SimpleString("SharedConsumer") : new SimpleString("SharedConsumer:global");
+      Connection connection = createConnection(true);
+      try {
+         Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+
+         Topic topic = session.createTopic(getTopicName());
+
+         MessageConsumer consumer = session.createSharedDurableConsumer(topic, 
"SharedConsumer", "a=b");
+         QueueImpl queue = (QueueImpl) 
server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(-1, queue.getMaxConsumers());
+         consumer.close();
+         MessageConsumer consumer2 = 
session.createSharedDurableConsumer(topic, "SharedConsumer", "a=b and b=c");
+         queue = (QueueImpl) 
server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(-1, queue.getMaxConsumers());
+      } finally {
+         connection.close();
+      }
+   }
+
+   @Test(timeout = 30000)
+   public void testUnSharedDurableConsumerWithSelector() throws JMSException {

Review comment:
       ```suggestion
      public void testDurableConsumerWithSelectorChange() throws JMSException {
   ```
   Shouldn't be in the JMSSharedDurableConsumerTest class, but rather the 
JMSDurableConsumerTest class. Can then go with just 
testDurableConsumerWithSelectorChange.

##########
File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSharedDurableConsumerTest.java
##########
@@ -138,4 +140,46 @@ public void 
testSharedDurableConsumerWithArtemisClientAndAMQPClient() throws Exc
       testSharedDurableConsumer(connection, connection2);
 
    }
+
+   @Test(timeout = 30000)
+   public void testSharedDurableConsumerWithSelector() throws JMSException {
+      SimpleString qName = amqpUseCoreSubscriptionNaming ? new 
SimpleString("SharedConsumer") : new SimpleString("SharedConsumer:global");
+      Connection connection = createConnection(true);
+      try {
+         Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+
+         Topic topic = session.createTopic(getTopicName());
+
+         MessageConsumer consumer = session.createSharedDurableConsumer(topic, 
"SharedConsumer", "a=b");
+         QueueImpl queue = (QueueImpl) 
server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(-1, queue.getMaxConsumers());
+         consumer.close();
+         MessageConsumer consumer2 = 
session.createSharedDurableConsumer(topic, "SharedConsumer", "a=b and b=c");
+         queue = (QueueImpl) 
server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(-1, queue.getMaxConsumers());

Review comment:
       This only asserts the getMaxConsumers return didnt change, it would be 
better to verify the wider expected behaviour when the selector changed as 
well, i.e that the queue was deleted or cleared. As is this test would 
presumably still pass if we instead just removed the entire selector change 
handling it aims to test.
   
   E.g assert the queue objects differ, or send a message before creating the 
new consumer and validate the message count changes.

##########
File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSharedDurableConsumerTest.java
##########
@@ -138,4 +140,46 @@ public void 
testSharedDurableConsumerWithArtemisClientAndAMQPClient() throws Exc
       testSharedDurableConsumer(connection, connection2);
 
    }
+
+   @Test(timeout = 30000)
+   public void testSharedDurableConsumerWithSelector() throws JMSException {
+      SimpleString qName = amqpUseCoreSubscriptionNaming ? new 
SimpleString("SharedConsumer") : new SimpleString("SharedConsumer:global");
+      Connection connection = createConnection(true);
+      try {
+         Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+
+         Topic topic = session.createTopic(getTopicName());
+
+         MessageConsumer consumer = session.createSharedDurableConsumer(topic, 
"SharedConsumer", "a=b");
+         QueueImpl queue = (QueueImpl) 
server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(-1, queue.getMaxConsumers());
+         consumer.close();
+         MessageConsumer consumer2 = 
session.createSharedDurableConsumer(topic, "SharedConsumer", "a=b and b=c");
+         queue = (QueueImpl) 
server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(-1, queue.getMaxConsumers());
+      } finally {
+         connection.close();
+      }
+   }
+
+   @Test(timeout = 30000)
+   public void testUnSharedDurableConsumerWithSelector() throws JMSException {
+      SimpleString qName = new SimpleString("foo.SharedConsumer");
+      Connection connection = createConnection("foo", true);
+      try {
+         Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+
+         Topic topic = session.createTopic(getTopicName());
+
+         MessageConsumer consumer = session.createDurableConsumer(topic, 
"SharedConsumer", "a=b", false);
+         QueueImpl queue = (QueueImpl) 
server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(1, queue.getMaxConsumers());
+         consumer.close();
+         MessageConsumer consumer2 = session.createDurableConsumer(topic, 
"SharedConsumer", "a=b and b=c", false);
+         queue = (QueueImpl) 
server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(1, queue.getMaxConsumers());

Review comment:
       Same comment around better verifying behaviour as in the other test.




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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 639300)
    Time Spent: 40m  (was: 0.5h)

> recreated shared durable subscription is created as unshared
> ------------------------------------------------------------
>
>                 Key: ARTEMIS-3423
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3423
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: AMQP
>            Reporter: Andy Taylor
>            Assignee: Andy Taylor
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> This is just in the AMQP layer, if a shared durable subscription is recreated 
> because of a change in message selector it gets created as unshared 
> (maxconsumers=1)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to