1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-06-27 22:04:50 +02:00
Smack/smack-core/src/integration-test/java/org/jivesoftware/smack/util/ConnectionUtils.java
Florian Schmaus 91fd15ad86 Prefix subprojects with 'smack-'
instead of using the old baseName=smack appendix=project.name approach,
we are now going convention over configuration and renaming the
subprojects directories to the proper name.

Having a prefix is actually very helpful, because the resulting
libraries will be named like the subproject. And a core-4.0.0-rc1.jar is
not as explicit about what it actually *is* as a
smack-core-4.0.0-rc1.jar.

SMACK-265
2014-04-28 19:44:14 +02:00

30 lines
987 B
Java

package org.jivesoftware.smack.util;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.XMPPException;
public class ConnectionUtils {
private ConnectionUtils() {}
public static void becomeFriends(XMPPConnection con0, XMPPConnection 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(XMPPConnection[] connections) throws XMPPException {
for (XMPPConnection c1 : connections) {
for (XMPPConnection c2 : connections) {
if (c1 == c2)
continue;
becomeFriends(c1, c2);
}
}
}
}