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

jbertram 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 0bc7bf3  ARTEMIS-3677 add more tests
0bc7bf3 is described below

commit 0bc7bf3f7ca2cd1508291f85ba5589430e5bae27
Author: Justin Bertram <[email protected]>
AuthorDate: Mon Feb 14 12:19:51 2022 -0600

    ARTEMIS-3677 add more tests
---
 .../activemq/artemis/api/core/JsonUtilTest.java    |  7 +++++++
 .../integration/management/QueueControlTest.java   | 24 ++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git 
a/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/JsonUtilTest.java
 
b/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/JsonUtilTest.java
index 40ea35a..d6d2847 100644
--- 
a/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/JsonUtilTest.java
+++ 
b/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/JsonUtilTest.java
@@ -102,6 +102,13 @@ public class JsonUtilTest {
    }
 
    @Test
+   public void testTruncateWithoutNullValue() {
+      Object result = JsonUtil.truncate(null, -1);
+
+      Assert.assertEquals("", result);
+   }
+
+   @Test
    public void testTruncateStringWithValueSizeLimit() {
       String prefix = "12345";
       int valueSizeLimit = prefix.length();
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
index 3ac730c..e602872 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
@@ -86,6 +86,7 @@ import org.apache.activemq.artemis.tests.util.Wait;
 import org.apache.activemq.artemis.utils.Base64;
 import org.apache.activemq.artemis.utils.RandomUtil;
 import org.apache.activemq.artemis.utils.RetryRule;
+import org.apache.qpid.jms.JmsConnectionFactory;
 import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.Before;
@@ -3750,6 +3751,29 @@ public class QueueControlTest extends ManagementTestBase 
{
    }
 
    @Test
+   public void testBrowseWithNullPropertyValueWithAMQP() throws Exception {
+      SimpleString address = RandomUtil.randomSimpleString();
+      SimpleString queue = RandomUtil.randomSimpleString();
+
+      session.createQueue(new 
QueueConfiguration(queue).setAddress(address).setDurable(durable).setRoutingType(RoutingType.ANYCAST));
+
+      JmsConnectionFactory cf = new 
JmsConnectionFactory("amqp://localhost:61616");
+      Connection c = cf.createConnection();
+      Session s = c.createSession();
+      MessageProducer p = s.createProducer(s.createQueue(address.toString()));
+      javax.jms.Message m = s.createMessage();
+      m.setStringProperty("foo", null);
+      p.send(m);
+      c.close();
+
+      QueueControl queueControl = createManagementControl(address, queue, 
RoutingType.ANYCAST);
+
+      assertEquals(1, queueControl.browse().length);
+
+      session.deleteQueue(queue);
+   }
+
+   @Test
    public void testResetGroups() throws Exception {
       SimpleString address = RandomUtil.randomSimpleString();
       SimpleString queue = RandomUtil.randomSimpleString();

Reply via email to