Search in sources :

Example 81 with Message

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

the class KernelExecutionTest method shouldUnimportDemoClassByMagicCommand.

@Test
public void shouldUnimportDemoClassByMagicCommand() throws Exception {
    // given
    addDemoJar();
    String path = pathToDemoClassFromAddedDemoJar();
    Code code = CodeFactory.create(IMPORT + " " + path, new Message(), getKernel());
    code.execute(kernel, 1);
    // when
    Code code2 = CodeFactory.create(UNIMPORT + " " + path, new Message(), getKernel());
    code2.execute(kernel, 2);
    // then
    // assertThat(status).isEqualTo(MagicCommandOutcomeItem.Status.OK);
    verifyUnImportedDemoClassByMagicCommand();
}
Also used : MessageAssertions.verifyExecuteReplyMessage(com.twosigma.MessageAssertions.verifyExecuteReplyMessage) EvaluatorResultTestWatcher.waitForIdleMessage(com.twosigma.beakerx.evaluator.EvaluatorResultTestWatcher.waitForIdleMessage) Message(com.twosigma.beakerx.message.Message) MessageFactoryTest.getExecuteRequestMessage(com.twosigma.beakerx.MessageFactoryTest.getExecuteRequestMessage) EvaluatorResultTestWatcher.waitForErrorMessage(com.twosigma.beakerx.evaluator.EvaluatorResultTestWatcher.waitForErrorMessage) EvaluatorResultTestWatcher.waitForSentMessage(com.twosigma.beakerx.evaluator.EvaluatorResultTestWatcher.waitForSentMessage) Code(com.twosigma.beakerx.kernel.Code) Test(org.junit.Test)

Example 82 with Message

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

the class KernelTest method sendBusyMessage.

@Override
public void sendBusyMessage(Message message) {
    Message busyMessage = MessageCreator.createBusyMessage(message);
    publish(Collections.singletonList(busyMessage));
}
Also used : Message(com.twosigma.beakerx.message.Message)

Example 83 with Message

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

the class DisplayTest method verifyText.

private void verifyText() {
    Message message = kernel.getPublishedMessages().get(0);
    assertThat(message.type()).isEqualTo(JupyterMessages.DISPLAY_DATA);
    assertThat(getData(message).get(MIMEContainer.MIME.TEXT_PLAIN)).isEqualTo("Hello");
}
Also used : Message(com.twosigma.beakerx.message.Message)

Example 84 with Message

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

the class DisplayTest method verifyWidget.

private void verifyWidget() {
    Message message = kernel.getPublishedMessages().stream().filter(x -> x.type().equals(JupyterMessages.DISPLAY_DATA)).collect(Collectors.toList()).get(0);
    assertThat(getData(message).get(Widget.APPLICATION_VND_JUPYTER_WIDGET_VIEW_JSON)).isNotNull();
}
Also used : Message(com.twosigma.beakerx.message.Message)

Example 85 with Message

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

the class GroovyKernelTest method shouldNotImportStaticNotStaticPathByMagicCommand.

@Test
public void shouldNotImportStaticNotStaticPathByMagicCommand() throws Exception {
    // given
    addDemoJar();
    String path = "garbage";
    // when
    Code code = CodeFactory.create(ADD_STATIC_IMPORT + " " + path, new Message(), getKernel());
    code.execute(kernel, 1);
    // then
    verifyNotImportedStaticMagicCommand();
}
Also used : MessageFactoryTest.getExecuteRequestMessage(com.twosigma.beakerx.MessageFactoryTest.getExecuteRequestMessage) EvaluatorResultTestWatcher.waitForIdleMessage(com.twosigma.beakerx.evaluator.EvaluatorResultTestWatcher.waitForIdleMessage) Message(com.twosigma.beakerx.message.Message) EvaluatorResultTestWatcher.waitForUpdateMessage(com.twosigma.beakerx.evaluator.EvaluatorResultTestWatcher.waitForUpdateMessage) Code(com.twosigma.beakerx.kernel.Code) KernelExecutionTest(com.twosigma.beakerx.KernelExecutionTest) Test(org.junit.Test)

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