mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-27 00:32:07 +01:00
Fixed to make test work, made wait times more aggressive.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2133 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
41d5c4637e
commit
33859481d2
1 changed files with 56 additions and 37 deletions
|
@ -83,10 +83,12 @@ public class RosterTest extends TestCase {
|
||||||
public void testDeleteAllRosterGroupEntries() {
|
public void testDeleteAllRosterGroupEntries() {
|
||||||
try {
|
try {
|
||||||
// Add a new roster entry
|
// Add a new roster entry
|
||||||
conn1.getRoster().createEntry("gato11@localhost", "gato11", new String[] {"Friends", "Family"});
|
conn1.getRoster().createEntry("gato11@localhost", "gato11",
|
||||||
conn1.getRoster().createEntry("gato12@localhost", "gato12", new String[] {"Family"});
|
new String[] {"Friends", "Family"});
|
||||||
|
conn1.getRoster().createEntry("gato12@localhost", "gato12",
|
||||||
|
new String[] {"Family"});
|
||||||
|
|
||||||
Thread.sleep(200);
|
Thread.sleep(100);
|
||||||
|
|
||||||
Iterator it = conn1.getRoster().getEntries();
|
Iterator it = conn1.getRoster().getEntries();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
@ -95,18 +97,24 @@ public class RosterTest extends TestCase {
|
||||||
while (groups.hasNext()) {
|
while (groups.hasNext()) {
|
||||||
RosterGroup rosterGroup = (RosterGroup) groups.next();
|
RosterGroup rosterGroup = (RosterGroup) groups.next();
|
||||||
rosterGroup.removeEntry(entry);
|
rosterGroup.removeEntry(entry);
|
||||||
Thread.sleep(250);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals("The number of entries in conn1 should be 2", 2, conn1.getRoster().getEntryCount());
|
assertEquals("The number of entries in conn1 should be 2", 2,
|
||||||
assertEquals("The number of groups in conn1 should be 0", 0, conn1.getRoster().getGroupCount());
|
conn1.getRoster().getEntryCount());
|
||||||
|
assertEquals("The number of groups in conn1 should be 0", 0,
|
||||||
|
conn1.getRoster().getGroupCount());
|
||||||
|
|
||||||
assertEquals("The number of entries in conn2 should be 1", 1, conn2.getRoster().getEntryCount());
|
assertEquals("The number of entries in conn2 should be 0", 0,
|
||||||
assertEquals("The number of groups in conn2 should be 0", 0, conn2.getRoster().getGroupCount());
|
conn2.getRoster().getEntryCount());
|
||||||
|
assertEquals("The number of groups in conn2 should be 0", 0,
|
||||||
|
conn2.getRoster().getGroupCount());
|
||||||
|
|
||||||
assertEquals("The number of entries in conn3 should be 1", 1, conn3.getRoster().getEntryCount());
|
assertEquals("The number of entries in conn3 should be 0", 0,
|
||||||
assertEquals("The number of groups in conn3 should be 0", 0, conn3.getRoster().getGroupCount());
|
conn3.getRoster().getEntryCount());
|
||||||
|
assertEquals("The number of groups in conn3 should be 0", 0,
|
||||||
|
conn3.getRoster().getGroupCount());
|
||||||
|
|
||||||
cleanUpRoster();
|
cleanUpRoster();
|
||||||
}
|
}
|
||||||
|
@ -126,20 +134,24 @@ public class RosterTest extends TestCase {
|
||||||
conn1.getRoster().createEntry("gato11@localhost", "gato11", new String[] {"Friends"});
|
conn1.getRoster().createEntry("gato11@localhost", "gato11", new String[] {"Friends"});
|
||||||
conn1.getRoster().createEntry("gato12@localhost", "gato12", new String[] {"Family"});
|
conn1.getRoster().createEntry("gato12@localhost", "gato12", new String[] {"Family"});
|
||||||
|
|
||||||
Thread.sleep(200);
|
Thread.sleep(100);
|
||||||
|
|
||||||
Iterator it = conn1.getRoster().getEntries();
|
Iterator it = conn1.getRoster().getEntries();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
RosterEntry entry = (RosterEntry) it.next();
|
RosterEntry entry = (RosterEntry) it.next();
|
||||||
conn1.getRoster().removeEntry(entry);
|
conn1.getRoster().removeEntry(entry);
|
||||||
Thread.sleep(250);
|
|
||||||
}
|
}
|
||||||
|
Thread.sleep(100);
|
||||||
|
|
||||||
assertEquals("The number of entries in conn1 should be 0", 0, conn1.getRoster().getEntryCount());
|
assertEquals("The number of entries in conn1 should be 0", 0,
|
||||||
assertEquals("The number of groups in conn1 should be 0", 0, conn1.getRoster().getGroupCount());
|
conn1.getRoster().getEntryCount());
|
||||||
|
assertEquals("The number of groups in conn1 should be 0", 0,
|
||||||
|
conn1.getRoster().getGroupCount());
|
||||||
|
|
||||||
assertEquals("The number of entries in conn2 should be 0", 0, conn2.getRoster().getEntryCount());
|
assertEquals("The number of entries in conn2 should be 0", 0,
|
||||||
assertEquals("The number of groups in conn2 should be 0", 0, conn2.getRoster().getGroupCount());
|
conn2.getRoster().getEntryCount());
|
||||||
|
assertEquals("The number of groups in conn2 should be 0", 0,
|
||||||
|
conn2.getRoster().getGroupCount());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
fail(e.getMessage());
|
fail(e.getMessage());
|
||||||
|
@ -157,27 +169,30 @@ public class RosterTest extends TestCase {
|
||||||
conn1.getRoster().createEntry("gato11@localhost", "gato11", null);
|
conn1.getRoster().createEntry("gato11@localhost", "gato11", null);
|
||||||
conn1.getRoster().createEntry("gato12@localhost", "gato12", null);
|
conn1.getRoster().createEntry("gato12@localhost", "gato12", null);
|
||||||
|
|
||||||
Thread.sleep(200);
|
Thread.sleep(100);
|
||||||
|
|
||||||
Iterator it = conn1.getRoster().getEntries();
|
Iterator it = conn1.getRoster().getEntries();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
RosterEntry entry = (RosterEntry) it.next();
|
RosterEntry entry = (RosterEntry) it.next();
|
||||||
conn1.getRoster().removeEntry(entry);
|
conn1.getRoster().removeEntry(entry);
|
||||||
Thread.sleep(250);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals("The number of entries in conn1 should be 0", 0, conn1.getRoster().getEntryCount());
|
assertEquals("The number of entries in conn1 should be 0", 0,
|
||||||
assertEquals("The number of groups in conn1 should be 0", 0, conn1.getRoster().getGroupCount());
|
conn1.getRoster().getEntryCount());
|
||||||
|
assertEquals("The number of groups in conn1 should be 0", 0,
|
||||||
|
conn1.getRoster().getGroupCount());
|
||||||
|
|
||||||
assertEquals("The number of entries in conn2 should be 0", 0, conn2.getRoster().getEntryCount());
|
assertEquals("The number of entries in conn2 should be 0", 0,
|
||||||
assertEquals("The number of groups in conn2 should be 0", 0, conn2.getRoster().getGroupCount());
|
conn2.getRoster().getEntryCount());
|
||||||
|
assertEquals("The number of groups in conn2 should be 0", 0,
|
||||||
|
conn2.getRoster().getGroupCount());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
fail(e.getMessage());
|
fail(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1. Create an unfiled entry
|
* 1. Create an unfiled entry
|
||||||
* 2. Change its name
|
* 2. Change its name
|
||||||
|
@ -190,7 +205,7 @@ public class RosterTest extends TestCase {
|
||||||
// Add a new roster entry
|
// Add a new roster entry
|
||||||
conn1.getRoster().createEntry("gato11@localhost", null, null);
|
conn1.getRoster().createEntry("gato11@localhost", null, null);
|
||||||
|
|
||||||
Thread.sleep(200);
|
Thread.sleep(100);
|
||||||
|
|
||||||
// Change the roster entry name and check if the change was made
|
// Change the roster entry name and check if the change was made
|
||||||
Iterator it = conn1.getRoster().getEntries();
|
Iterator it = conn1.getRoster().getEntries();
|
||||||
|
@ -201,7 +216,7 @@ public class RosterTest extends TestCase {
|
||||||
}
|
}
|
||||||
// Reload the roster and check the name again
|
// Reload the roster and check the name again
|
||||||
conn1.getRoster().reload();
|
conn1.getRoster().reload();
|
||||||
Thread.sleep(2000);
|
Thread.sleep(100);
|
||||||
it = conn1.getRoster().getEntries();
|
it = conn1.getRoster().getEntries();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
RosterEntry entry = (RosterEntry) it.next();
|
RosterEntry entry = (RosterEntry) it.next();
|
||||||
|
@ -216,7 +231,6 @@ public class RosterTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up all the entries in the roster
|
* Clean up all the entries in the roster
|
||||||
*/
|
*/
|
||||||
|
@ -228,18 +242,24 @@ public class RosterTest extends TestCase {
|
||||||
conn1.getRoster().removeEntry(entry);
|
conn1.getRoster().removeEntry(entry);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Thread.sleep(700);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
catch (Exception e) {}
|
catch (Exception e) {}
|
||||||
|
|
||||||
assertEquals("The number of entries in conn1 should be 0", 0, conn1.getRoster().getEntryCount());
|
assertEquals("The number of entries in conn1 should be 0", 0,
|
||||||
assertEquals("The number of groups in conn1 should be 0", 0, conn1.getRoster().getGroupCount());
|
conn1.getRoster().getEntryCount());
|
||||||
|
assertEquals("The number of groups in conn1 should be 0", 0,
|
||||||
|
conn1.getRoster().getGroupCount());
|
||||||
|
|
||||||
assertEquals("The number of entries in conn2 should be 0", 0, conn2.getRoster().getEntryCount());
|
assertEquals("The number of entries in conn2 should be 0", 0,
|
||||||
assertEquals("The number of groups in conn2 should be 0", 0, conn2.getRoster().getGroupCount());
|
conn2.getRoster().getEntryCount());
|
||||||
|
assertEquals("The number of groups in conn2 should be 0", 0,
|
||||||
|
conn2.getRoster().getGroupCount());
|
||||||
|
|
||||||
assertEquals("The number of entries in conn3 should be 0", 0, conn3.getRoster().getEntryCount());
|
assertEquals("The number of entries in conn3 should be 0", 0,
|
||||||
assertEquals("The number of groups in conn3 should be 0", 0, conn3.getRoster().getGroupCount());
|
conn3.getRoster().getEntryCount());
|
||||||
|
assertEquals("The number of groups in conn3 should be 0", 0,
|
||||||
|
conn3.getRoster().getGroupCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -258,8 +278,9 @@ public class RosterTest extends TestCase {
|
||||||
conn3 = new XMPPConnection("localhost");
|
conn3 = new XMPPConnection("localhost");
|
||||||
|
|
||||||
// Create the test accounts
|
// Create the test accounts
|
||||||
if (!conn1.getAccountManager().supportsAccountCreation())
|
if (!conn1.getAccountManager().supportsAccountCreation()) {
|
||||||
fail("Server does not support account creation");
|
fail("Server does not support account creation");
|
||||||
|
}
|
||||||
conn1.getAccountManager().createAccount("gato10", "gato10");
|
conn1.getAccountManager().createAccount("gato10", "gato10");
|
||||||
conn2.getAccountManager().createAccount("gato11", "gato11");
|
conn2.getAccountManager().createAccount("gato11", "gato11");
|
||||||
conn3.getAccountManager().createAccount("gato12", "gato12");
|
conn3.getAccountManager().createAccount("gato12", "gato12");
|
||||||
|
@ -273,7 +294,6 @@ public class RosterTest extends TestCase {
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
fail(e.getMessage());
|
fail(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -292,5 +312,4 @@ public class RosterTest extends TestCase {
|
||||||
conn2.close();
|
conn2.close();
|
||||||
conn3.close();
|
conn3.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue