mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-07 21:51:07 +01:00
SMACK-361 Added support for Entity Capabilities.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_0@13560 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
1cdb86989a
commit
21be8c55ee
33 changed files with 2395 additions and 88 deletions
|
|
@ -40,7 +40,7 @@ public class ReconnectionTest extends SmackTestCase {
|
|||
|
||||
public void testAutomaticReconnection() throws Exception {
|
||||
XMPPConnection connection = getConnection(0);
|
||||
XMPPConnectionTestListener listener = new XMPPConnectionTestListener();
|
||||
XMPPConnectionTestListener listener = new XMPPConnectionTestListener();
|
||||
connection.addConnectionListener(listener);
|
||||
|
||||
// Simulates an error in the connection
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import junit.framework.TestCase;
|
|||
import org.jivesoftware.smack.ConnectionConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.util.ConnectionUtils;
|
||||
import org.xmlpull.mxp1.MXParser;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
|
|
@ -504,6 +505,15 @@ public abstract class SmackTestCase extends TestCase {
|
|||
return "config/" + fullClassName.substring(firstChar) + ".xml";
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribes all connections with each other: They all become friends
|
||||
*
|
||||
* @throws XMPPException
|
||||
*/
|
||||
protected void letsAllBeFriends() throws XMPPException {
|
||||
ConnectionUtils.letsAllBeFriends(connections);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two contents of two byte arrays to make sure that they are equal
|
||||
*
|
||||
|
|
|
|||
27
test/org/jivesoftware/smack/util/ConnectionUtils.java
Normal file
27
test/org/jivesoftware/smack/util/ConnectionUtils.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package org.jivesoftware.smack.util;
|
||||
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.Roster;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
|
||||
public class ConnectionUtils {
|
||||
|
||||
public static void becomeFriends(Connection con0, Connection con1) throws XMPPException {
|
||||
Roster r0 = con0.getRoster();
|
||||
Roster r1 = con1.getRoster();
|
||||
r0.setSubscriptionMode(Roster.SubscriptionMode.accept_all);
|
||||
r1.setSubscriptionMode(Roster.SubscriptionMode.accept_all);
|
||||
r0.createEntry(con1.getUser(), "u2", null);
|
||||
r1.createEntry(con0.getUser(), "u1", null);
|
||||
}
|
||||
|
||||
public static void letsAllBeFriends(Connection[] connections) throws XMPPException {
|
||||
for (Connection c1 : connections) {
|
||||
for (Connection c2 : connections) {
|
||||
if (c1 == c2)
|
||||
continue;
|
||||
becomeFriends(c1, c2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue