use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class GroovyKernelTest method shouldImportStaticMethodDemoClassByMagicCommand.
@Test
public void shouldImportStaticMethodDemoClassByMagicCommand() throws Exception {
// given
addDemoJar();
String path = pathToDemoClassFromAddedDemoJar() + ".staticTest";
// when
Code code = CodeFactory.create(ADD_STATIC_IMPORT + " " + path, new Message(), getKernel());
code.execute(kernel, 1);
// then
verifyStaticImportedDemoClassByMagicCommand(pathToDemoClassFromAddedDemoJar() + ".staticTest()");
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class GroovyKernelTest method verifyStaticImportedDemoClassByMagicCommand.
protected void verifyStaticImportedDemoClassByMagicCommand(String path) throws InterruptedException {
Message message = getExecuteRequestMessage(path);
getKernelSocketsService().handleMsg(message);
Optional<Message> idleMessage = waitForIdleMessage(getKernelSocketsService().getKernelSockets());
assertThat(idleMessage).isPresent();
Optional<Message> result = waitForResult(getKernelSocketsService().getKernelSockets());
Map actual = ((Map) result.get().getContent().get(Comm.DATA));
String value = (String) actual.get("text/plain");
assertThat(value).isEqualTo("Demo_static_test_123");
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class GroovyKernelTest method shouldImportStaticFieldDemoClassByMagicCommand.
@Test
public void shouldImportStaticFieldDemoClassByMagicCommand() throws Exception {
// given
addDemoJar();
String path = pathToDemoClassFromAddedDemoJar() + ".STATIC_TEST_123";
// when
Code code = CodeFactory.create(ADD_STATIC_IMPORT + " " + path, new Message(), getKernel());
code.execute(kernel, 1);
// then
verifyStaticImportedDemoClassByMagicCommand(pathToDemoClassFromAddedDemoJar() + ".STATIC_TEST_123");
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class GroovyKernelTest method shouldImportStaticWildcardDemoClassByMagicCommand.
@Test
public void shouldImportStaticWildcardDemoClassByMagicCommand() throws Exception {
// given
addDemoJar();
String path = pathToDemoClassFromAddedDemoJar() + ".*";
// when
Code code = CodeFactory.create(ADD_STATIC_IMPORT + " " + path, new Message(), getKernel());
code.execute(kernel, 1);
// then
verifyStaticImportedDemoClassByMagicCommand(pathToDemoClassFromAddedDemoJar() + ".staticTest()");
verifyStaticImportedDemoClassByMagicCommand(pathToDemoClassFromAddedDemoJar() + ".STATIC_TEST_123");
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class GroovyKernelTest method addOutputWidget.
private void addOutputWidget(String outputCommId) throws InterruptedException {
Utils.setFixedCommUUID(outputCommId);
String addWidget = "" + "import com.twosigma.beakerx.widget.Output\n" + "out2 = new Output()\n" + "OutputManager.setOutput(out2)\n" + "out2";
Message addWidgetMessage = getExecuteRequestMessage(addWidget);
kernelSocketsService.handleMsg(addWidgetMessage);
Optional<Message> idleAddWidget = waitForIdleMessage(kernelSocketsService.getKernelSockets());
assertThat(idleAddWidget).isPresent();
kernelSocketsService.clear();
Utils.setDefaultCommUUID();
}
Aggregations