Package jetbrains.communicator.util

Examples of jetbrains.communicator.util.WaitFor


    synchronized(myWorkingThreadLock) {
      myWorkingThread = null;
      myWorkingThreadLock.notifyAll();
    }
    new WaitFor(10000){
      protected boolean condition() {
        return !isRunning();
      }
    };
View Full Code Here


  @Override
  public User[] findUsers(ProgressIndicator progressIndicator) {
    for(int  i = 0; i < 20; i ++) {
      progressIndicator.setText("ddd" + i);
      progressIndicator.setFraction(1.0 * (i + 1) / 20);
      new WaitFor(200){
        @Override
        protected boolean condition() {
          return false;
        }
      };
View Full Code Here

    // Add self to contact list
    User self = myUserModel.createUser(StringUtil.getMyUsername(), myTransport.getName());
    myUserModel.addUser(self);

    // Wait for next cycle of user finding
    new WaitFor(1000) { @Override
                        protected boolean condition() { return !myTransport.getUserMonitorThread().isFinding(); } };

    // make self away
    UserPresence presence = new UserPresence(PresenceMode.AWAY);
    assert presence.isOnline();
    myTransport.setOwnPresence(presence);

    // make sure that away status will be updated
    myTransport.findUsers(new NullProgressIndicator());
    assert PresenceMode.AWAY == self.getPresence().getPresenceMode();

    // Now, test itself. We go online and want this status to be updated almost immediately.
    myEvents.clear();
    addEventListener();
    myTransport.setOwnPresence(new UserPresence(PresenceMode.AVAILABLE));

    final User self1 = self;
    new WaitFor(200) {
      @Override
      protected boolean condition() {
        return self1.getPresence().getPresenceMode() == PresenceMode.AVAILABLE;
      }
    };
View Full Code Here

    addEventListener();

    assertNull(createGoodAccount());

    Thread.sleep(120);
    new WaitFor(500) {
      @Override
      protected boolean condition() {
        return myEvents.size() > 0;
      }
    };

    myTransport.synchronizeRoster(true);
    new WaitFor(TIMEOUT) {
      @Override
      protected boolean condition() {
        return myUserModel.getAllUsers().length == 0;
      }
    };
View Full Code Here

    User user = ((UserEvent.Added) event).getUser();
    assertEquals("Jabber user expected", "Jabber", user.getTransportCode());
    assertEquals("Should add Jabber user", fred, user.getName());
    assertEquals("Wrong group", "aGroup", user.getGroup());

    new WaitFor(TIMEOUT) {
      @Override
      protected boolean condition() {
        return myFacade.getConnection().getRoster().getPresence(fred) != null;
      }
    };
View Full Code Here

    waitForEvent();
  }

  private void waitForEvent() {
    new WaitFor(TIMEOUT) {
      @Override
      protected boolean condition() {
        return myEvents.size() > 0;
      }
    };
View Full Code Here

    User user = myUserModel.getAllUsers()[0];
    final Roster roster = myFacade.getConnection().getRoster();

    // Change group:
    user.setGroup("someOtherGroup", myUserModel);
    new WaitFor(TIMEOUT) {
      @Override
      protected boolean condition() {
        return roster.getGroupCount() == 1 && roster.getGroup("someOtherGroup") != null;
      }
    };

    assertEquals("One group expected", 1, roster.getGroupCount());
    RosterGroup group = roster.getGroup("someOtherGroup");
    assertNotNull(group);
    assertEquals(1, group.getEntryCount());
    assertNotNull(group.getEntry(FRED));

    // Change Display name:
    user.setDisplayName("Some new name", myUserModel);
    new WaitFor(TIMEOUT) {
      @Override
      protected boolean condition() {
        return "Some new name".equals(roster.getEntry(FRED).getName());
      }
    };
    assertEquals("User name in Roster should have changed", "Some new name", roster.getEntry(FRED).getName());

    // Delete user:
    myUserModel.removeUser(user);
    new WaitFor(TIMEOUT) {
      @Override
      protected boolean condition() {
        return roster.getEntryCount() == 0;
      }
    };
View Full Code Here

  public void testDisconnectFromJabber() throws Exception {
    String userName = "bob" + System.currentTimeMillis();
    XMPPConnection contact = createLocalConnectionWithJabberUser(userName, null);

    myTransport.getFacade().addUsers("General", Arrays.asList(getUser(contact)));
    new WaitFor(TIMEOUT) {

      @Override
      protected boolean condition() {
        return 1 == myUserModel.getAllUsers().length && myUserModel.getAllUsers()[0].isOnline();
      }
View Full Code Here

    final User bob = UserImpl.create(jabberUser, myTransport.getName());

    myEvents.clear();
    roster.createEntry(jabberUser, "Bob", new String[0]);
    new WaitFor(TIMEOUT) {
      @Override
      protected boolean condition() {
        return myEvents.size() == 2;
      }
    };
    assertTrue("Bob should be online", bob.isOnline());
    assertEquals("/ideTalk/jabber.png", myTransport.getIcon(bob.getPresence()));

    assertEquals("One user in UserModel expected:" + Arrays.asList(myUserModel.getAllUsers()),
        1, myUserModel.getAllUsers().length);
    UserEvent.Online online = ((UserEvent.Online) myEvents.get(1));
    assertEquals("Online event expected", bob, online.getUser());

    myEvents.clear();

    Presence presence = new Presence(Presence.Type.unavailable);
    contact.sendPacket(presence);

    new WaitFor(TIMEOUT){
      @Override
      protected boolean condition() {
        return  myEvents.size() == 1;
      }
    };
View Full Code Here

    setIgnoreList("erts\r\nsomeId");

    final XMPPConnection conn = createLocalConnectionWithJabberUser("aaasomeId" + System.nanoTime(), null);
    conn.getRoster().createEntry(selfJabberId(), "name", new String[0]);

    new WaitFor(2000) {
      @Override
      protected boolean condition() {
        return conn.getRoster().getEntry(selfJabberId()).getType() == RosterPacket.ItemType.BOTH;
      }
    };
View Full Code Here

TOP

Related Classes of jetbrains.communicator.util.WaitFor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.