Package jetbrains.communicator.p2p.commands

Examples of jetbrains.communicator.p2p.commands.AddOnlineUserP2PCommand


  public void testGetAddress() throws Exception {

    User mockUser = UserImpl.create("mock", P2PTransport.CODE);
    assertNull("Sanity check", myTransport.getAddress(mockUser));

    new AddOnlineUserP2PCommand(myTransport.getUserMonitorThread())
        .addOnlineUser("localhost", "mock", 3354, null, null);

    myTransport.flushCurrentUsers();
    assertEquals("Inet address should be set from available online user",
        "localhost", myTransport.getAddress(mockUser).getHostName());
View Full Code Here


  public void testGetProjects() throws Exception {
    User mockUser = UserImpl.create("mock", P2PTransport.CODE);
    assertEquals("Sanity check", 0, myTransport.getProjects(mockUser).length);

    Vector<String> projects = new Vector<String>(Arrays.asList("project1", "project2"));
    new AddOnlineUserP2PCommand(myTransport.getUserMonitorThread())
        .addOnlineUser("localhost", "mock", 0, projects, null);

    myTransport.flushCurrentUsers();
    assertEquals("Projects should be set from available online user",
        projects.toString(), Arrays.asList(myTransport.getProjects(mockUser)).toString());
View Full Code Here

  public void testGetPort() throws Exception {

    User mockUser = UserImpl.create("mock", P2PTransport.CODE);
    assertEquals("Sanity check", -1, myTransport.getPort(mockUser));

    new AddOnlineUserP2PCommand(myTransport.getUserMonitorThread())
        .addOnlineUser("localhost", "mock", 3354, null, null);

    myTransport.flushCurrentUsers();
    assertEquals("Port should be set from available online user",
        3354, myTransport.getPort(mockUser));
View Full Code Here

  public void testGetUserPresence() throws Exception {
    User mockUser = UserImpl.create("mock", P2PTransport.CODE);
    assertEquals("Sanity check", PresenceMode.UNAVAILABLE, myTransport.getUserPresence(mockUser).getPresenceMode());

    new AddOnlineUserP2PCommand(myTransport.getUserMonitorThread())
        .addOnlineUser("localhost", "mock", 3354, null, new UserPresence(PresenceMode.DND).toVector());

    myTransport.flushCurrentUsers();
    assertEquals("User status should be set from available online user",
        PresenceMode.DND, myTransport.getUserPresence(mockUser).getPresenceMode());
View Full Code Here

    myUserMonitorThread = new UserMonitorThread(this, waitUserResponsesTimeout);

    Map<String, Object> handlers = CustomPortServerManager.EP_NAME.findExtension(P2PCustomPortServerManager.class).handlers;
    for (P2PCommand command : new P2PCommand[]{
      new SendXmlMessageP2PCommand(myEventBroadcaster, this),
      new AddOnlineUserP2PCommand(myUserMonitorThread),
    }) {
      handlers.put(command.getXmlRpcId(), command);
    }

    startup();
View Full Code Here

TOP

Related Classes of jetbrains.communicator.p2p.commands.AddOnlineUserP2PCommand

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.