mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 04:22:05 +01:00
Improved clean-up logic.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7184 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
3e4a1ed5b5
commit
fb0cb0476a
1 changed files with 18 additions and 11 deletions
|
@ -237,12 +237,20 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
|
||||||
for (int i = 0; i < getMaxConnections(); i++) {
|
for (int i = 0; i < getMaxConnections(); i++) {
|
||||||
if (getConnection(i).isConnected()) {
|
|
||||||
// Delete the created account for the test
|
|
||||||
try {
|
try {
|
||||||
|
// If not connected, connect so that we can delete the account.
|
||||||
|
if (!getConnection(i).isConnected()) {
|
||||||
|
XMPPConnection con = getConnection(i);
|
||||||
|
con.connect();
|
||||||
|
con.login(getUsername(i), getUsername(i));
|
||||||
|
}
|
||||||
|
else if (!getConnection(i).isAuthenticated()) {
|
||||||
|
getConnection(i).login(getUsername(i), getUsername(i));
|
||||||
|
}
|
||||||
|
// Delete the created account for the test
|
||||||
getConnection(i).getAccountManager().deleteAccount();
|
getConnection(i).getAccountManager().deleteAccount();
|
||||||
}
|
}
|
||||||
catch (XMPPException e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (getConnection(i).isConnected()) {
|
if (getConnection(i).isConnected()) {
|
||||||
|
@ -251,7 +259,6 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean sendInitialPresence() {
|
protected boolean sendInitialPresence() {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue