1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-06-13 15:14:54 +02:00

Added #testPrivateIQ. JM-436

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2978 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2005-10-18 22:00:36 +00:00 committed by gato
parent 581c07eff7
commit 23eefa7dc9

View file

@ -52,16 +52,20 @@
package org.jivesoftware.smackx.muc;
import java.util.*;
import java.text.SimpleDateFormat;
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.filter.*;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.MessageTypeFilter;
import org.jivesoftware.smack.filter.PacketTypeFilter;
import org.jivesoftware.smack.packet.*;
import org.jivesoftware.smack.test.SmackTestCase;
import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.packet.XHTMLExtension;
import org.jivesoftware.smackx.ServiceDiscoveryManager;
import org.jivesoftware.smackx.packet.DelayInformation;
import org.jivesoftware.smackx.packet.DiscoverInfo;
import org.jivesoftware.smackx.packet.XHTMLExtension;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* Tests the new MUC functionalities.
@ -482,6 +486,33 @@ public class MultiUserChatTest extends SmackTestCase {
}
}
/**
* Tests that IQ packets can be sent to/from room occupants. This case will try to discover
* information about other room occupants.
*/
public void testPrivateIQ() {
try {
// User2 joins the new room
MultiUserChat muc2 = new MultiUserChat(getConnection(1), room);
muc2.join("testbot2");
// User2 discovers information about User1
DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(getConnection(1))
.discoverInfo(room + "/testbot", null);
assertNotNull("No info was discovered from room occupant", info);
assertEquals("Wrong IQ type", IQ.Type.RESULT, info.getType());
assertEquals("Wrong IQ sender", room + "/testbot", info.getFrom());
// User2 leaves the room
muc2.leave();
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
public void testReservedNickname() {
try {
MultiUserChat muc2 = new MultiUserChat(getConnection(1), room);
@ -1780,7 +1811,7 @@ public class MultiUserChatTest extends SmackTestCase {
}
protected void setUp() throws Exception {
XMPPConnection.DEBUG_ENABLED = false;
//XMPPConnection.DEBUG_ENABLED = false;
super.setUp();
room = "fruta124@" + getMUCDomain();
try {