use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class ClasspathAddRepoMagicCommandTest method addExternalRepo.
@Test
public void addExternalRepo() {
// given
String allCode = CLASSPATH_CONFIG_RESOLVER + " " + "externalRepo http://someExternalRepo";
Code code = CodeFactory.create(allCode, new Message(), kernel);
// when
code.execute(kernel, 1);
// then
List<Message> std = EvaluatorResultTestWatcher.getStdouts(kernel.getPublishedMessages());
String text = (String) std.get(0).getContent().get("text");
assertThat(text).contains(ADDED_NEW_REPO + "externalRepo");
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class TimeCellModeMagicCommandTest method timeInCellMode.
@Test
public void timeInCellMode() {
// given
String allCode = "" + "%%time \n" + "a = [10,20,30,40,50]; \n" + "a= a.sum(); \n" + "a*10;";
Code code = CodeFactory.create(allCode, new Message(), kernel);
// when
code.execute(kernel, 1);
// then
List<Message> std = EvaluatorResultTestWatcher.getStdouts(kernel.getPublishedMessages());
String text = (String) std.get(0).getContent().get("text");
assertThat(text).contains("CPU times:");
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class KernelExecutionTest method shouldImportDemoClassByMagicCommand.
@Test
public void shouldImportDemoClassByMagicCommand() throws Exception {
// given
addDemoJar();
String path = pathToDemoClassFromAddedDemoJar();
// when
Code code = CodeFactory.create(IMPORT + " " + path, new Message(), getKernel());
code.execute(kernel, 1);
// then
verifyImportedDemoClassByMagicCommand();
}
use of com.twosigma.beakerx.kernel.Code 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.kernel.Code 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");
}
Aggregations