mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 09:09:38 +02:00
Add Roster.createItem() and Roster.createItemAndRequestSubscription()
and deprecate createEntry(). createEntry() would also send a subscription request which may is suprising given that you can also create an roster item without having to send a subscription request out. This also fixes a bug in LowLevelRosterIntegrationTest.testPresenceEventListenersOffline() where createEntry() was used, which would also trigger a presence subscription request which in turn made the test fail if the SubscribeListener of ensureSubscribedTo() was not yet set up. So the test would fail depending on the timing.
This commit is contained in:
parent
c31e93a00f
commit
9c4e5d0330
4 changed files with 54 additions and 10 deletions
|
@ -42,9 +42,8 @@ public class LowLevelRosterIntegrationTest extends AbstractSmackLowLevelIntegrat
|
|||
final Roster rosterOne = Roster.getInstanceFor(conOne);
|
||||
final Roster rosterTwo = Roster.getInstanceFor(conTwo);
|
||||
|
||||
// TODO create Roster.createEntry() with boolean flag for subscribe or not.
|
||||
rosterOne.createEntry(conTwo.getUser().asBareJid(), "Con Two", null);
|
||||
rosterTwo.createEntry(conOne.getUser().asBareJid(), "Con One", null);
|
||||
rosterOne.createItem(conTwo.getUser().asBareJid(), "Con Two", null);
|
||||
rosterTwo.createItem(conOne.getUser().asBareJid(), "Con One", null);
|
||||
|
||||
// TODO Change timeout form '5000' to something configurable.
|
||||
final long timeout = 5000;
|
||||
|
|
|
@ -99,7 +99,7 @@ public class RosterIntegrationTest extends AbstractSmackIntegrationTest {
|
|||
});
|
||||
|
||||
try {
|
||||
rosterOne.createEntry(conTwo.getUser().asBareJid(), conTwosRosterName, null);
|
||||
rosterOne.createItemAndRequestSubscription(conTwo.getUser().asBareJid(), conTwosRosterName, null);
|
||||
|
||||
assertTrue(addedAndSubscribed.waitForResult(2 * connection.getReplyTimeout()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue