Skip to content

Commit

Permalink
ARTEMIS-3677 add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbertram committed Feb 14, 2022
1 parent e8cac3c commit 0bc7bf3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ public void testTruncateUsingStringWithoutValueSizeLimit() {
Assert.assertEquals(input, notTruncated);
}

@Test
public void testTruncateWithoutNullValue() {
Object result = JsonUtil.truncate(null, -1);

Assert.assertEquals("", result);
}

@Test
public void testTruncateStringWithValueSizeLimit() {
String prefix = "12345";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
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;
Expand Down Expand Up @@ -3749,6 +3750,29 @@ public void testBrowseWithNullPropertyValue() throws Exception {
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();
Expand Down

0 comments on commit 0bc7bf3

Please sign in to comment.