Search in sources :

Example 36 with InterpreterResult

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

the class PegdownParserTest method testInlineCode.

@Test
public void testInlineCode() {
    InterpreterResult result = md.interpret("Inline `code` has `back-ticks around` it.", null);
    assertEquals(wrapWithMarkdownClassDiv("<p>Inline <code>code</code> has <code>back-ticks around</code> it.</p>"), result.message().get(0).getData());
}
Also used : InterpreterResult(org.apache.zeppelin.interpreter.InterpreterResult) Test(org.junit.Test)

Example 37 with InterpreterResult

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

the class PegdownParserTest method testYumlPlugin.

@Test
public void testYumlPlugin() {
    String input = new StringBuilder().append("\n \n %%% yuml style=nofunky scale=120 format=svg\n").append("[Customer]<>-orders>[Order]\n").append("[Order]++-0..>[LineItem]\n").append("[Order]-[note:Aggregate root.]\n").append("  %%%  ").toString();
    InterpreterResult result = md.interpret(input, null);
    assertThat(result.message().get(0).getData(), CoreMatchers.containsString("<img src=\"http://yuml.me/diagram/"));
}
Also used : InterpreterResult(org.apache.zeppelin.interpreter.InterpreterResult) Test(org.junit.Test)

Example 38 with InterpreterResult

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

the class PegdownParserTest method testAlignedTable.

@Test
public void testAlignedTable() {
    String input = new StringBuilder().append("| First Header | Second Header |         Third Header |\n").append("| :----------- | :-----------: | -------------------: |\n").append("| First row    |      Data     | Very long data entry |\n").append("| Second row   |    **Cell**   |               *Cell* |").toString();
    String expected = new StringBuilder().append("<table>\n").append("  <thead>\n").append("    <tr>\n").append("      <th align=\"left\">First Header </th>\n").append("      <th align=\"center\">Second Header </th>\n").append("      <th align=\"right\">Third Header </th>\n").append("    </tr>\n").append("  </thead>\n").append("  <tbody>\n").append("    <tr>\n").append("      <td align=\"left\">First row </td>\n").append("      <td align=\"center\">Data </td>\n").append("      <td align=\"right\">Very long data entry </td>\n").append("    </tr>\n").append("    <tr>\n").append("      <td align=\"left\">Second row </td>\n").append("      <td align=\"center\"><strong>Cell</strong> </td>\n").append("      <td align=\"right\"><em>Cell</em> </td>\n").append("    </tr>\n").append("  </tbody>\n").append("</table>").toString();
    InterpreterResult result = md.interpret(input, null);
    assertEquals(wrapWithMarkdownClassDiv(expected), result.message().get(0).getData());
}
Also used : InterpreterResult(org.apache.zeppelin.interpreter.InterpreterResult) Test(org.junit.Test)

Example 39 with InterpreterResult

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

the class IgniteSqlInterpreterTest method testInvalidSql.

@Test
public void testInvalidSql() throws Exception {
    InterpreterResult result = intp.interpret("select * hrom person", INTP_CONTEXT);
    assertEquals(Code.ERROR, result.code());
}
Also used : InterpreterResult(org.apache.zeppelin.interpreter.InterpreterResult) Test(org.junit.Test)

Example 40 with InterpreterResult

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

the class IgniteSqlInterpreterTest method testSql.

@Test
public void testSql() {
    InterpreterResult result = intp.interpret("select name, age from person where age > 10", INTP_CONTEXT);
    assertEquals(Code.SUCCESS, result.code());
    assertEquals(Type.TABLE, result.message().get(0).getType());
    assertEquals("NAME\tAGE\nsun\t100\nmoon\t50\n", result.message().get(0).getData());
}
Also used : InterpreterResult(org.apache.zeppelin.interpreter.InterpreterResult) Test(org.junit.Test)

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