use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class ClasspathAddMvnDepsCellMagicCommandTest method processMagicCommand.
private void processMagicCommand(String allCode) {
MagicCommand command = new MagicCommand(new ClassPathAddMvnCellMagicCommand(kernel.mavenResolverParam, kernel), allCode);
Code code = Code.createCode(allCode, Collections.singletonList(command), NO_ERRORS, new Message());
code.execute(kernel, 1);
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class ClasspathMagicCommandTest method showClasspathShouldNotContainDuplication.
@Test
public void showClasspathShouldNotContainDuplication() throws Exception {
// given
kernel.addJarsToClasspath(asList(new PathToJar(CLASSPATH_TO_JAR_PATH)));
kernel.clearMessages();
// when
kernel.addJarsToClasspath(asList(new PathToJar(CLASSPATH_TO_JAR_PATH)));
Code code = CodeFactory.create("%classpath", new Message(), kernel);
code.execute(kernel, 1);
// then
List<Message> std = EvaluatorResultTestWatcher.getStdouts(kernel.getPublishedMessages());
String text = (String) std.get(0).getContent().get("text");
assertThat(text).contains(FOO_JAR);
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class ClasspathMagicCommandTest method allowSpacesInJarPath.
@Test
public void allowSpacesInJarPath() {
Code code = CodeFactory.create("%classpath add jar \"./src/test/resources/jars/ with space.jar\"", new Message(), kernel);
code.execute(kernel, 1);
List<Message> std = EvaluatorResultTestWatcher.getStdouts(kernel.getPublishedMessages());
String text = (String) std.get(0).getContent().get("text");
assertThat(text).contains("Added jar: [ with space.jar]\n");
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class ClasspathMagicCommandTest method allowExtraWhitespaces.
@Test
public void allowExtraWhitespaces() {
Code code = CodeFactory.create("%classpath add jar " + CLASSPATH_TO_JAR_PATH, new Message(), kernel);
code.execute(kernel, 1);
List<Message> std = EvaluatorResultTestWatcher.getStdouts(kernel.getPublishedMessages());
String text = (String) std.get(0).getContent().get("text");
assertThat(text).contains("Added jar: [" + FOO_JAR + "]\n");
}
use of com.twosigma.beakerx.kernel.Code in project beakerx by twosigma.
the class ImportMagicCommandTest method allowExtraWhitespaces.
@Test
public void allowExtraWhitespaces() {
String allCode = "%import com.twosigma.beakerx.widget.IntSlider";
Code code = CodeFactory.create(allCode, new Message(), kernel);
code.execute(kernel, 1);
assertThat(kernel.getImports().getImportPaths()).contains(new ImportPath("com.twosigma.beakerx.widget.IntSlider"));
}
Aggregations