Search in sources :

Example 41 with Message

use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.

the class TableDisplayActionsTest method actionDetailsShouldHaveDetails.

@Test
public void actionDetailsShouldHaveDetails() throws Exception {
    // given
    Message message = actionDetailsMessage();
    // when
    commMsgHandler.handle(message);
    // then
    assertThat(tableDisplay.getDetails()).isNotNull();
}
Also used : Message(com.twosigma.beakerx.message.Message) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 42 with Message

use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.

the class TestWidgetUtils method verifyInternalOpenCommMsgWitLayout.

public static void verifyInternalOpenCommMsgWitLayout(List<Message> messages, String modelNameValue, String viewNameValue, String modelModule, String viewModule) {
    Message widget = SearchMessages.getListWidgetsByViewName(messages, viewNameValue).get(0);
    Message layout = SearchMessages.getLayoutForWidget(messages, widget);
    verifyTypeMsg(widget, COMM_OPEN);
    Map data = getState(widget);
    assertThat(data.get(Layout.LAYOUT)).isEqualTo(Layout.IPY_MODEL + layout.getContent().get(Comm.COMM_ID));
    assertThat(data.get(Widget.MODEL_NAME)).isEqualTo(modelNameValue);
    assertThat(data.get(Widget.VIEW_NAME)).isEqualTo(viewNameValue);
}
Also used : Message(com.twosigma.beakerx.message.Message) Map(java.util.Map)

Example 43 with Message

use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.

the class AccordionTest method setTitle_shouldSendCommMessage.

@Test
public void setTitle_shouldSendCommMessage() throws Exception {
    int index = 1;
    // given
    Accordion accordion = new Accordion(children);
    // when
    accordion.set_title(index, "first");
    // then
    Message titlesMessage = SearchMessages.getListMessagesByType(kernel.getPublishedMessages(), JupyterMessages.COMM_MSG).get(0);
    Map titles = (Map) getValueForProperty(titlesMessage, Accordion.TITLES, Object.class);
    Assertions.assertThat(titles.get(index)).isEqualTo("first");
}
Also used : Accordion(com.twosigma.beakerx.widget.Accordion) Message(com.twosigma.beakerx.message.Message) Map(java.util.Map) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 44 with Message

use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.

the class CommOpenHandlerTest method handleMessage_sentMessageHasTargetModule.

@Test
public void handleMessage_sentMessageHasTargetModule() throws Exception {
    // given
    String expectedTargetModule = (String) message.getContent().get(TARGET_MODULE);
    // when
    commOpenHandler.handle(message);
    // then
    Assertions.assertThat(kernel.getSentMessages()).isNotEmpty();
    Message sendMessage = kernel.getSentMessages().get(0);
    Assertions.assertThat(sendMessage.getContent().get(TARGET_MODULE)).isEqualTo(expectedTargetModule);
}
Also used : Message(com.twosigma.beakerx.message.Message) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 45 with Message

use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.

the class CommOpenHandlerTest method handleMessage_sentMessageHasParentHeader.

@Test
public void handleMessage_sentMessageHasParentHeader() throws Exception {
    // given
    String expectedHeader = message.getHeader().asJson();
    // when
    commOpenHandler.handle(message);
    // then
    Assertions.assertThat(kernel.getSentMessages()).isNotEmpty();
    Message sendMessage = kernel.getSentMessages().get(0);
    Assertions.assertThat(sendMessage.getParentHeader().asJson()).isEqualTo(expectedHeader);
}
Also used : Message(com.twosigma.beakerx.message.Message) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Aggregations

Message (com.twosigma.beakerx.message.Message)270 Test (org.junit.Test)170 KernelTest (com.twosigma.beakerx.KernelTest)121 EvaluatorResultTestWatcher.waitForIdleMessage (com.twosigma.beakerx.evaluator.EvaluatorResultTestWatcher.waitForIdleMessage)64 EvaluatorTest (com.twosigma.beakerx.evaluator.EvaluatorTest)57 Code (com.twosigma.beakerx.kernel.Code)55 Serializable (java.io.Serializable)36 MessageFactoryTest.getExecuteRequestMessage (com.twosigma.beakerx.MessageFactoryTest.getExecuteRequestMessage)35 EvaluatorResultTestWatcher.waitForErrorMessage (com.twosigma.beakerx.evaluator.EvaluatorResultTestWatcher.waitForErrorMessage)28 MessageTest (com.twosigma.beakerx.message.MessageTest)27 Map (java.util.Map)26 HashMap (java.util.HashMap)24 Header (com.twosigma.beakerx.message.Header)23 MessageAssertions.verifyExecuteReplyMessage (com.twosigma.MessageAssertions.verifyExecuteReplyMessage)19 EvaluatorResultTestWatcher.waitForSentMessage (com.twosigma.beakerx.evaluator.EvaluatorResultTestWatcher.waitForSentMessage)19 PlainCode (com.twosigma.beakerx.kernel.PlainCode)14 KernelExecutionTest (com.twosigma.beakerx.KernelExecutionTest)13 EvaluatorResultTestWatcher.waitForUpdateMessage (com.twosigma.beakerx.evaluator.EvaluatorResultTestWatcher.waitForUpdateMessage)13 LinkedHashMap (java.util.LinkedHashMap)12 SimpleEvaluationObject (com.twosigma.beakerx.jvm.object.SimpleEvaluationObject)11