use of com.twosigma.beakerx.message.Message in project beakerx by twosigma.
the class ClasspathAddRepoMagicCommandTest method addMvnLocal.
public void addMvnLocal() {
// given
String allCode = CLASSPATH_CONFIG_RESOLVER + " " + MVN_LOCAL;
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 + MVN_LOCAL);
}
use of com.twosigma.beakerx.message.Message 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.message.Message 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.message.Message 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.message.Message in project beakerx by twosigma.
the class KernelExecutionTest method verifyImportedDemoClassByMagicCommand.
private void verifyImportedDemoClassByMagicCommand() throws InterruptedException {
String allCode = getObjectTestMethodFromAddedDemoJar();
Message message = getExecuteRequestMessage(allCode);
getKernelSocketsService().handleMsg(message);
Optional<Message> idleMessage = waitForIdleMessage(getKernelSocketsService().getKernelSockets());
assertThat(idleMessage).isPresent();
Optional<Message> result = waitForResult(getKernelSocketsService().getKernelSockets());
checkResultForErrors(result, allCode);
assertThat(result).isPresent();
Map actual = ((Map) result.get().getContent().get(Comm.DATA));
String value = (String) actual.get("text/plain");
assertThat(value).isEqualTo("Demo_test_123");
}
Aggregations