Tweaks to get tests to pass more frequently.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2995 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Marilyn Daum 2005-10-25 01:27:35 +00:00 committed by marilyn
parent c2cc92943a
commit 922ae8688b
1 changed files with 25 additions and 0 deletions

View File

@ -340,6 +340,8 @@ public class RosterTest extends SmackTestCase {
*/
public void testAddEntryToNewGroup() {
try {
Thread.sleep(500);
// Add a new roster entry
Roster roster = getConnection(0).getRoster();
roster.createEntry(getBareJID(1), "gato11", new String[] { "Friends" });
@ -379,6 +381,7 @@ public class RosterTest extends SmackTestCase {
// Close the new connection
con2.close();
Thread.sleep(500);
cleanUpRoster();
}
@ -393,6 +396,8 @@ public class RosterTest extends SmackTestCase {
*/
public void testRenameRosterGroup() {
try {
Thread.sleep(200);
// Add a new roster entry
Roster roster = getConnection(0).getRoster();
roster.createEntry(getBareJID(1), "gato11", new String[] { "Friends" });
@ -440,6 +445,8 @@ public class RosterTest extends SmackTestCase {
*/
public void testRosterPresences() {
try {
Thread.sleep(200);
Presence presence = null;
// Create another connection for the same user of connection 1
@ -542,6 +549,16 @@ public class RosterTest extends SmackTestCase {
} catch (InterruptedException e) {}
}
// Wait up to 2 seconds to receive roster removal notifications
initial = System.currentTimeMillis();
while (System.currentTimeMillis() - initial < 2000 &&
getConnection(2).getRoster().getEntryCount() != 0) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {}
}
assertEquals(
"Wrong number of entries in connection 0",
0,
@ -576,6 +593,14 @@ public class RosterTest extends SmackTestCase {
protected void setUp() throws Exception {
//XMPPConnection.DEBUG_ENABLED = false;
try {
Thread.sleep(500);
}
catch (Exception e) {
fail(e.getMessage());
}
super.setUp();
}
}