Search in sources :

Example 6 with MockTransport

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());
}
Also used : User(jetbrains.communicator.core.users.User) MockTransport(jetbrains.communicator.mock.MockTransport) UserPresence(jetbrains.communicator.core.users.UserPresence)

Example 7 with MockTransport

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);
}
Also used : MessageEvent(jetbrains.communicator.core.transport.MessageEvent) MockTransport(jetbrains.communicator.mock.MockTransport)

Example 8 with MockTransport

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());
}
Also used : User(jetbrains.communicator.core.users.User) MockUser(jetbrains.communicator.mock.MockUser) MockTransport(jetbrains.communicator.mock.MockTransport) UserPresence(jetbrains.communicator.core.users.UserPresence) MockTransport(jetbrains.communicator.mock.MockTransport) Transport(jetbrains.communicator.core.transport.Transport)

Example 9 with MockTransport

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());
}
Also used : MockTransport(jetbrains.communicator.mock.MockTransport)

Example 10 with MockTransport

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());
}
Also used : MockTransport(jetbrains.communicator.mock.MockTransport) CodePointerEvent(jetbrains.communicator.core.transport.CodePointerEvent)

Aggregations

MockTransport (jetbrains.communicator.mock.MockTransport)13 User (jetbrains.communicator.core.users.User)4 MockMessage (jetbrains.communicator.mock.MockMessage)3 MockUser (jetbrains.communicator.mock.MockUser)3 LocalMessage (jetbrains.communicator.core.dispatcher.LocalMessage)2 MessageEvent (jetbrains.communicator.core.transport.MessageEvent)2 TransportEvent (jetbrains.communicator.core.transport.TransportEvent)2 UserPresence (jetbrains.communicator.core.users.UserPresence)2 Message (jetbrains.communicator.core.dispatcher.Message)1 CodePointerEvent (jetbrains.communicator.core.transport.CodePointerEvent)1 Transport (jetbrains.communicator.core.transport.Transport)1 SendMessageEvent (jetbrains.communicator.ide.SendMessageEvent)1 Element (org.jdom.Element)1