From 469ff4d48772ae980371300ec4afcb5604f32677 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Thu, 10 Aug 2006 21:35:08 +0000 Subject: [PATCH] Roster item nickname is now escaped for XML. SMACK-164 git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@4882 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smack/packet/RosterPacket.java | 2 +- test/org/jivesoftware/smack/RosterTest.java | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/source/org/jivesoftware/smack/packet/RosterPacket.java b/source/org/jivesoftware/smack/packet/RosterPacket.java index 53c738349..fff1c9946 100644 --- a/source/org/jivesoftware/smack/packet/RosterPacket.java +++ b/source/org/jivesoftware/smack/packet/RosterPacket.java @@ -200,7 +200,7 @@ public class RosterPacket extends IQ { StringBuilder buf = new StringBuilder(); buf.append(" characters. + */ + public void testNotCommonNickname() throws Exception { + // Add a new roster entry + Roster roster = getConnection(0).getRoster(); + roster.createEntry(getBareJID(1), "Thiago <12001200>", null); + + Thread.sleep(500); + + assertEquals("Created entry was never received", 1, roster.getEntryCount()); + + // Create another connection for the same user of connection 0 + XMPPConnection conn2 = new XMPPConnection(getServiceName()); + conn2.login(getUsername(0), getUsername(0), "Home"); + + // Retrieve roster and verify that new contact is there and nickname is correct + Roster roster2 = conn2.getRoster(); + assertEquals("Created entry was never received", 1, roster2.getEntryCount()); + RosterEntry entry = roster2.getEntry(getBareJID(1)); + assertNotNull("New entry was not returned from the server", entry); + assertEquals("Roster item name is incorrect", "Thiago <12001200>", entry.getName()); + } + /** * Clean up all the entries in the roster */