Search in sources :

Example 6 with InterpreterResult

use of org.apache.zeppelin.interpreter.InterpreterResult in project zeppelin by apache.

the class AlluxioInterpreterTest method countNotExistTest.

@Test
public void countNotExistTest() throws IOException {
    InterpreterResult output = alluxioInterpreter.interpret("count /NotExistFile", null);
    Assert.assertEquals(Code.ERROR, output.code());
    Assert.assertEquals(ExceptionMessage.PATH_DOES_NOT_EXIST.getMessage("/NotExistFile") + "\n", output.message().get(0).getData());
}
Also used : InterpreterResult(org.apache.zeppelin.interpreter.InterpreterResult)

Example 7 with InterpreterResult

use of org.apache.zeppelin.interpreter.InterpreterResult in project zeppelin by apache.

the class AlluxioInterpreterTest method locationNotExistTest.

@Test
public void locationNotExistTest() throws IOException {
    InterpreterResult output = alluxioInterpreter.interpret("location /NotExistFile", null);
    Assert.assertEquals(ExceptionMessage.PATH_DOES_NOT_EXIST.getMessage("/NotExistFile") + "\n", output.message().get(0).getData());
    Assert.assertEquals(Code.ERROR, output.code());
}
Also used : InterpreterResult(org.apache.zeppelin.interpreter.InterpreterResult)

Example 8 with InterpreterResult

use of org.apache.zeppelin.interpreter.InterpreterResult in project zeppelin by apache.

the class AlluxioInterpreterTest method catTest.

@Test
public void catTest() throws IOException {
    FileSystemTestUtils.createByteFile(fs, "/testFile", WriteType.MUST_CACHE, 10, 10);
    InterpreterResult output = alluxioInterpreter.interpret("cat /testFile", null);
    byte[] expected = BufferUtils.getIncreasingByteArray(10);
    Assert.assertEquals(Code.SUCCESS, output.code());
    Assert.assertArrayEquals(expected, output.message().get(0).getData().substring(0, output.message().get(0).getData().length() - 1).getBytes());
}
Also used : InterpreterResult(org.apache.zeppelin.interpreter.InterpreterResult)

Example 9 with InterpreterResult

use of org.apache.zeppelin.interpreter.InterpreterResult in project zeppelin by apache.

the class CassandraInterpreterTest method should_execute_statement_with_serial_consistency_option.

@Test
public void should_execute_statement_with_serial_consistency_option() throws Exception {
    //Given
    String statement = "@serialConsistency=SERIAL\n" + "SELECT * FROM zeppelin.artists LIMIT 1;";
    //When
    final InterpreterResult actual = interpreter.interpret(statement, intrContext);
    //Then
    assertThat(actual.code()).isEqualTo(Code.SUCCESS);
}
Also used : InterpreterResult(org.apache.zeppelin.interpreter.InterpreterResult)

Example 10 with InterpreterResult

use of org.apache.zeppelin.interpreter.InterpreterResult in project zeppelin by apache.

the class CassandraInterpreterTest method should_describe_aggregate.

@Test
@Ignore
public //TODO activate test when using Java 8 and C* 3.x
void should_describe_aggregate() throws Exception {
    //Given
    Properties properties = new Properties();
    properties.setProperty(CASSANDRA_HOSTS, "127.0.0.1");
    properties.setProperty(CASSANDRA_PORT, "9042");
    Interpreter interpreter = new CassandraInterpreter(properties);
    interpreter.open();
    final String query = "DESCRIBE AGGREGATES;";
    //When
    final InterpreterResult actual = interpreter.interpret(query, intrContext);
    //Then
    assertThat(actual.code()).isEqualTo(Code.SUCCESS);
}
Also used : CassandraInterpreter(org.apache.zeppelin.cassandra.CassandraInterpreter) Interpreter(org.apache.zeppelin.interpreter.Interpreter) CassandraInterpreter(org.apache.zeppelin.cassandra.CassandraInterpreter) InterpreterResult(org.apache.zeppelin.interpreter.InterpreterResult) Properties(java.util.Properties)

Aggregations

InterpreterResult (org.apache.zeppelin.interpreter.InterpreterResult)159 Test (org.junit.Test)68 Properties (java.util.Properties)17 File (java.io.File)10 IOException (java.io.IOException)9 AlluxioURI (alluxio.AlluxioURI)8 InterpreterContext (org.apache.zeppelin.interpreter.InterpreterContext)7 Theory (org.junit.experimental.theories.Theory)7 FileWriter (java.io.FileWriter)6 PrintStream (java.io.PrintStream)5 InterpreterException (org.apache.zeppelin.interpreter.InterpreterException)5 Code (org.apache.zeppelin.interpreter.InterpreterResult.Code)5 InterpreterResultMessage (org.apache.zeppelin.interpreter.InterpreterResultMessage)5 ActionResponse (org.apache.zeppelin.elasticsearch.action.ActionResponse)4 FileInStream (alluxio.client.file.FileInStream)3 JsonObject (com.google.gson.JsonObject)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 SQLException (java.sql.SQLException)3 HashMap (java.util.HashMap)3