use of com.twosigma.beakerx.kernel.EvaluatorParameters in project beakerx by twosigma.
the class GroovyOutputContainerTest method setUp.
@Before
public void setUp() throws Exception {
BaseEvaluator evaluator = TestGroovyEvaluator.groovyEvaluator();
groovyKernel = new KernelTest("GroovyOutputContainerTest", evaluator);
groovyEvaluatorManager = new EvaluatorManager(groovyKernel, evaluator);
groovyEvaluatorManager.setShellOptions(new EvaluatorParameters(new HashMap()));
KernelManager.register(groovyKernel);
}
use of com.twosigma.beakerx.kernel.EvaluatorParameters in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteImportTest method setUpClass.
@BeforeClass
public static void setUpClass() throws Exception {
HashMap<String, Object> map = new HashMap<>();
map.put(IMPORTS, new JavaDefaultVariables().getImports());
EvaluatorParameters kernelParameters = new EvaluatorParameters(map);
groovyEvaluator = new JavaEvaluator("id", "sid", cellExecutor(), getTestTempFolderFactory(), kernelParameters);
}
use of com.twosigma.beakerx.kernel.EvaluatorParameters in project beakerx by twosigma.
the class DataSourcesMagicCommand method dataSource.
protected MagicCommandOutcomeItem dataSource(String source, String command) {
String[] parts = command.split(" ");
if (parts.length != 2) {
return new MagicCommandOutput(MagicCommandOutcomeItem.Status.ERROR, WRONG_FORMAT_MSG);
} else if (!parts[1].contains("jdbc:")) {
return new MagicCommandOutput(MagicCommandOutcomeItem.Status.ERROR, "Incorrect jdbc url.");
}
HashMap<String, Object> params = new HashMap<>();
params.put(source, parts[1]);
this.kernel.setShellOptions(new EvaluatorParameters(params));
return new MagicCommandOutput(MagicCommandOutcomeItem.Status.OK);
}
use of com.twosigma.beakerx.kernel.EvaluatorParameters in project beakerx by twosigma.
the class EvaluatorManagerTest method setUp.
@Before
public void setUp() throws Exception {
evaluator = new EvaluatorTest();
evaluatorManager = new EvaluatorManager(kernel, evaluator);
evaluatorManager.setShellOptions(new EvaluatorParameters(new HashMap()));
}
use of com.twosigma.beakerx.kernel.EvaluatorParameters in project beakerx by twosigma.
the class ScalaEvaluatorTest method javaImports_shouldBeAdjustedForScala.
@Test
public void javaImports_shouldBeAdjustedForScala() throws Exception {
// given
Map<String, Object> paramMap = new HashMap<>();
// This import tests both "static" removal and "object" escaping.
List<String> imports = Arrays.asList("import static com.twosigma.beakerx.scala.evaluator.object.ImportTestHelper.staticMethod");
paramMap.put(IMPORTS, imports);
EvaluatorParameters kernelParameters = new EvaluatorParameters(paramMap);
// when
scalaEvaluator.setShellOptions(kernelParameters);
String code = "val x = staticMethod()";
SimpleEvaluationObject seo = new SimpleEvaluationObject(code);
TryResult evaluate = scalaEvaluator.evaluate(seo, code);
// then
assertThat(evaluate.result()).isNull();
}
Aggregations