use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class CommOpenHandlerTest method handleMessage_sentMessageHasTargetName.
@Test
public void handleMessage_sentMessageHasTargetName() throws Exception {
// given
String expectedTargetName = (String) message.getContent().get(TARGET_NAME);
// when
commOpenHandler.handle(message);
// then
Assertions.assertThat(kernel.getSentMessages()).isNotEmpty();
Message sendMessage = kernel.getSentMessages().get(0);
Assertions.assertThat(sendMessage.getContent().get(TARGET_NAME)).isEqualTo(expectedTargetName);
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class CommOpenHandlerTest method handleMessage_sentMessageHasCommId.
@Test
public void handleMessage_sentMessageHasCommId() throws Exception {
// given
String expectedCommId = (String) message.getContent().get(COMM_ID);
// when
commOpenHandler.handle(message);
// then
Assertions.assertThat(kernel.getSentMessages()).isNotEmpty();
Message sendMessage = kernel.getSentMessages().get(0);
Assertions.assertThat(sendMessage.getContent().get(COMM_ID)).isEqualTo(expectedCommId);
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class CommOpenHandlerTest method setUp.
@Before
public void setUp() {
kernel = new KernelTest();
commOpenHandler = new CommOpenHandler(kernel) {
@Override
public Handler<Message>[] getKernelControlChanelHandlers(String targetName) {
return (Handler<Message>[]) new Handler<?>[0];
}
};
message = JupyterHandlerTest.initOpenMessage();
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ExecuteRequestHandlerTest method setUpClass.
@BeforeClass
public static void setUpClass() {
evaluatorTest = new EvaluatorTest();
kernel = new KernelTest("sid", evaluatorTest) {
@Override
public void publish(List<Message> message) {
super.publish(message.stream().map(ExecuteRequestHandlerTest::copyMessage).collect(Collectors.toList()));
}
};
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ExecuteRequestHandlerTest method handleMessage_secondSentMessageHasContentExecutionCount.
@Test
public void handleMessage_secondSentMessageHasContentExecutionCount() throws Exception {
// when
executeRequestHandler.handle(message);
waitForIdleMessage(kernel);
// then
assertThat(kernel.getPublishedMessages()).isNotEmpty();
Message publishMessage = kernel.getPublishedMessages().get(1);
assertThat(publishMessage.getContent().get("execution_count")).isNotNull();
}
Aggregations