1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-23 13:07:59 +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:
Matt Tucker 2007-02-19 08:25:20 +00:00 committed by matt
parent 3e4a1ed5b5
commit fb0cb0476a

View file

@ -237,18 +237,25 @@ public abstract class SmackTestCase extends TestCase {
super.tearDown();
for (int i = 0; i < getMaxConnections(); i++) {
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();
}
catch (Exception e) {
e.printStackTrace();
}
if (getConnection(i).isConnected()) {
// Delete the created account for the test
try {
getConnection(i).getAccountManager().deleteAccount();
}
catch (XMPPException e) {
e.printStackTrace();
}
if (getConnection(i).isConnected()) {
// Close the connection
getConnection(i).disconnect();
}
// Close the connection
getConnection(i).disconnect();
}
}
}