Search in sources :

Example 6 with NoteResult

use of org.apache.zeppelin.client.NoteResult in project zeppelin by apache.

the class ZeppelinClientIntegrationTest method testNoteOperation.

@Test
public void testNoteOperation() throws Exception {
    String noteId = zeppelinClient.createNote("/project_1/note1");
    notebook.processNote(noteId, note -> {
        assertNotNull(note);
        return null;
    });
    // create duplicated note
    try {
        zeppelinClient.createNote("/project_1/note1");
        fail("Should fail to create duplicated note");
    } catch (Exception e) {
        assertTrue(e.getMessage(), e.getMessage().contains("existed"));
    }
    // query NoteResult
    NoteResult noteResult = zeppelinClient.queryNoteResult(noteId);
    assertEquals(noteId, noteResult.getNoteId());
    assertEquals(false, noteResult.isRunning());
    // note is created with 0 paragraph.
    assertEquals(0, noteResult.getParagraphResultList().size());
    // query non-existed note
    try {
        zeppelinClient.queryNoteResult("unknown-noteId");
        fail("Should fail to query non-existed note");
    } catch (Exception e) {
        assertTrue(e.getMessage(), e.getMessage().contains("No such note"));
    }
    zeppelinClient.deleteNote(noteId);
    // deleting the same note again will fail
    try {
        zeppelinClient.deleteNote(noteId);
        fail("Should fail to delete non-existed note");
    } catch (Exception e) {
        assertTrue(e.getMessage(), e.getMessage().contains("No such note"));
    }
}
Also used : NoteResult(org.apache.zeppelin.client.NoteResult) Test(org.junit.Test)

Aggregations

NoteResult (org.apache.zeppelin.client.NoteResult)6 ParagraphResult (org.apache.zeppelin.client.ParagraphResult)4 Test (org.junit.Test)4 HashMap (java.util.HashMap)3 ClientConfig (org.apache.zeppelin.client.ClientConfig)2 ZeppelinClient (org.apache.zeppelin.client.ZeppelinClient)2