use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ClojureKernelTest method evaluateFibSeq.
@Test
public void evaluateFibSeq() throws Exception {
// given
String code = "" + "(def fib-seq-lazy \n" + " ((fn rfib [a b] \n" + " (lazy-seq (cons a (rfib b (+ a b)))))\n" + " 0 1))\n" + "(take 20 fib-seq-lazy)";
Message message = getExecuteRequestMessage(code);
// when
kernelSocketsService.handleMsg(message);
// then
Optional<Message> idleMessage = waitForIdleMessage(kernelSocketsService.getKernelSockets());
assertThat(idleMessage).isPresent();
Optional<Message> result = waitForResult(kernelSocketsService.getKernelSockets());
checkResultForErrors(result, code);
verifyResult(result.get());
verifyPublishedMsgs(kernelSocketsService);
waitForSentMessage(kernelSocketsService.getKernelSockets());
verifySentMsgs(kernelSocketsService);
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class GroovyKernelInfoHandlerTest method handle_messageContentHasGroovyLabel.
@Test
public void handle_messageContentHasGroovyLabel() throws Exception {
// when
handler.handle(message);
// then
Message sentMessage = kernel.getSentMessages().get(0);
Map<String, Serializable> map = sentMessage.getContent();
Assertions.assertThat(map).isNotNull();
Assertions.assertThat(map.get("implementation")).isEqualTo("groovy");
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ClojureKernelInfoHandlerTest method handle_sentMessageHasLanguageInfo.
@Test
public void handle_sentMessageHasLanguageInfo() throws Exception {
// when
handler.handle(message);
// then
Message sentMessage = kernel.getSentMessages().get(0);
Map<String, Serializable> map = sentMessage.getContent();
Assertions.assertThat(map).isNotNull();
Assertions.assertThat(map.get("language_info")).isNotNull();
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ClojureKernelInfoHandlerTest method handle_sentMessageHasContent.
@Test
public void handle_sentMessageHasContent() throws Exception {
// when
handler.handle(message);
// then
Message sentMessage = kernel.getSentMessages().get(0);
Assertions.assertThat(sentMessage.getContent()).isNotEmpty();
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class GroovyOutputContainerTest method verifyPlot.
private void verifyPlot(List<Message> messages) {
Message tableDisplay = messages.get(0);
verifyInternalOpenCommMsg(tableDisplay, BeakerxPlot.MODEL_NAME_VALUE, BeakerxPlot.VIEW_NAME_VALUE);
// Message model = messages.get(1);
// assertThat(getValueForProperty(model, "model", Map.class)).isNotEmpty();
// verifyDisplayMsg(messages);
}
Aggregations