use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ExecuteRequestHandlerTest method handleMessage_secondSentMessageHasContentCode.
@Test
public void handleMessage_secondSentMessageHasContentCode() throws Exception {
// given
String expectedCode = (String) message.getContent().get("code");
// when
executeRequestHandler.handle(message);
waitForIdleMessage(kernel);
// then
assertThat(kernel.getPublishedMessages()).isNotEmpty();
Message publishMessage = kernel.getPublishedMessages().get(1);
assertThat(publishMessage.getContent().get("code")).isEqualTo(expectedCode);
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ExecuteRequestHandlerTest method handleMessage_firstSentMessageHasParentHeader.
@Test
public void handleMessage_firstSentMessageHasParentHeader() throws Exception {
// given
String expectedHeader = message.getHeader().asJson();
// when
executeRequestHandler.handle(message);
waitForIdleMessage(kernel);
// then
assertThat(kernel.getPublishedMessages()).isNotEmpty();
Message publishMessage = kernel.getPublishedMessages().get(0);
assertThat(publishMessage.getParentHeader().asJson()).isEqualTo(expectedHeader);
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ExecuteRequestHandlerTest method handleMessage_secondSendMessageHasTypeIsExecutionInput.
@Test
public void handleMessage_secondSendMessageHasTypeIsExecutionInput() throws Exception {
// when
executeRequestHandler.handle(message);
waitForIdleMessage(kernel);
// then
assertThat(kernel.getPublishedMessages()).isNotEmpty();
Message publishMessage = kernel.getPublishedMessages().get(1);
assertThat(publishMessage.getHeader().getType()).isEqualTo(JupyterMessages.EXECUTE_INPUT.getName());
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ExecuteRequestHandlerTest method handleMessage_firstSentMessageHasSessionId.
@Test
public void handleMessage_firstSentMessageHasSessionId() throws Exception {
// given
String expectedSessionId = message.getHeader().getSession();
// when
executeRequestHandler.handle(message);
waitForIdleMessage(kernel);
// then
assertThat(kernel.getPublishedMessages()).isNotEmpty();
Message publishMessage = kernel.getPublishedMessages().get(0);
assertThat(publishMessage.getHeader().getSession()).isEqualTo(expectedSessionId);
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ExecuteRequestHandlerTest method handleMessage_firstSentMessageHasExecutionStateIsBusy.
@Test
public void handleMessage_firstSentMessageHasExecutionStateIsBusy() throws Exception {
// when
executeRequestHandler.handle(message);
waitForIdleMessage(kernel);
// then
assertThat(kernel.getPublishedMessages()).isNotEmpty();
Message publishMessage = kernel.getPublishedMessages().get(0);
assertThat(publishMessage.getContent().get("execution_state")).isEqualTo("busy");
}
Aggregations