Notebook { public void removeNote(Note note, AuthenticationInfo subject) throws IOException { LOGGER.info("Remove note: {}", note.getId()); noteManager.removeNote(note.getId(), subject); fireNoteRemoveEvent(note, subject); } Notebook(
      ZeppelinConfiguration conf,
      AuthorizationService authorizationService,
      NotebookRepo notebookRepo,
      NoteManager noteManager,
      InterpreterFactory replFactory,
      InterpreterSettingManager interpreterSettingManager,
      SearchService noteSearchService,
      Credentials credentials); @Inject  Notebook(
      ZeppelinConfiguration conf,
      AuthorizationService authorizationService,
      NotebookRepo notebookRepo,
      NoteManager noteManager,
      InterpreterFactory replFactory,
      InterpreterSettingManager interpreterSettingManager,
      SearchService noteSearchService,
      Credentials credentials,
      NoteEventListener noteEventListener); void recoveryIfNecessary(); NoteManager getNoteManager(); void setParagraphJobListener(ParagraphJobListener paragraphJobListener); Note createNote(String notePath,
                         AuthenticationInfo subject); Note createNote(String notePath,
                         AuthenticationInfo subject,
                         boolean save); Note createNote(String notePath,
                         String defaultInterpreterGroup,
                         AuthenticationInfo subject); Note createNote(String notePath,
                         String defaultInterpreterGroup,
                         AuthenticationInfo subject,
                         boolean save); String exportNote(String noteId); Note importNote(String sourceJson, String notePath, AuthenticationInfo subject); Note cloneNote(String sourceNoteId, String newNotePath, AuthenticationInfo subject); void removeNote(Note note, AuthenticationInfo subject); Note getNote(String noteId); Note getNote(String noteId, boolean reload); void saveNote(Note note, AuthenticationInfo subject); boolean containsNote(String notePath); boolean containsFolder(String folderPath); void moveNote(String noteId, String newNotePath, AuthenticationInfo subject); void moveFolder(String folderPath, String newFolderPath, AuthenticationInfo subject); void removeFolder(String folderPath, AuthenticationInfo subject); void emptyTrash(AuthenticationInfo subject); void restoreAll(AuthenticationInfo subject); Revision checkpointNote(String noteId, String notePath, String checkpointMessage,
      AuthenticationInfo subject); List<Revision> listRevisionHistory(String noteId,
                                            String notePath,
                                            AuthenticationInfo subject); Note setNoteRevision(String noteId, String notePath, String revisionId, AuthenticationInfo subject); Note getNoteByRevision(String noteId, String noteName,
                                String revisionId, AuthenticationInfo subject); @SuppressWarnings("rawtypes") Note loadNoteFromRepo(String id, AuthenticationInfo subject); void reloadAllNotes(AuthenticationInfo subject); List<NoteInfo> getNotesInfo(); Stream<Note> getNoteStream(); @VisibleForTesting List<Note> getAllNotes(Function<Note, Boolean> func); @VisibleForTesting List<Note> getAllNotes(); List<NoteInfo> getNotesInfo(Function<String, Boolean> func); List<InterpreterSetting> getBindedInterpreterSettings(String noteId); InterpreterFactory getInterpreterFactory(); InterpreterSettingManager getInterpreterSettingManager(); ZeppelinConfiguration getConf(); void close(); void addNotebookEventListener(NoteEventListener listener); Boolean isRevisionSupported();  }
@Test public void testRemoveNote() throws IOException, InterruptedException { try { LOGGER.info("--------------- Test testRemoveNote ---------------"); Note note = notebook.createNote("note1", anonymous); int mock1ProcessNum = interpreterSettingManager.getByName("mock1").getAllInterpreterGroups().size(); Paragraph p = note.addNewParagraph(AuthenticationInfo.ANONYMOUS); Map config = new HashMap<>(); p.setConfig(config); p.setText("%mock1 sleep 100000"); p.execute(false); while (!p.isRunning()) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } assertEquals(mock1ProcessNum + 1, interpreterSettingManager.getByName("mock1").getAllInterpreterGroups().size()); LOGGER.info("--------------- Finish Test testRemoveNote ---------------"); notebook.removeNote(note, anonymous); Thread.sleep(5 * 1000); assertEquals(mock1ProcessNum, interpreterSettingManager.getByName("mock1").getAllInterpreterGroups().size()); LOGGER.info("--------------- Finish Test testRemoveNote ---------------"); } catch (Exception e) { e.printStackTrace(); } }