1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-07-04 01:02:35 +02:00

Fixed test case when cleaning up roster.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3132 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2005-12-01 04:29:08 +00:00 committed by gato
parent 66c30903d0
commit ee6cedcea7

View file

@ -423,7 +423,12 @@ public class RosterTest extends SmackTestCase {
roster.getGroup("Amigos").setName(""); roster.getGroup("Amigos").setName("");
Thread.sleep(500); // Wait up to 2 seconds for the group to change its name
initial = System.currentTimeMillis();
while (System.currentTimeMillis() - initial < 2000 &&
(roster.getGroup("Amigos") != null)) {
Thread.sleep(100);
}
assertNull("The group Amigos still exists", roster.getGroup("Amigos")); assertNull("The group Amigos still exists", roster.getGroup("Amigos"));
assertNotNull("The group with no name does not exist", roster.getGroup("")); assertNotNull("The group with no name does not exist", roster.getGroup(""));
@ -520,12 +525,13 @@ public class RosterTest extends SmackTestCase {
* Clean up all the entries in the roster * Clean up all the entries in the roster
*/ */
private void cleanUpRoster() { private void cleanUpRoster() {
for (int i=0; i<getMaxConnections(); i++) {
// Delete all the entries from the roster // Delete all the entries from the roster
Iterator it = getConnection(0).getRoster().getEntries(); Iterator it = getConnection(i).getRoster().getEntries();
while (it.hasNext()) { while (it.hasNext()) {
RosterEntry entry = (RosterEntry) it.next(); RosterEntry entry = (RosterEntry) it.next();
try { try {
getConnection(0).getRoster().removeEntry(entry); getConnection(i).getRoster().removeEntry(entry);
} catch (XMPPException e) { } catch (XMPPException e) {
e.printStackTrace(); e.printStackTrace();
fail(e.getMessage()); fail(e.getMessage());
@ -533,11 +539,12 @@ public class RosterTest extends SmackTestCase {
} }
try { try {
Thread.sleep(1500); Thread.sleep(700);
} }
catch (InterruptedException e) { catch (InterruptedException e) {
fail(e.getMessage()); fail(e.getMessage());
} }
}
// Wait up to 2 seconds to receive roster removal notifications // Wait up to 2 seconds to receive roster removal notifications
long initial = System.currentTimeMillis(); long initial = System.currentTimeMillis();
while (System.currentTimeMillis() - initial < 2000 && while (System.currentTimeMillis() - initial < 2000 &&