use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class KernelExecutionTest method shouldImportDemoClassWithWildcardByMagicCommand.
@Test
public void shouldImportDemoClassWithWildcardByMagicCommand() throws Exception {
// given
addDemoJar();
String path = pathToDemoClassFromAddedDemoJar();
String allCode = IMPORT + " " + path.substring(0, path.lastIndexOf(".")) + ".*";
// when
Code code = CodeFactory.create(allCode, new Message(), getKernel());
code.execute(kernel, 1);
// then
verifyImportedDemoClassByMagicCommand();
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class KernelExecutionTest method verifyAddedDemoJar.
private void verifyAddedDemoJar() throws InterruptedException {
String code = codeForVerifyingAddedDemoJar();
Message message = getExecuteRequestMessage(code);
// when
getKernelSocketsService().handleMsg(message);
// then
Optional<Message> idleMessage = waitForIdleMessage(getKernelSocketsService().getKernelSockets());
assertThat(idleMessage).isPresent();
Optional<Message> result = waitForResult(getKernelSocketsService().getKernelSockets());
checkResultForErrors(result, code);
verifyResultOfAddedJar(result.get());
}
use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class KernelExecutionTest method verifyLoadedMagicCommand.
private void verifyLoadedMagicCommand() throws InterruptedException {
String allCode = "%showEnvs";
Code code = CodeFactory.create(allCode, new Message(), getKernel());
code.execute(getKernel(), 3);
List<Message> std = waitForStdouts(getKernelSocketsService().getKernelSockets());
String text = (String) std.get(2).getContent().get("text");
assertThat(text).contains("PATH");
}
use of com.twosigma.beakerx.message.Message 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.message.Message 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.");
}
Aggregations