use of jetbrains.communicator.mock.MockTransport in project intellij-plugins by JetBrains.
the class UserTest method testIsOnline.
public void testIsOnline() throws Exception {
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);
assertTrue("Corresponding transport is created - should be online now", myUser.isOnline());
}
use of jetbrains.communicator.mock.MockTransport in project intellij-plugins by JetBrains.
the class EventsProcessorTest method testIncomingMessage_No_Tab_WithoutExpand.
public void testIncomingMessage_No_Tab_WithoutExpand() throws Exception {
IdeaFlags.EXPAND_ON_MESSAGE.change(false);
MessageEvent event = EventFactory.createMessageEvent(new MockTransport(), "bob", "text");
myMock.expects(once()).method("newMessageAvailable").with(eq(myUserModel.createUser("bob", MockTransport.NAME)), eq(event));
myMock.expects(once()).method("getWindow").will(returnValue(null));
getBroadcaster().fireEvent(event);
}
use of jetbrains.communicator.mock.MockTransport in project intellij-plugins by JetBrains.
the class ToggleFileAccessCommandTest method testMultipleSelection_OfflineUsersHidden.
public void testMultipleSelection_OfflineUsersHidden() throws Exception {
final User user1 = myUserModel.createUser("user1", MockTransport.NAME);
final User user2 = myUserModel.createUser("user2", MockTransport.NAME);
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").will(returnValue(new Object[] { "grp", user2 }));
myUserModel.addUser(user1);
myUserModel.addUser(user2);
user1.setGroup("grp", myUserModel);
user2.setCanAccessMyFiles(true, myUserModel);
assertFalse("Different state of canAccess flag", myCommand.isEnabled());
OptionFlag.OPTION_HIDE_OFFLINE_USERS.change(true);
assertTrue("Only online user should be considered", myCommand.isEnabled());
myCommand.execute();
assertTrue("Should change online user", user1.canAccessMyFiles());
assertTrue("Should keep offline user", user2.canAccessMyFiles());
}
use of jetbrains.communicator.mock.MockTransport in project intellij-plugins by JetBrains.
the class IDEAFacadeTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
myTransport = new MockTransport();
myFacade = new IDEAFacade();
myUser = UserImpl.create("user", myTransport.getName());
}
use of jetbrains.communicator.mock.MockTransport in project intellij-plugins by JetBrains.
the class CodePointerLocalMessageTest method testLinkText.
private void testLinkText(String expected, String path, int line1, int line2) {
CodePointerEvent event = EventFactory.createCodePointerEvent(new MockTransport(), "remoteUser", VFile.create(path), line1, 22, line2, 43, "comment");
IncomingCodePointerMessage message = new IncomingCodePointerMessage(event, null);
assertEquals("Incorrect link text", expected, message.getLinkText());
}
Aggregations