HbaseInterpreter extends Interpreter { @Override public InterpreterResult interpret(String cmd, InterpreterContext interpreterContext) { try { logger.info(cmd); this.writer.getBuffer().setLength(0); this.scriptingContainer.runScriptlet(cmd); this.writer.flush(); logger.debug(writer.toString()); return new InterpreterResult(InterpreterResult.Code.SUCCESS, writer.getBuffer().toString()); } catch (Throwable t) { logger.error("Can not run '" + cmd + "'", t); return new InterpreterResult(InterpreterResult.Code.ERROR, t.getMessage()); } } HbaseInterpreter(Properties property); @Override void open(); @Override void close(); @Override InterpreterResult interpret(String cmd, InterpreterContext interpreterContext); @Override void cancel(InterpreterContext context); @Override FormType getFormType(); @Override int getProgress(InterpreterContext context); @Override Scheduler getScheduler(); @Override List<InterpreterCompletion> completion(String buf, int cursor);  }
@Test public void putsTest() { InterpreterResult result = hbaseInterpreter.interpret("puts \"Hello World\"", null); assertEquals(InterpreterResult.Code.SUCCESS, result.code()); assertEquals(result.type(), InterpreterResult.Type.TEXT); assertEquals("Hello World\n", result.message()); }
@Test public void testException() { InterpreterResult result = hbaseInterpreter.interpret("plot practical joke", null); assertEquals(InterpreterResult.Code.ERROR, result.code()); assertEquals("(NameError) undefined local variable or method `joke' for main:Object", result.message()); }