use of com.twosigma.beakerx.jvm.object.SimpleEvaluationObject in project beakerx by twosigma.
the class EvaluatorBaseTest method returnHelloString.
@Test
public void returnHelloString() throws Exception {
// given
String code = codeForHello();
SimpleEvaluationObject seo = new SimpleEvaluationObject(code);
// when
TryResult result = evaluator().evaluate(seo, code);
// then
assertThat((String) result.result()).contains("Hello");
}
use of com.twosigma.beakerx.jvm.object.SimpleEvaluationObject in project beakerx by twosigma.
the class EvaluatorBaseTest method returnPrintln.
@Test
public void returnPrintln() throws Exception {
// given
String code = codeForPrintln();
SimpleEvaluationObject seo = new SimpleEvaluationObject(code);
// when
TryResult result = evaluator().evaluate(seo, code);
// then
assertThat((String) result.result()).isNull();
}
use of com.twosigma.beakerx.jvm.object.SimpleEvaluationObject in project beakerx by twosigma.
the class SQLAutocompleteTest method givenColorTable.
private void givenColorTable() {
SimpleEvaluationObject seo = new SimpleEvaluationObject(SQLForColorTable.CREATE_AND_SELECT_ALL);
sqlEvaluator.evaluate(seo, SQLForColorTable.CREATE_AND_SELECT_ALL);
}
use of com.twosigma.beakerx.jvm.object.SimpleEvaluationObject in project beakerx by twosigma.
the class SQLCodeRunner method call.
@Override
public TryResult call() throws Exception {
TryResult either;
try {
InternalVariable.setValue(simpleEvaluationObject);
Object r = sqlEvaluator.executeQuery(simpleEvaluationObject.getExpression(), namespaceClient, sqlEvaluator.defaultConnectionString, sqlEvaluator.namedConnectionString);
either = TryResult.createResult(r);
} catch (SQLException e) {
either = TryResult.createError(e.toString());
} catch (ThreadDeath e) {
either = TryResult.createError(INTERUPTED_MSG);
} catch (ReadVariableException e) {
either = TryResult.createError(e.getMessage());
} catch (Throwable e) {
logger.error(e.getMessage());
either = TryResult.createError(e.toString());
}
return either;
}
use of com.twosigma.beakerx.jvm.object.SimpleEvaluationObject in project beakerx by twosigma.
the class KotlinEvaluatorTest method handleErrors.
@Test
public void handleErrors() throws Exception {
// given
String code = "val plot = UndefinedPlot()";
SimpleEvaluationObject seo = new SimpleEvaluationObject(code);
// when
TryResult evaluate = evaluator.evaluate(seo, code);
// then
assertThat(evaluate.error()).contains("unresolved reference: UndefinedPlot");
}
Aggregations