Package jetbrains.communicator.core.users

Examples of jetbrains.communicator.core.users.UserPresence


  public void testAddRemoteUser_LoopbackAddress() throws Exception {
    Pico.setUnitTest(false);
    try {
      myUserMonitorClientMock.expects(once()).method("setOnlineUsers") .with(eq(new HashSet()));

      myUserMonitorThread.addOnlineUser("localhost", "nick", new Integer(PORT), new HashSet<String>(), new UserPresence(PresenceMode.AWAY));
      myUserMonitorThread.flushOnlineUsers();
    }
    finally {
      Pico.setUnitTest(true);
    }
View Full Code Here


    User p2PUser = UserImpl.create("nick", P2PTransport.CODE);

    List<String> projects = new ArrayList<String>();
    projects.add("project1");

    OnlineUserInfo onlineUserInfo = new OnlineUserInfo(InetAddress.getByName("localhost"), PORT, projects, new UserPresence(PresenceMode.AWAY));

    myUserMonitorClientMock.expects(once()).method("createUser").with(
        eq("nick"),
        eq(onlineUserInfo)
    ).will(returnValue(p2PUser));

    myUserMonitorThread.addOnlineUser("localhost", "nick", new Integer(PORT), projects, new UserPresence(PresenceMode.AWAY));

    myUserMonitorClientMock.expects(once()).method("setOnlineUsers")
        .with(eq(new HashSet(Arrays.asList(p2PUser))));
  }
View Full Code Here

  }

  public void testSetOwnPresence_OnlineOffline() throws Exception {
    assertTrue("Should be online by default", myTransport.isOnline());

    myTransport.setOwnPresence(new UserPresence(false));
    assertFalse("Should become offline", myTransport.isOnline());

    new WaitFor(1000) {
      @Override
      protected boolean condition() {
        return !mySelf.isOnline();
      }
    };
    assertFalse("Self user should become online", mySelf.isOnline());

    myTransport.setOwnPresence(new UserPresence(true));
    assertTrue("Should become online", myTransport.isOnline());
  }
View Full Code Here

    User p2PUser = UserImpl.create("nick", P2PTransport.CODE);

    List<String> projects = new ArrayList<String>();
    projects.add("project1");

    OnlineUserInfo onlineUserInfo = new OnlineUserInfo(InetAddress.getByName("localhost"), PORT, projects, new UserPresence(PresenceMode.AWAY));

    myUserMonitorClientMock.expects(once()).method("createUser").with(
        eq("nick"),
        eq(onlineUserInfo)
    ).will(returnValue(p2PUser));

    myUserMonitorThread.addOnlineUser("localhost", "nick", new Integer(PORT), projects, new UserPresence(PresenceMode.AWAY));

    myUserMonitorClientMock.expects(once()).method("setOnlineUsers")
        .with(eq(new HashSet(Arrays.asList(p2PUser))));
  }
View Full Code Here

  public boolean isOnline() {
    return false;
  }

  public UserPresence getUserPresence(User user) {
    return new UserPresence(false);
  }
View Full Code Here

  public void run() {
    try {
      myThreadDisposed = false;
      while (!myStop) {
        UserPresence userPresence = calculatePresence();
        LOG.debug("Calculated own presence: " + userPresence);
        for (Object o : Pico.getInstance().getComponentInstancesOfType(Transport.class)) {
          Transport transport = (Transport) o;
          if (transport.isOnline()) {
            transport.setOwnPresence(userPresence);
View Full Code Here

  private UserPresence calculatePresence() {
    synchronized(myMonitor) {
      double inactivitySecs = (System.currentTimeMillis() - myLastActionTimestamp)/1000.0;

      if (inactivitySecs < timeout(IDEtalkOptions.TIMEOUT_AWAY_MIN, AWAY_MINS)) {
        return new UserPresence(PresenceMode.AVAILABLE);
      }
      else if (inactivitySecs < timeout(IDEtalkOptions.TIMEOUT_XA_MIN, EXTENDED_AWAY_MINS)){
        return new UserPresence(PresenceMode.AWAY);
      }
      return new UserPresence(PresenceMode.EXTENDED_AWAY);
    }
  }
View Full Code Here

    assertFalse(myUser.isOnline());

    final MockTransport mockTransport = new MockTransport() {
      @Override
      public UserPresence getUserPresence(User user) {
        return new UserPresence(true);
      }
    };
    Pico.getInstance().registerComponentInstance(mockTransport);

    myUser = UserImpl.create("someUser", MockTransport.NAME);
View Full Code Here

    Pico.getInstance().unregisterComponent(Pico.getInstance().getComponentInstanceOfType(Transport.class));
    MockTransport mockTransport = new MockTransport() {
      @Override
      public UserPresence getUserPresence(User user) {
        return user == user1 ? new UserPresence(true) : new UserPresence(false);
      }
    };
    Pico.getInstance().registerComponentInstance(mockTransport);

    myUserListComponent.stubs().method("getSelectedNodes")
View Full Code Here

    return MockTransport.NAME;
  }

  @Override
  public UserPresence getPresence() {
    return new UserPresence(myOnline);
  }
View Full Code Here

TOP

Related Classes of jetbrains.communicator.core.users.UserPresence

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.