RosterSmackTest:: testDeleteAll UnfiledRoster Entries and testDeleteAllUnfiledRosterEntries

Hi

In the testDeleteAllUnfiledRosterEntries below, the assertion for the number of entries in connection 1 fails.

The test seems to assume that the loop “for (RosterEntry entry : roster.getEntries()) {” will remove all roster entries.

The roster, though, has been obtained from connection 0, so it is not clear to me whether removing all entries from a roster from connection 0 should have any effect on the roster for connection 1.

If the rosters for each connection are in fact distinct, which they would be at least in this case as the users for the connections are different, then the logic of the test seems to flawed.

Note that the same argument seems to apply to testDeleteAllUnfiledRosterEntries also.

Any ideas?

Thanks

Nathan

public void testDeleteAllUnfiledRosterEntries() {

try {

// Add a new roster entry

Roster roster = getConnection(0).getRoster();

roster.createEntry(getBareJID(1), “gato11”, null);

roster.createEntry(getBareJID(2), “gato12”, null);

// Wait up to 2 seconds to let the server process presence subscriptions

long initial = System.currentTimeMillis();

while (System.currentTimeMillis() - initial < 2000 && (

!roster.getPresence(getBareJID(1)).isAvailable() ||

!roster.getPresence(getBareJID(2)).isAvailable())) {

Thread.sleep(100);

}

Thread.sleep(200);

for (RosterEntry entry : roster.getEntries()) {

roster.removeEntry(entry);

Thread.sleep(100);

}

// Wait up to 2 seconds to receive roster removal notifications

initial = System.currentTimeMillis();

while (System.currentTimeMillis() - initial < 2000 && roster.getEntryCount() != 0) {

Thread.sleep(100);

}

assertEquals(“Wrong number of entries in connection 0”, 0, roster.getEntryCount());

assertEquals(“Wrong number of groups in connection 0”, 0, roster.getGroupCount());

assertEquals(

“Wrong number of entries in connection 1”,

0,

getConnection(1).getRoster().getEntryCount());

assertEquals(

“Wrong number of groups in connection 1”,

0,

getConnection(1).getRoster().getGroupCount());

}

catch (Exception e) {

fail(e.getMessage());

}

}

Offtopic, but i had to put a few spaces into your thread title, so it don’t brake the layout of the Recent Content widget of the forums. Please, next time keep that in mind. Long title pushes everything to the left in the threads view. This is a bug that Jive can’t fix for ages…