Search in sources :

Example 36 with MockUser

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

the class DeleteCommandTest method testMessageIgnoresUserFromDeletedGroup.

public void testMessageIgnoresUserFromDeletedGroup() throws Exception {
    MockUser user = new MockUser("userName", "aGroup");
    myUserModel.addUser(user);
    assertMessage("group \"aGroup\" with its 1 user", new Object[] { "aGroup", user });
}
Also used : MockUser(jetbrains.communicator.mock.MockUser)

Example 37 with MockUser

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

the class DeleteCommandTest method testDeleteGroup_WithUsers.

public void testDeleteGroup_WithUsers() throws Exception {
    myUserModel.addUser(new MockUser("user", GROUP_NAME));
    myUserListComponentMock.stubs().method("getSelectedNodes").will(returnValue(new Object[] { GROUP_NAME }));
    assertTrue("Deleteion of group should be enabled - we delete groups with users", myCommand.isEnabled());
    myIDEFacade.expects(once()).method("askQuestion").will(returnValue(true));
    myCommand.execute();
    assertEquals(0, myUserModel.getAllUsers().length);
    assertEquals(0, myUserModel.getGroups().length);
}
Also used : MockUser(jetbrains.communicator.mock.MockUser)

Example 38 with MockUser

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

the class FindUsersCommandTest method testSetGroupBasingOnSelection.

public void testSetGroupBasingOnSelection() throws Exception {
    final MockUser teddy = setTeddyUserIsFound();
    myUserModelMock.expects(once()).method("hasUser").with(eq(teddy)).will(returnValue(false));
    myUserModelMock.expects(once()).method("getGroups").will(returnValue(null));
    myIDEFacade.setReturnedData(new FindUsersCommand.UsersInfo(new User[] { teddy }, UserModel.AUTO_GROUP));
    teddy.setProjects(new String[] { "projectForTeddy" });
    myUserModelMock.expects(once()).method("findUser").with(eq(teddy.getName()), eq(teddy.getTransportCode())).will(returnValue(teddy));
    myUserModelMock.expects(once()).method("addUser").with(eq(teddy));
    myCommand.execute();
    assertEquals("Group should be set from project name", "projectForTeddy", teddy.getGroup());
}
Also used : User(jetbrains.communicator.core.users.User) MockUser(jetbrains.communicator.mock.MockUser) MockUser(jetbrains.communicator.mock.MockUser)

Example 39 with MockUser

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

the class FindUsersCommandTest method setTeddyUserIsFound.

private MockUser setTeddyUserIsFound() throws UnknownHostException {
    final MockUser teddy = new MockUser("teddy", "");
    myTransportMock.expects(once()).method("findUsers").will(returnValue(new User[] { teddy }));
    myTransportMock1.expects(once()).method("findUsers").will(returnValue(new User[0]));
    return teddy;
}
Also used : User(jetbrains.communicator.core.users.User) MockUser(jetbrains.communicator.mock.MockUser) MockUser(jetbrains.communicator.mock.MockUser)

Example 40 with MockUser

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

the class TestFactory method createUserListWithUsers.

public static UserModel createUserListWithUsers(BaseTestCase test) throws UnknownHostException {
    UserModelImpl result = new UserModelImpl(test.getBroadcaster());
    test.disposeOnTearDown(result);
    result.addUser(new MockUser("aaa", "group1"));
    result.addUser(new MockUser("ccc", "group1"));
    result.addUser(new MockUser("zzz", "group2", true));
    result.addUser(new MockUser("aaaa", "group2"));
    result.addUser(new MockUser("bbb", "group2"));
    Pico.getInstance().registerComponentInstance(UserModel.class, result);
    return result;
}
Also used : UserModelImpl(jetbrains.communicator.core.impl.users.UserModelImpl) 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