Skip to content

Commit

Permalink
ARTEMIS-4209 avoid double 'ID:' for 'User ID' when browsing AMQP msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
jbertram committed Mar 28, 2023
1 parent d2e5ddf commit 448a6de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ public Map<String, Object> getFields(M m, int valueSizeLimit, int deliveryCount)
rc.put(CompositeDataConstants.MESSAGE_ID, "" + m.getMessageID());
rc.put(CompositeDataConstants.PROTOCOL, m.getProtocolName());
if (m.getUserID() != null) {
rc.put(CompositeDataConstants.USER_ID, "ID:" + m.getUserID().toString());
String userID = m.getUserID().toString();
rc.put(CompositeDataConstants.USER_ID, userID.startsWith("ID:") ? userID : "ID:" + userID);
} else {
rc.put(CompositeDataConstants.USER_ID, "");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4090,12 +4090,24 @@ public void testSendMessageWithAMQP() throws Exception {

Assert.assertEquals(2, browse.length);

String userID = (String) browse[0].get("userID");

Assert.assertTrue(userID.startsWith("ID:"));

Assert.assertFalse(userID.startsWith("ID:ID:"));

String body = (String) browse[0].get("text");

Assert.assertNotNull(body);

Assert.assertEquals("theAMQPBody", body);

userID = (String) browse[1].get("userID");

Assert.assertTrue(userID.startsWith("ID:"));

Assert.assertFalse(userID.startsWith("ID:ID:"));

body = (String) browse[1].get("text");

Assert.assertNotNull(body);
Expand Down

0 comments on commit 448a6de

Please sign in to comment.