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"));
}
}
Aggregations