Search in sources :

Example 96 with Message

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

the class JavaKernelInfoHandlerTest 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();
}
Also used : Serializable(java.io.Serializable) Message(com.twosigma.beakerx.message.Message) MessageTest(com.twosigma.beakerx.message.MessageTest) Test(org.junit.Test)

Example 97 with Message

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

the class JavaKernelInfoHandlerTest method handle_messageContentHasJavaLabel.

@Test
public void handle_messageContentHasJavaLabel() 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("java");
}
Also used : Serializable(java.io.Serializable) Message(com.twosigma.beakerx.message.Message) MessageTest(com.twosigma.beakerx.message.MessageTest) Test(org.junit.Test)

Example 98 with Message

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

the class GroovyEasyFormTest method evaluateEasyForm.

@Test
public void evaluateEasyForm() throws Exception {
    // given
    String code = "" + "f = new EasyForm(\"Form and Run\")\n" + "f.addTextField(\"first\", 250)\n" + "f['first'] = \"First\"\n" + "f.addTextField(\"last\", 250)\n" + "f['last'] = \"Last\"\n" + "f.addButton(\"Go!\", \"run\")\n" + "f";
    Message message = getExecuteRequestMessage(code);
    // when
    kernelSocketsService.handleMsg(message);
    Optional<Message> idleMessage = waitForIdleMessage(kernelSocketsService.getKernelSockets());
    // then
    assertThat(idleMessage).isPresent();
    assertMessageExists("Easy form widget was not found.", EasyFormView.VIEW_NAME_VALUE);
}
Also used : EvaluatorResultTestWatcher.waitForIdleMessage(com.twosigma.beakerx.evaluator.EvaluatorResultTestWatcher.waitForIdleMessage) Message(com.twosigma.beakerx.message.Message) MessageFactoryTest.getExecuteRequestMessage(com.twosigma.beakerx.MessageFactoryTest.getExecuteRequestMessage) Test(org.junit.Test)

Example 99 with Message

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

the class GroovyMapLikeTableTest method runTest.

private void runTest(String code) throws InterruptedException {
    Message message = getExecuteRequestMessage(code);
    // when
    kernelSocketsService.handleMsg(message);
    Optional<Message> idleMessage = waitForIdleMessage(kernelSocketsService.getKernelSockets());
    // then
    assertThat(idleMessage).isPresent();
    assertMessageExists("TableDisplay widget was not found.", TableDisplay.VIEW_NAME_VALUE);
}
Also used : EvaluatorResultTestWatcher.waitForIdleMessage(com.twosigma.beakerx.evaluator.EvaluatorResultTestWatcher.waitForIdleMessage) Message(com.twosigma.beakerx.message.Message) MessageFactoryTest.getExecuteRequestMessage(com.twosigma.beakerx.MessageFactoryTest.getExecuteRequestMessage)

Example 100 with Message

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

the class GroovyEvaluatorMagicCommandsTest method runCode.

private TryResult runCode(String code) throws InterruptedException {
    SimpleEvaluationObject seo = new SimpleEvaluationObject(code);
    Message message = new Message();
    seo.setJupyterMessage(message);
    return groovyEvaluator.evaluate(seo, code);
}
Also used : Message(com.twosigma.beakerx.message.Message) SimpleEvaluationObject(com.twosigma.beakerx.jvm.object.SimpleEvaluationObject)

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