use of jetbrains.communicator.util.WaitFor in project intellij-plugins by JetBrains.
the class JabberFacade_ConnectionTest method testPresenceAfterConnection.
public void testPresenceAfterConnection() throws Throwable {
createGoodAccount(myUser, myFacade);
final String me = myFacade.getConnection().getUser();
myFacade.getConnection().getRoster().setSubscriptionMode(Roster.SubscriptionMode.accept_all);
final JabberFacadeImpl another = new JabberFacadeImpl(myIDEFacade);
createGoodAccount("ddd" + System.currentTimeMillis(), another);
another.addUsers("group", Arrays.asList(me));
new WaitFor(3000) {
@Override
protected boolean condition() {
return another.getConnection().getRoster().getPresence(me) != null;
}
};
Presence presence = another.getConnection().getRoster().getPresence(me);
assertNotNull(presence);
assertEquals(Presence.Type.available, presence.getType());
assertEquals(Presence.Mode.available, presence.getMode());
}
use of jetbrains.communicator.util.WaitFor in project intellij-plugins by JetBrains.
the class JabberFacade_ConnectionTest method testAddUsers.
public void testAddUsers() throws Exception {
createGoodAccount(myUser, myFacade);
final String bob = "bob@jabber.org";
String self = myFacade.getConnection().getUser();
myFacade.addUsers("someGroup", Arrays.asList(self, bob));
final Roster roster = myFacade.getConnection().getRoster();
new WaitFor(500) {
@Override
protected boolean condition() {
return roster.contains(bob);
}
};
assertTrue("User should be added to the Roster", roster.contains(bob));
assertFalse("Self should not be added to the Roster", roster.contains(self));
new WaitFor(200) {
@Override
protected boolean condition() {
return roster.getEntry(bob).getGroups().size() > 0;
}
};
assertEquals("Bad Group", "someGroup", roster.getEntry(bob).getGroups().iterator().next().getName());
}
Aggregations