use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class ToggleFileAccessCommandTest method testEnableAccessToGroup.
public void testEnableAccessToGroup() throws Exception {
MockUser enabled = new MockUser("enabled", "group");
enabled.setCanAccessMyFiles(true, myUserModel);
MockUser disabled = new MockUser("disabled", "group");
disabled.setCanAccessMyFiles(false, myUserModel);
myUserModel.addUser(enabled);
myUserModel.addUser(disabled);
myUserListComponent.stubs().method("getSelectedNodes").will(returnValue(new Object[] { "group" }));
myCommand.execute();
assertTrue("Should change access to disabled", disabled.canAccessMyFiles());
assertFalse("Should change access to enabled", enabled.canAccessMyFiles());
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class FindUsersCommandTest method testOnlySelfFound.
public void testOnlySelfFound() throws Exception {
final BaseUserImpl self = new MockUser();
myTransportMock.expects(once()).method("findUsers").will(returnValue(new User[] { self }));
myTransportMock1.expects(once()).method("findUsers").will(returnValue(new User[] { self }));
myCommand.execute();
assertTrue(myIDEFacade.getAndClearLog().startsWith("showMessage"));
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class UserListComponentTest method testGetSelectedNodes.
public void testGetSelectedNodes() throws Exception {
myUserModel.addGroup("a group");
MockUser user = new MockUser("user", "group");
myUserModel.addUser(user);
JTree jTree = getTree();
jTree.expandRow(1);
jTree.setSelectionInterval(0, 2);
Object[] selectedNodes = myUserListComponent.getSelectedNodes();
assertEquals("a group", selectedNodes[0]);
assertEquals("group", selectedNodes[1]);
assertEquals(user, selectedNodes[2]);
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class UserListComponentTest method testSaveLoadTreeState.
public void testSaveLoadTreeState() throws Exception {
myUserModel.addUser(new MockUser("user1", "group"));
myUserModel.addUser(new MockUser("user2", "group"));
myUserModel.addGroup("daaa");
myUserModel.addUser(new MockUser("user3", "zzzz"));
TreeUtils.collapseAll(getTree());
getTree().expandRow(1);
assertEquals("Sanity check", 5, getTree().getRowCount());
myUserListComponent.saveState();
myUserListComponent = new UserListComponentImpl(myUserModel, myIdeFacade, myLocalMessageDispatcher);
disposeOnTearDown(myUserListComponent);
assertEquals("Tree state should be restored", 5, getTree().getRowCount());
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class AsyncMessageDispatcherTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
myIdeFacade = new MockIDEFacade(getClass());
myUser = new MockUser("user", null);
myUser.setOnline(true);
myDispatcher = new AsyncMessageDispatcherImpl(getBroadcaster(), myIdeFacade);
new WaitFor(1000) {
@Override
protected boolean condition() {
return myDispatcher.isRunning();
}
};
myLog = new String[] { "" };
}
Aggregations