SparkInterpreter extends Interpreter { @Override public InterpreterResult interpret(String line, InterpreterContext context) { if (sparkVersion.isUnsupportedVersion()) { return new InterpreterResult(Code.ERROR, "Spark " + sparkVersion.toString() + " is not supported"); } z.setInterpreterContext(context); if (line == null || line.trim().length() == 0) { return new InterpreterResult(Code.SUCCESS); } return interpret(line.split("\n"), context); } SparkInterpreter(Properties property);  SparkInterpreter(Properties property, SparkContext sc); synchronized SparkContext getSparkContext(); boolean isSparkContextInitialized(); SQLContext getSQLContext(); DependencyResolver getDependencyResolver(); SparkContext createSparkContext(); static String getSystemDefault(
      String envName,
      String propertyName,
      String defaultValue); @Override void open(); @Override List<String> completion(String buf, int cursor); Object getValue(String name); @Override InterpreterResult interpret(String line, InterpreterContext context); InterpreterResult interpret(String[] lines, InterpreterContext context); InterpreterResult interpretInput(String[] lines); @Override void cancel(InterpreterContext context); @Override int getProgress(InterpreterContext context); @Override void close(); @Override FormType getFormType(); JobProgressListener getJobProgressListener(); @Override Scheduler getScheduler(); ZeppelinContext getZeppelinContext(); SparkVersion getSparkVersion();  }
@Test public void testBasicIntp() { assertEquals(InterpreterResult.Code.SUCCESS, repl.interpret("val a = 1\nval b = 2", context).code()); InterpreterResult incomplete = repl.interpret("val a = \"\"\"", context); assertEquals(InterpreterResult.Code.INCOMPLETE, incomplete.code()); assertTrue(incomplete.message().length() > 0); }
@Test public void testNextLineInvocation() { assertEquals(InterpreterResult.Code.SUCCESS, repl.interpret("\"123\"\n.toInt", context).code()); }
@Test public void testEndWithComment() { assertEquals(InterpreterResult.Code.SUCCESS, repl.interpret("val c=1\n }
@Test public void testReferencingUndefinedVal() { InterpreterResult result = repl.interpret("def category(min: Int) = {" + " if (0 <= value) \"error\"" + "}", context); assertEquals(Code.ERROR, result.code()); }
@Test public void testZContextDependencyLoading() { assertEquals(InterpreterResult.Code.ERROR, repl.interpret("import org.apache.commons.csv.CSVFormat", context).code()); repl.interpret("z.load(\"org.apache.commons:commons-csv:1.1\")", context); assertEquals(InterpreterResult.Code.SUCCESS, repl.interpret("import org.apache.commons.csv.CSVFormat", context).code()); }