use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class Display method displayMIMEContainers.
private static void displayMIMEContainers(List<MIMEContainer> result) {
HashMap<String, Serializable> content = new HashMap<>();
HashMap<String, Object> data = new HashMap<>();
result.forEach(x -> data.put(x.getMime().asString(), x.getData()));
content.put(DATA, data);
content.put(METADATA, new HashMap<>());
Message message = Comm.messageMessage(DISPLAY_DATA, Comm.Buffer.EMPTY, content, getParentHeader());
KernelManager.get().publish(singletonList(message));
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class KernelInfoHandler method handleMsg.
private void handleMsg(Message message) {
logger.debug("Processing kernel info request");
Message reply = new Message();
reply.setContent(content());
reply.setHeader(new Header(KERNEL_INFO_REPLY, message.getHeader().getSession()));
reply.setParentHeader(message.getHeader());
reply.setIdentities(message.getIdentities());
send(reply);
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ClasspathAddMagicCommandTest method errorWhenIncompleteMagicCommand.
@Test
public void errorWhenIncompleteMagicCommand() {
// given
String allCode = ClasspathAddJarMagicCommand.CLASSPATH + " add garbage";
Code code = CodeFactory.create(allCode, new Message(), kernel);
// when
code.execute(kernel, 1);
// then
List<Message> std = EvaluatorResultTestWatcher.getStderr(kernel.getPublishedMessages());
String text = (String) std.get(0).getContent().get("text");
assertThat(text).contains(" not found");
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class TableDisplayActionsTest method actionDetailsMessage.
private Message actionDetailsMessage() {
Message message = new Message();
message.setHeader(initHeader(JupyterMessages.COMM_MSG));
Map<String, Serializable> content = new LinkedHashMap<>();
content.put(COMM_ID, tableDisplay.getComm().getCommId());
Map<String, Serializable> dataContent = new LinkedHashMap<>();
dataContent.put("event", CommActions.ACTIONDETAILS.getAction());
Map<String, Serializable> params = new LinkedHashMap<>();
params.put("actionType", CONTEXT_MENU_CLICK.getAction());
params.put("row", 1);
params.put("col", 1);
params.put("contextMenuItem", "run print cell");
Map<String, Serializable> data = new LinkedHashMap<>();
content.put("data", (Serializable) data);
data.put("content", (Serializable) dataContent);
dataContent.put("params", (Serializable) params);
message.setContent(content);
return message;
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class TableDisplayActionsTest method contextMenuActionShouldHaveDetails.
@Test
public void contextMenuActionShouldHaveDetails() throws Exception {
// given
Message message = contextMenuMessage();
// when
commMsgHandler.handle(message);
// then
assertThat(tableDisplay.getDetails()).isNotNull();
}
Aggregations