ARTEMIS-3677 add more tests

This commit is contained in:
Justin Bertram 2022-02-14 12:19:51 -06:00
parent e8cac3c5c2
commit 0bc7bf3f7c
No known key found for this signature in database
GPG Key ID: F41830B875BB8633
2 changed files with 31 additions and 0 deletions

View File

@ -101,6 +101,13 @@ public class JsonUtilTest {
Assert.assertEquals(input, notTruncated);
}
@Test
public void testTruncateWithoutNullValue() {
Object result = JsonUtil.truncate(null, -1);
Assert.assertEquals("", result);
}
@Test
public void testTruncateStringWithValueSizeLimit() {
String prefix = "12345";

View File

@ -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;
@ -3749,6 +3750,29 @@ public class QueueControlTest extends ManagementTestBase {
session.deleteQueue(queue);
}
@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();