1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-23 06:42:05 +01:00

Test should now be correct again.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2134 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-10-05 15:23:18 +00:00 committed by mtucker
parent 33859481d2
commit 740a27e500

View file

@ -83,12 +83,10 @@ 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", conn1.getRoster().createEntry("gato11@" + conn1.getHost(), "gato11", new String[] {"Friends", "Family"});
new String[] {"Friends", "Family"}); conn1.getRoster().createEntry("gato12@" + conn1.getHost(), "gato12", new String[] {"Family"});
conn1.getRoster().createEntry("gato12@localhost", "gato12",
new String[] {"Family"});
Thread.sleep(100); Thread.sleep(200);
Iterator it = conn1.getRoster().getEntries(); Iterator it = conn1.getRoster().getEntries();
while (it.hasNext()) { while (it.hasNext()) {
@ -97,24 +95,18 @@ 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(100); Thread.sleep(250);
} }
} }
assertEquals("The number of entries in conn1 should be 2", 2, assertEquals("The number of entries in conn1 should be 2", 2, conn1.getRoster().getEntryCount());
conn1.getRoster().getEntryCount()); assertEquals("The number of groups in conn1 should be 0", 0, conn1.getRoster().getGroupCount());
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, assertEquals("The number of entries in conn2 should be 1", 1, conn2.getRoster().getEntryCount());
conn2.getRoster().getEntryCount()); assertEquals("The number of groups in conn2 should be 0", 0, conn2.getRoster().getGroupCount());
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, assertEquals("The number of entries in conn3 should be 1", 1, conn3.getRoster().getEntryCount());
conn3.getRoster().getEntryCount()); assertEquals("The number of groups in conn3 should be 0", 0, conn3.getRoster().getGroupCount());
assertEquals("The number of groups in conn3 should be 0", 0,
conn3.getRoster().getGroupCount());
cleanUpRoster(); cleanUpRoster();
} }
@ -131,27 +123,23 @@ public class RosterTest extends TestCase {
public void testDeleteAllRosterEntries() { public void testDeleteAllRosterEntries() {
try { try {
// Add a new roster entry // Add a new roster entry
conn1.getRoster().createEntry("gato11@localhost", "gato11", new String[] {"Friends"}); conn1.getRoster().createEntry("gato11@" + conn1.getHost(), "gato11", new String[] {"Friends"});
conn1.getRoster().createEntry("gato12@localhost", "gato12", new String[] {"Family"}); conn1.getRoster().createEntry("gato12@" + conn1.getHost(), "gato12", new String[] {"Family"});
Thread.sleep(100); Thread.sleep(200);
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, assertEquals("The number of entries in conn1 should be 0", 0, conn1.getRoster().getEntryCount());
conn1.getRoster().getEntryCount()); assertEquals("The number of groups in conn1 should be 0", 0, conn1.getRoster().getGroupCount());
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, assertEquals("The number of entries in conn2 should be 0", 0, conn2.getRoster().getEntryCount());
conn2.getRoster().getEntryCount()); assertEquals("The number of groups in conn2 should be 0", 0, conn2.getRoster().getGroupCount());
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());
@ -166,27 +154,23 @@ public class RosterTest extends TestCase {
public void testDeleteAllUnfiledRosterEntries() { public void testDeleteAllUnfiledRosterEntries() {
try { try {
// Add a new roster entry // Add a new roster entry
conn1.getRoster().createEntry("gato11@localhost", "gato11", null); conn1.getRoster().createEntry("gato11@" + conn1.getHost(), "gato11", null);
conn1.getRoster().createEntry("gato12@localhost", "gato12", null); conn1.getRoster().createEntry("gato12@" + conn1.getHost(), "gato12", null);
Thread.sleep(100); Thread.sleep(200);
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(100); Thread.sleep(250);
} }
assertEquals("The number of entries in conn1 should be 0", 0, assertEquals("The number of entries in conn1 should be 0", 0, conn1.getRoster().getEntryCount());
conn1.getRoster().getEntryCount()); assertEquals("The number of groups in conn1 should be 0", 0, conn1.getRoster().getGroupCount());
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, assertEquals("The number of entries in conn2 should be 0", 0, conn2.getRoster().getEntryCount());
conn2.getRoster().getEntryCount()); assertEquals("The number of groups in conn2 should be 0", 0, conn2.getRoster().getGroupCount());
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());
@ -203,9 +187,9 @@ public class RosterTest extends TestCase {
public void testChangeNameToUnfiledEntry() { public void testChangeNameToUnfiledEntry() {
try { try {
// Add a new roster entry // Add a new roster entry
conn1.getRoster().createEntry("gato11@localhost", null, null); conn1.getRoster().createEntry("gato11@" + conn1.getHost(), null, null);
Thread.sleep(100); Thread.sleep(200);
// 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();
@ -216,7 +200,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(100); Thread.sleep(2000);
it = conn1.getRoster().getEntries(); it = conn1.getRoster().getEntries();
while (it.hasNext()) { while (it.hasNext()) {
RosterEntry entry = (RosterEntry) it.next(); RosterEntry entry = (RosterEntry) it.next();
@ -230,7 +214,6 @@ public class RosterTest extends TestCase {
} }
} }
/** /**
* Clean up all the entries in the roster * Clean up all the entries in the roster
*/ */
@ -242,24 +225,18 @@ public class RosterTest extends TestCase {
conn1.getRoster().removeEntry(entry); conn1.getRoster().removeEntry(entry);
} }
try { try {
Thread.sleep(100); Thread.sleep(700);
} }
catch (Exception e) {} catch (Exception e) {}
assertEquals("The number of entries in conn1 should be 0", 0, assertEquals("The number of entries in conn1 should be 0", 0, conn1.getRoster().getEntryCount());
conn1.getRoster().getEntryCount()); assertEquals("The number of groups in conn1 should be 0", 0, conn1.getRoster().getGroupCount());
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, assertEquals("The number of entries in conn2 should be 0", 0, conn2.getRoster().getEntryCount());
conn2.getRoster().getEntryCount()); assertEquals("The number of groups in conn2 should be 0", 0, conn2.getRoster().getGroupCount());
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, assertEquals("The number of entries in conn3 should be 0", 0, conn3.getRoster().getEntryCount());
conn3.getRoster().getEntryCount()); assertEquals("The number of groups in conn3 should be 0", 0, conn3.getRoster().getGroupCount());
assertEquals("The number of groups in conn3 should be 0", 0,
conn3.getRoster().getGroupCount());
} }
/* /*
@ -278,9 +255,8 @@ 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");
@ -294,6 +270,7 @@ public class RosterTest extends TestCase {
catch (Exception e) { catch (Exception e) {
fail(e.getMessage()); fail(e.getMessage());
} }
} }
/* /*