mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 14:02:06 +01:00
Improved setup to recover if the account already exists.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2481 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
7668ad5ce5
commit
9774b8e029
1 changed files with 9 additions and 1 deletions
|
@ -58,6 +58,7 @@ import java.util.Enumeration;
|
||||||
import javax.net.SocketFactory;
|
import javax.net.SocketFactory;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.xmlpull.v1.*;
|
import org.xmlpull.v1.*;
|
||||||
import org.xmlpull.mxp1.MXParser;
|
import org.xmlpull.mxp1.MXParser;
|
||||||
|
|
||||||
|
@ -227,7 +228,14 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
|
|
||||||
for (int i = 0; i < getMaxConnections(); i++) {
|
for (int i = 0; i < getMaxConnections(); i++) {
|
||||||
// Create the test account
|
// Create the test account
|
||||||
|
try {
|
||||||
getConnection(i).getAccountManager().createAccount("user" + i, "user" + i);
|
getConnection(i).getAccountManager().createAccount("user" + i, "user" + i);
|
||||||
|
} catch (XMPPException e) {
|
||||||
|
// Do nothing if the accout already exists
|
||||||
|
if (e.getXMPPError().getCode() != 409) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Login with the new test account
|
// Login with the new test account
|
||||||
getConnection(i).login("user" + i, "user" + i);
|
getConnection(i).login("user" + i, "user" + i);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue