use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class KernelExecutionTest method addJarWithCustomMagicCommand.
private void addJarWithCustomMagicCommand() throws InterruptedException {
String allCode = CLASSPATH_ADD_JAR + " " + LOAD_MAGIC_DEMO_JAR;
Code code = CodeFactory.create(allCode, new Message(), getKernel());
code.execute(getKernel(), 1);
List<Message> std = waitForStdouts(getKernelSocketsService().getKernelSockets());
String text = (String) std.get(0).getContent().get("text");
assertThat(text).contains("Added jar: [loadMagicJarDemo.jar]");
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class KernelExecutionTest method loadMagicCommandByClass.
private void loadMagicCommandByClass() throws InterruptedException {
String allCode = LOAD_MAGIC + " com.twosigma.beakerx.custom.magic.command.ShowEnvsCustomMagicCommand";
Code code = CodeFactory.create(allCode, new Message(), getKernel());
code.execute(getKernel(), 2);
List<Message> std = waitForStdouts(getKernelSocketsService().getKernelSockets());
String text = (String) std.get(1).getContent().get("text");
assertThat(text).contains("Magic command %showEnvs was successfully added.");
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class KernelExecutionTest method shouldUnimportDemoClassByMagicCommand.
@Test
public void shouldUnimportDemoClassByMagicCommand() throws Exception {
// given
addDemoJar();
String path = pathToDemoClassFromAddedDemoJar();
Code code = CodeFactory.create(IMPORT + " " + path, new Message(), getKernel());
code.execute(kernel, 1);
// when
Code code2 = CodeFactory.create(UNIMPORT + " " + path, new Message(), getKernel());
code2.execute(kernel, 2);
// then
// assertThat(status).isEqualTo(MagicCommandOutcomeItem.Status.OK);
verifyUnImportedDemoClassByMagicCommand();
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class GroovyKernelTest method shouldNotImportStaticNotStaticPathByMagicCommand.
@Test
public void shouldNotImportStaticNotStaticPathByMagicCommand() throws Exception {
// given
addDemoJar();
String path = "garbage";
// when
Code code = CodeFactory.create(ADD_STATIC_IMPORT + " " + path, new Message(), getKernel());
code.execute(kernel, 1);
// then
verifyNotImportedStaticMagicCommand();
}
use of com.twosigma.beakerx.kernel.Code 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()");
}
Aggregations