mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-27 14:47:59 +01:00
SMACK-330 Added missing node attribute in the item element for pubsub.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@12304 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
1df6aaadf3
commit
85e5402979
3 changed files with 395 additions and 208 deletions
|
@ -40,249 +40,252 @@ import org.junit.Test;
|
|||
* @see <a href="http://xmpp.org/rfcs/rfc3921.html#roster">Roster Management</a>
|
||||
* @author Guenther Niess
|
||||
*/
|
||||
public class ChatConnectionTest {
|
||||
public class ChatConnectionTest
|
||||
{
|
||||
|
||||
private DummyConnection connection;
|
||||
private DummyConnection connection;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
// Uncomment this to enable debug output
|
||||
//Connection.DEBUG_ENABLED = true;
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
// Uncomment this to enable debug output
|
||||
// Connection.DEBUG_ENABLED = true;
|
||||
|
||||
connection = new DummyConnection();
|
||||
connection.connect();
|
||||
connection.login("me", "secret");
|
||||
}
|
||||
connection = new DummyConnection();
|
||||
connection.connect();
|
||||
connection.login("me", "secret");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
if (connection != null)
|
||||
connection.disconnect();
|
||||
}
|
||||
@After
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
if (connection != null)
|
||||
connection.disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm that a new chat is created when a chat message is received but
|
||||
* there is no thread id for a user with only a base jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatCreatedWithIncomingChatNoThreadBaseJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
/**
|
||||
* Confirm that a new chat is created when a chat message is received but
|
||||
* there is no thread id for a user with only a base jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatCreatedWithIncomingChatNoThreadBaseJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
|
||||
Packet incomingChat = createChatPacket(null, false);
|
||||
processServerMessage(incomingChat);
|
||||
Packet incomingChat = createChatPacket(null, false);
|
||||
processServerMessage(incomingChat);
|
||||
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
}
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm that a new chat is created when a chat message is received but
|
||||
* there is no thread id for a user with a full jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatCreatedWhenIncomingChatNoThreadFullJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
/**
|
||||
* Confirm that a new chat is created when a chat message is received but
|
||||
* there is no thread id for a user with a full jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatCreatedWhenIncomingChatNoThreadFullJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
|
||||
Packet incomingChat = createChatPacket(null, true);
|
||||
processServerMessage(incomingChat);
|
||||
Packet incomingChat = createChatPacket(null, true);
|
||||
processServerMessage(incomingChat);
|
||||
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
}
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm that an existing chat created with a base jid is matched to an
|
||||
* incoming chat message that has no thread id and the user is a full jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatFoundWhenNoThreadFullJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
Chat outgoing = connection.getChatManager().createChat("you@testserver", null);
|
||||
/**
|
||||
* Confirm that an existing chat created with a base jid is matched to an
|
||||
* incoming chat message that has no thread id and the user is a full jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatFoundWhenNoThreadFullJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
Chat outgoing = connection.getChatManager().createChat("you@testserver", null);
|
||||
|
||||
Packet incomingChat = createChatPacket(null, true);
|
||||
processServerMessage(incomingChat);
|
||||
Packet incomingChat = createChatPacket(null, true);
|
||||
processServerMessage(incomingChat);
|
||||
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
assertTrue(newChat == outgoing);
|
||||
}
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
assertTrue(newChat == outgoing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm that an existing chat created with a base jid is matched to an
|
||||
* incoming chat message that has no thread id and the user is a base jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatFoundWhenNoThreadBaseJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
Chat outgoing = connection.getChatManager().createChat("you@testserver", null);
|
||||
/**
|
||||
* Confirm that an existing chat created with a base jid is matched to an
|
||||
* incoming chat message that has no thread id and the user is a base jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatFoundWhenNoThreadBaseJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
Chat outgoing = connection.getChatManager().createChat("you@testserver", null);
|
||||
|
||||
Packet incomingChat = createChatPacket(null, false);
|
||||
processServerMessage(incomingChat);
|
||||
Packet incomingChat = createChatPacket(null, false);
|
||||
processServerMessage(incomingChat);
|
||||
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
assertTrue(newChat == outgoing);
|
||||
}
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
assertTrue(newChat == outgoing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm that an existing chat created with a base jid is matched to an
|
||||
* incoming chat message that has the same id and the user is a full jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatFoundWithSameThreadFullJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
Chat outgoing = connection.getChatManager().createChat("you@testserver", null);
|
||||
/**
|
||||
* Confirm that an existing chat created with a base jid is matched to an
|
||||
* incoming chat message that has the same id and the user is a full jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatFoundWithSameThreadFullJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
Chat outgoing = connection.getChatManager().createChat("you@testserver", null);
|
||||
|
||||
Packet incomingChat = createChatPacket(outgoing.getThreadID(), true);
|
||||
processServerMessage(incomingChat);
|
||||
Packet incomingChat = createChatPacket(outgoing.getThreadID(), true);
|
||||
processServerMessage(incomingChat);
|
||||
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
assertTrue(newChat == outgoing);
|
||||
}
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
assertTrue(newChat == outgoing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm that an existing chat created with a base jid is matched to an
|
||||
* incoming chat message that has the same id and the user is a base jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatFoundWithSameThreadBaseJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
Chat outgoing = connection.getChatManager().createChat("you@testserver", null);
|
||||
/**
|
||||
* Confirm that an existing chat created with a base jid is matched to an
|
||||
* incoming chat message that has the same id and the user is a base jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatFoundWithSameThreadBaseJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
Chat outgoing = connection.getChatManager().createChat("you@testserver", null);
|
||||
|
||||
Packet incomingChat = createChatPacket(outgoing.getThreadID(), false);
|
||||
processServerMessage(incomingChat);
|
||||
Packet incomingChat = createChatPacket(outgoing.getThreadID(), false);
|
||||
processServerMessage(incomingChat);
|
||||
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
assertTrue(newChat == outgoing);
|
||||
}
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
assertTrue(newChat == outgoing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm that an existing chat created with a base jid is not matched to
|
||||
* an incoming chat message that has a different id and the same user as a
|
||||
* base jid.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void chatNotFoundWithDiffThreadBaseJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
Chat outgoing = connection.getChatManager().createChat("you@testserver", null);
|
||||
/**
|
||||
* Confirm that an existing chat created with a base jid is not matched to
|
||||
* an incoming chat message that has a different id and the same user as a
|
||||
* base jid.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void chatNotFoundWithDiffThreadBaseJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
Chat outgoing = connection.getChatManager().createChat("you@testserver", null);
|
||||
|
||||
Packet incomingChat = createChatPacket(outgoing.getThreadID() + "ff", false);
|
||||
processServerMessage(incomingChat);
|
||||
Packet incomingChat = createChatPacket(outgoing.getThreadID() + "ff", false);
|
||||
processServerMessage(incomingChat);
|
||||
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
assertFalse(newChat == outgoing);
|
||||
}
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
assertFalse(newChat == outgoing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm that an existing chat created with a base jid is not matched to
|
||||
* an incoming chat message that has a different id and the same base jid.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void chatNotFoundWithDiffThreadFullJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
Chat outgoing = connection.getChatManager().createChat("you@testserver", null);
|
||||
/**
|
||||
* Confirm that an existing chat created with a base jid is not matched to
|
||||
* an incoming chat message that has a different id and the same base jid.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void chatNotFoundWithDiffThreadFullJid()
|
||||
{
|
||||
TestChatManagerListener listener = new TestChatManagerListener();
|
||||
connection.getChatManager().addChatListener(listener);
|
||||
Chat outgoing = connection.getChatManager().createChat("you@testserver", null);
|
||||
|
||||
Packet incomingChat = createChatPacket(outgoing.getThreadID() + "ff", true);
|
||||
processServerMessage(incomingChat);
|
||||
Packet incomingChat = createChatPacket(outgoing.getThreadID() + "ff", true);
|
||||
processServerMessage(incomingChat);
|
||||
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
assertFalse(newChat == outgoing);
|
||||
}
|
||||
Chat newChat = listener.getNewChat();
|
||||
assertNotNull(newChat);
|
||||
assertFalse(newChat == outgoing);
|
||||
}
|
||||
|
||||
private Packet createChatPacket(final String threadId, final boolean isFullJid)
|
||||
{
|
||||
Message chatMsg = new Message("me@testserver", Message.Type.chat);
|
||||
chatMsg.setBody("the body message");
|
||||
chatMsg.setFrom("you@testserver" + (isFullJid ? "/resource" : ""));
|
||||
private Packet createChatPacket(final String threadId, final boolean isFullJid)
|
||||
{
|
||||
Message chatMsg = new Message("me@testserver", Message.Type.chat);
|
||||
chatMsg.setBody("the body message");
|
||||
chatMsg.setFrom("you@testserver" + (isFullJid ? "/resource" : ""));
|
||||
|
||||
if (threadId != null)
|
||||
chatMsg.addExtension(new PacketExtension()
|
||||
{
|
||||
@Override
|
||||
public String toXML()
|
||||
if (threadId != null)
|
||||
chatMsg.addExtension(new PacketExtension()
|
||||
{
|
||||
@Override
|
||||
public String toXML()
|
||||
{
|
||||
return "<thread>" + threadId + "</thread>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespace()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getElementName()
|
||||
{
|
||||
return "thread";
|
||||
}
|
||||
});
|
||||
return chatMsg;
|
||||
}
|
||||
|
||||
private void processServerMessage(Packet incomingChat)
|
||||
{
|
||||
TestChatServer chatServer = new TestChatServer(incomingChat);
|
||||
chatServer.start();
|
||||
try
|
||||
{
|
||||
return "<thread>" + threadId + "</thread>";
|
||||
chatServer.join();
|
||||
} catch (InterruptedException e)
|
||||
{
|
||||
fail();
|
||||
}
|
||||
}
|
||||
|
||||
class TestChatManagerListener implements ChatManagerListener
|
||||
{
|
||||
private Chat newChat;
|
||||
|
||||
@Override
|
||||
public void chatCreated(Chat chat, boolean createdLocally)
|
||||
{
|
||||
newChat = chat;
|
||||
}
|
||||
|
||||
public Chat getNewChat()
|
||||
{
|
||||
return newChat;
|
||||
}
|
||||
}
|
||||
|
||||
private class TestChatServer extends Thread
|
||||
{
|
||||
private Packet chatPacket;
|
||||
|
||||
TestChatServer(Packet chatMsg)
|
||||
{
|
||||
chatPacket = chatMsg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespace()
|
||||
public void run()
|
||||
{
|
||||
return null;
|
||||
connection.processPacket(chatPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getElementName()
|
||||
{
|
||||
return "thread";
|
||||
}
|
||||
});
|
||||
return chatMsg;
|
||||
}
|
||||
|
||||
private void processServerMessage(Packet incomingChat)
|
||||
{
|
||||
TestChatServer chatServer = new TestChatServer(incomingChat);
|
||||
chatServer.start();
|
||||
try
|
||||
{
|
||||
chatServer.join();
|
||||
} catch (InterruptedException e)
|
||||
{
|
||||
fail();
|
||||
}
|
||||
}
|
||||
|
||||
class TestChatManagerListener implements ChatManagerListener
|
||||
{
|
||||
private Chat newChat;
|
||||
|
||||
@Override
|
||||
public void chatCreated(Chat chat, boolean createdLocally)
|
||||
{
|
||||
newChat = chat;
|
||||
}
|
||||
|
||||
public Chat getNewChat()
|
||||
{
|
||||
return newChat;
|
||||
}
|
||||
}
|
||||
|
||||
private class TestChatServer extends Thread
|
||||
{
|
||||
private Packet chatPacket;
|
||||
|
||||
TestChatServer(Packet chatMsg)
|
||||
{
|
||||
chatPacket = chatMsg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
connection.processPacket(chatPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
package org.jivesoftware.smack;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
|
||||
public class ThreadedDummyConnection extends DummyConnection
|
||||
{
|
||||
private BlockingQueue<IQ> replyQ = new ArrayBlockingQueue<IQ>(1);
|
||||
private BlockingQueue<Packet> messageQ = new LinkedBlockingQueue<Packet>(5);
|
||||
|
||||
@Override
|
||||
public void sendPacket(Packet packet)
|
||||
{
|
||||
super.sendPacket(packet);
|
||||
|
||||
if ((packet instanceof IQ) && !replyQ.isEmpty())
|
||||
{
|
||||
// Set reply packet to match one being sent. We haven't started the
|
||||
// other thread yet so this is still safe.
|
||||
IQ replyPacket = replyQ.peek();
|
||||
replyPacket.setPacketID(packet.getPacketID());
|
||||
replyPacket.setFrom(packet.getTo());
|
||||
replyPacket.setTo(packet.getFrom());
|
||||
replyPacket.setType(Type.RESULT);
|
||||
|
||||
new ProcessQueue(replyQ).start();
|
||||
}
|
||||
}
|
||||
|
||||
public void addMessage(Message msgToProcess)
|
||||
{
|
||||
messageQ.add(msgToProcess);
|
||||
}
|
||||
|
||||
public void addIQReply(IQ reply)
|
||||
{
|
||||
replyQ.add(reply);
|
||||
}
|
||||
|
||||
public void processMessages()
|
||||
{
|
||||
if (!messageQ.isEmpty())
|
||||
new ProcessQueue(messageQ).start();
|
||||
else
|
||||
System.out.println("No messages to process");
|
||||
}
|
||||
|
||||
class ProcessQueue extends Thread
|
||||
{
|
||||
private BlockingQueue<? extends Packet> processQ;
|
||||
|
||||
ProcessQueue(BlockingQueue<? extends Packet> queue)
|
||||
{
|
||||
processQ = queue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
processPacket(processQ.take());
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
107
test-unit/org/jivesoftware/smackx/pubsub/ItemValidationTest.java
Normal file
107
test-unit/org/jivesoftware/smackx/pubsub/ItemValidationTest.java
Normal file
|
@ -0,0 +1,107 @@
|
|||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
|
||||
import org.jivesoftware.smack.ThreadedDummyConnection;
|
||||
import org.jivesoftware.smackx.pubsub.provider.ItemsProvider;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.xmlpull.mxp1.MXParser;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
public class ItemValidationTest
|
||||
{
|
||||
private ThreadedDummyConnection connection;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
// Uncomment this to enable debug output
|
||||
// Connection.DEBUG_ENABLED = true;
|
||||
|
||||
connection = new ThreadedDummyConnection();
|
||||
connection.connect();
|
||||
connection.login("me", "secret");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
if (connection != null)
|
||||
connection.disconnect();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyBasicItem() throws Exception
|
||||
{
|
||||
Item simpleItem = new Item();
|
||||
String simpleCtrl = "<item />";
|
||||
assertXMLEqual(simpleCtrl, simpleItem.toXML());
|
||||
|
||||
Item idItem = new Item("uniqueid");
|
||||
String idCtrl = "<item id='uniqueid'/>";
|
||||
assertXMLEqual(idCtrl, idItem.toXML());
|
||||
|
||||
Item itemWithNodeId = new Item("testId", "testNode");
|
||||
String nodeIdCtrl = "<item id='testId' node='testNode' />";
|
||||
assertXMLEqual(nodeIdCtrl, itemWithNodeId.toXML());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyPayloadItem() throws Exception
|
||||
{
|
||||
SimplePayload payload = new SimplePayload(null, null, "<data>This is the payload</data>");
|
||||
|
||||
PayloadItem<SimplePayload> simpleItem = new PayloadItem<SimplePayload>(payload);
|
||||
String simpleCtrl = "<item>" + payload.toXML() + "</item>";
|
||||
assertXMLEqual(simpleCtrl, simpleItem.toXML());
|
||||
|
||||
PayloadItem<SimplePayload> idItem = new PayloadItem<SimplePayload>("uniqueid", payload);
|
||||
String idCtrl = "<item id='uniqueid'>" + payload.toXML() + "</item>";
|
||||
assertXMLEqual(idCtrl, idItem.toXML());
|
||||
|
||||
PayloadItem<SimplePayload> itemWithNodeId = new PayloadItem<SimplePayload>("testId", "testNode", payload);
|
||||
String nodeIdCtrl = "<item id='testId' node='testNode'>" + payload.toXML() + "</item>";
|
||||
assertXMLEqual(nodeIdCtrl, itemWithNodeId.toXML());
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void parseBasicItemWithoutNode() throws Exception
|
||||
// {
|
||||
// XmlPullParser parser = new MXParser();
|
||||
// Reader reader = new StringReader(
|
||||
// "<event xmlns='http://jabber.org/protocol/pubsub#event'>" +
|
||||
// "<items node='testNode'>" +
|
||||
// "<item id='testid1' />" +
|
||||
// "</items></event>");
|
||||
// parser.setInput(reader);
|
||||
// ItemsProvider itemsProvider = new ItemsProvider();
|
||||
// ItemsExtension ext = (ItemsExtension) itemsProvider.parseExtension(parser);
|
||||
// Item basicItem = (Item) ext.getItems().get(0);
|
||||
//
|
||||
// assertEquals("testid1", basicItem.getId());
|
||||
// assertNull(basicItem.getNode());
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void parseBasicItemNode() throws Exception
|
||||
// {
|
||||
// BlockingQueue<Item> itemQ = new ArrayBlockingQueue<Item>(1);
|
||||
//
|
||||
// setupListener(itemQ);
|
||||
// Message itemMsg = getMessage("<item id='testid1' node='testNode'>");
|
||||
// connection.addMessage(itemMsg);
|
||||
//
|
||||
// Item basicItem = itemQ.poll(2, TimeUnit.SECONDS);
|
||||
//
|
||||
// assertNotNull(basicItem);
|
||||
// assertEquals("testid1", basicItem.getId());
|
||||
// assertEquals("testNode", basicItem.getNode());
|
||||
// }
|
||||
}
|
Loading…
Reference in a new issue