1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 14:02:06 +01:00

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

View file

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