use of com.twosigma.beakerx.kernel.comm.Comm in project beakerx by twosigma.
the class JupyterHandlerTest method initKernelCommMapWithOneComm.
public static String initKernelCommMapWithOneComm(KernelTest kernelTest) {
Message openMessage = initOpenMessage();
String commId = (String) openMessage.getContent().get(COMM_ID);
String targetName = (String) openMessage.getContent().get(TARGET_NAME);
Comm comm = new Comm(commId, targetName) {
@Override
public void handleMsg(Message parentMessage) {
}
};
kernelTest.addComm(commId, comm);
return commId;
}
use of com.twosigma.beakerx.kernel.comm.Comm in project beakerx by twosigma.
the class NamespaceClient method getAutotranslationComm.
protected Comm getAutotranslationComm() {
if (autotranslationComm == null) {
autotranslationComm = new Comm(TargetNamesEnum.BEAKER_AUTOTRANSLATION);
autotranslationComm.open();
}
return autotranslationComm;
}
use of com.twosigma.beakerx.kernel.comm.Comm in project beakerx by twosigma.
the class NamespaceClient method getCodeCells.
public List<CodeCell> getCodeCells(String tagFilter) throws IOException, InterruptedException {
// first send message to get cells
Comm c = getCodeCellsComm();
HashMap<String, Serializable> data = new HashMap<>();
HashMap<String, Serializable> state = new HashMap<>();
state.put("name", "CodeCells");
state.put("value", getJson(tagFilter));
data.put("state", state);
data.put("buffer_paths", new HashMap<>());
c.send(COMM_MSG, Comm.Buffer.EMPTY, new Comm.Data(data));
// block
Object cells = getMessageQueue("CodeCells").take();
return (List<CodeCell>) cells;
}
use of com.twosigma.beakerx.kernel.comm.Comm in project beakerx by twosigma.
the class CommTest method setUp.
@Before
public void setUp() {
kernel = new KernelTest();
KernelManager.register(kernel);
comm = new Comm("targetName");
}
use of com.twosigma.beakerx.kernel.comm.Comm in project beakerx by twosigma.
the class InteractiveTest method valueChangeMsgCallback_createDisplayDataMessage.
@Test
public void valueChangeMsgCallback_createDisplayDataMessage() throws Exception {
// given
callInteractWithStringParam("\"A\"");
Comm comm = getCommWidgetByViewName(Text.VIEW_NAME_VALUE);
// when
comm.handleMsg(initSyncDataMessage(comm.getCommId(), "TEST"));
// then
Message display = SearchMessages.getListMessagesByType(groovyKernel.getPublishedMessages(), JupyterMessages.COMM_MSG).get(2);
Map date = (Map) display.getContent().get(Comm.DATA);
Map state = (Map) date.get(Comm.STATE);
Assertions.assertThat(state).isNotEmpty();
Assertions.assertThat(state.get("value")).isEqualTo("TEST");
}
Aggregations