use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class OutputWidgetTest method shouldSendCommMsgWhenAppendStderr.
@Test
public void shouldSendCommMsgWhenAppendStderr() throws Exception {
// given
Output output = new Output();
groovyKernel.clearPublishedMessages();
// when
output.appendStderr("Error 1");
// then
Message streamMessage = EvaluatorResultTestWatcher.getStreamMessage(groovyKernel).get();
assertThat(streamMessage.getContent().get(OUTPUT_TYPE)).isEqualTo(Output.STREAM.toString());
assertThat(streamMessage.getContent().get(Output.NAME)).isEqualTo(Output.STDERR);
assertThat(streamMessage.getContent().get(Output.TEXT)).isEqualTo("Error 1\n");
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class OutputWidgetTest method shouldSendCommMsgWhenAppendStdout.
@Test
public void shouldSendCommMsgWhenAppendStdout() throws Exception {
// given
Output output = new Output();
groovyKernel.clearPublishedMessages();
// when
output.appendStdout("Hello 1");
// then
Message streamMessage = EvaluatorResultTestWatcher.getStreamMessage(groovyKernel).get();
assertThat(streamMessage.getContent().get(OUTPUT_TYPE)).isEqualTo(Output.STREAM.toString());
assertThat(streamMessage.getContent().get(Output.NAME)).isEqualTo(Output.STDOUT);
assertThat(streamMessage.getContent().get(Output.TEXT)).isEqualTo("Hello 1\n");
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class TabTest method verifyChildren.
private void verifyChildren(List<Widget> children) {
Message message = kernel.getPublishedMessages().get(1);
Map data = getState(message);
Object[] objects = (Object[]) data.get(Tab.CHILDREN);
assertThat(objects[0]).isEqualTo(Tab.IPY_MODEL + children.get(0).getComm().getCommId());
assertThat(objects[1]).isEqualTo(Tab.IPY_MODEL + children.get(1).getComm().getCommId());
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class TextTest method verifyTextField.
public static void verifyTextField(List<Message> messages, String modelNameValue, String modelModuleValue, String viewNameValue, String viewModuleValue) {
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)).isEqualTo(IPY_MODEL + layout.getContent().get(Comm.COMM_ID));
assertThat(data.get(MODEL_NAME)).isEqualTo(modelNameValue);
assertThat(data.get(MODEL_MODULE)).isEqualTo(modelModuleValue);
assertThat(data.get(VIEW_NAME)).isEqualTo(viewNameValue);
assertThat(data.get(VIEW_MODULE)).isEqualTo(viewModuleValue);
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ClojureCommOpenHandlerTest method handleMessage_shouldSendShellSocketMessage.
@Test
public void handleMessage_shouldSendShellSocketMessage() throws Exception {
// given
Message message = JupyterHandlerTest.initOpenMessage();
// when
commOpenHandler.handle(message);
// then
Assertions.assertThat(kernel.getSentMessages()).isNotEmpty();
}
Aggregations