Search in sources :

Example 1 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class P2PTransportTest method testGetAddress.

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());
    myTransport.setOnlineUsers(new HashSet<>());
    assertNull("Inet address should be reset", myTransport.getAddress(mockUser));
}
Also used : AddOnlineUserP2PCommand(jetbrains.communicator.p2p.commands.AddOnlineUserP2PCommand) MockUser(jetbrains.communicator.mock.MockUser)

Example 2 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class P2PTransportTest method testOnUserAdd_AnotherTransport.

public void testOnUserAdd_AnotherTransport() throws Exception {
    User mockUser = UserImpl.create("user", MockTransport.NAME);
    getBroadcaster().fireEvent(new UserEvent.Added(mockUser));
    assertEquals("Should not send notification for another transport:" + myLog, "", myLog);
}
Also used : MockUser(jetbrains.communicator.mock.MockUser)

Example 3 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class JabberTransportTest method testIsOnlineNotConnected.

public void testIsOnlineNotConnected() throws Throwable {
    assertFalse("Not online - return false", UserImpl.create("fake", myTransport.getName()).isOnline());
    assertEquals("Not online - offline icon expected", "/ideTalk/offline.png", myTransport.getIcon(myTransport.getUserPresence(new MockUser())));
}
Also used : MockUser(jetbrains.communicator.mock.MockUser)

Example 4 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class UserTreeTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    UserModelImpl userModel = new UserModelImpl(getBroadcaster());
    disposeOnTearDown(userModel);
    myLocalMessageDispatcher = new LocalMessageDispatcherImpl(getBroadcaster(), new MockIDEFacade(getClass()), userModel);
    disposeOnTearDown(myLocalMessageDispatcher);
    myUserTree = new UserTree(myLocalMessageDispatcher) {

        public void treeDidChange() {
            super.treeDidChange();
            myTreeChanged = true;
        }

        protected void invokeSendMessageAction() {
            mySendMessageInvoked = true;
        }
    };
    myUser = new MockUser();
    myTreePath = new TreePath(myUser);
    myTreeChanged = false;
    mySendMessageInvoked = false;
}
Also used : TreePath(javax.swing.tree.TreePath) MockIDEFacade(jetbrains.communicator.mock.MockIDEFacade) LocalMessageDispatcherImpl(jetbrains.communicator.core.impl.dispatcher.LocalMessageDispatcherImpl) UserModelImpl(jetbrains.communicator.core.impl.users.UserModelImpl) MockUser(jetbrains.communicator.mock.MockUser)

Example 5 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class P2PTransportTest method testIsOnline.

public void testIsOnline() throws Exception {
    User mockUser = myTransport.createUser("mock", new OnlineUserInfo(InetAddress.getLocalHost(), myTransport.getPort()));
    assertFalse(mockUser.isOnline());
    myTransport.setOnlineUsers(Arrays.asList(mockUser));
    assertTrue("should be online now", mockUser.isOnline());
    assertTrue(UserImpl.create("mock", P2PTransport.CODE).isOnline());
}
Also used : MockUser(jetbrains.communicator.mock.MockUser)

Aggregations

MockUser (jetbrains.communicator.mock.MockUser)55 User (jetbrains.communicator.core.users.User)13 VFile (jetbrains.communicator.core.vfs.VFile)5 IDEFacade (jetbrains.communicator.ide.IDEFacade)5 MockIDEFacade (jetbrains.communicator.mock.MockIDEFacade)4 AddOnlineUserP2PCommand (jetbrains.communicator.p2p.commands.AddOnlineUserP2PCommand)4 TreeNode (javax.swing.tree.TreeNode)3 CodePointer (jetbrains.communicator.core.vfs.CodePointer)3 ProjectsData (jetbrains.communicator.core.vfs.ProjectsData)3 EventBroadcaster (jetbrains.communicator.core.EventBroadcaster)2 BaseUserImpl (jetbrains.communicator.core.impl.users.BaseUserImpl)2 UserModelImpl (jetbrains.communicator.core.impl.users.UserModelImpl)2 UserEvent (jetbrains.communicator.core.users.UserEvent)2 WaitFor (jetbrains.communicator.util.WaitFor)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Vector (java.util.Vector)1 TreePath (javax.swing.tree.TreePath)1 LocalMessageDispatcherImpl (jetbrains.communicator.core.impl.dispatcher.LocalMessageDispatcherImpl)1 MockMessage (jetbrains.communicator.mock.MockMessage)1