Search in sources :

Example 1 with IDEtalkAdapter

use of jetbrains.communicator.core.IDEtalkAdapter in project intellij-plugins by JetBrains.

the class TestUtil method testSendMessage_Functional.

public static void testSendMessage_Functional(BaseTestCase testCase, User self) {
    final String[] log = new String[] { "" };
    final long[] whenSent = new long[1];
    testCase.getBroadcaster().addListener(new IDEtalkAdapter() {

        @Override
        public void afterChange(IDEtalkEvent event) {
            event.accept(new EventVisitor() {

                @Override
                public void visitMessageEvent(MessageEvent event) {
                    super.visitMessageEvent(event);
                    log[0] += event.getRemoteUser() + ' ' + event.getMessage();
                    if (event.getWhen().getTime() - whenSent[0] < 150) {
                        log[0] += " timingOK";
                    } else {
                        log[0] += (event.getWhen().getTime() - whenSent[0]);
                    }
                }
            });
        }
    });
    testCase.markLastListenerForCleanup();
    log[0] = "";
    String comment = "SS��� messa&&ge";
    whenSent[0] = System.currentTimeMillis();
    self.sendMessage(comment, testCase.getBroadcaster());
    new WaitFor(500) {

        @Override
        protected boolean condition() {
            return log[0].length() > 0;
        }
    };
    assertEquals("Message expected", self.getName() + ' ' + comment + " timingOK", log[0]);
}
Also used : EventVisitor(jetbrains.communicator.core.EventVisitor) WaitFor(jetbrains.communicator.util.WaitFor) IDEtalkEvent(jetbrains.communicator.core.IDEtalkEvent) MessageEvent(jetbrains.communicator.core.transport.MessageEvent) IDEtalkAdapter(jetbrains.communicator.core.IDEtalkAdapter)

Example 2 with IDEtalkAdapter

use of jetbrains.communicator.core.IDEtalkAdapter in project intellij-plugins by JetBrains.

the class TestUtil method testSendCodePointer_Functional.

public static void testSendCodePointer_Functional(BaseTestCase testCase, User self) {
    final String[] log = new String[] { "" };
    testCase.getBroadcaster().addListener(new IDEtalkAdapter() {

        @Override
        public void afterChange(IDEtalkEvent event) {
            event.accept(new EventVisitor() {

                @Override
                public void visitCodePointerEvent(CodePointerEvent event) {
                    log[0] += event.getRemoteUser() + ' ';
                    log[0] += event.getComment();
                    log[0] += event.getCodePointer().toString();
                    log[0] += event.getFile().toString();
                }
            });
        }
    });
    testCase.markLastListenerForCleanup();
    log[0] = "";
    CodePointer pointer = new CodePointer(0, 1);
    VFile file = VFile.create("path");
    self.sendCodeIntervalPointer(file, pointer, "comment���< && 53", testCase.getBroadcaster());
    new WaitFor(2000) {

        @Override
        protected boolean condition() {
            return log[0].length() > 0;
        }
    };
    Assert.assertEquals("Code Pointer expected", self.getName() + " comment���< && 53" + pointer + file, log[0]);
}
Also used : EventVisitor(jetbrains.communicator.core.EventVisitor) WaitFor(jetbrains.communicator.util.WaitFor) IDEtalkEvent(jetbrains.communicator.core.IDEtalkEvent) CodePointerEvent(jetbrains.communicator.core.transport.CodePointerEvent) CodePointer(jetbrains.communicator.core.vfs.CodePointer) IDEtalkAdapter(jetbrains.communicator.core.IDEtalkAdapter) VFile(jetbrains.communicator.core.vfs.VFile)

Example 3 with IDEtalkAdapter

use of jetbrains.communicator.core.IDEtalkAdapter in project intellij-plugins by JetBrains.

the class MessagesTab method setupIDEtalkListener.

private void setupIDEtalkListener() {
    myListener = new IDEtalkAdapter() {

        @Override
        public void afterChange(IDEtalkEvent event) {
            event.accept(new EventVisitor() {

                @Override
                public void visitSettingsChanged(SettingsChanged settingsChanged) {
                    updateKeyBindings();
                }
            });
        }
    };
    myLocalMessageDispatcher.getBroadcaster().addListener(myListener);
}
Also used : SettingsChanged(jetbrains.communicator.core.users.SettingsChanged) EventVisitor(jetbrains.communicator.core.EventVisitor) IDEtalkEvent(jetbrains.communicator.core.IDEtalkEvent) IDEtalkAdapter(jetbrains.communicator.core.IDEtalkAdapter)

Aggregations

EventVisitor (jetbrains.communicator.core.EventVisitor)3 IDEtalkAdapter (jetbrains.communicator.core.IDEtalkAdapter)3 IDEtalkEvent (jetbrains.communicator.core.IDEtalkEvent)3 WaitFor (jetbrains.communicator.util.WaitFor)2 CodePointerEvent (jetbrains.communicator.core.transport.CodePointerEvent)1 MessageEvent (jetbrains.communicator.core.transport.MessageEvent)1 SettingsChanged (jetbrains.communicator.core.users.SettingsChanged)1 CodePointer (jetbrains.communicator.core.vfs.CodePointer)1 VFile (jetbrains.communicator.core.vfs.VFile)1