Notebook { public Note cloneNote(String sourceNoteID, String newNoteName) throws IOException, CloneNotSupportedException, IllegalArgumentException { Note sourceNote = getNote(sourceNoteID); if (sourceNote == null) { throw new IllegalArgumentException(sourceNoteID + "not found"); } Note newNote = createNote(); if (newNoteName != null) { newNote.setName(newNoteName); } List<String> boundInterpreterSettingsIds = getBindedInterpreterSettingsIds(sourceNote.id()); bindInterpretersToNote(newNote.id(), boundInterpreterSettingsIds); List<Paragraph> paragraphs = sourceNote.getParagraphs(); for (Paragraph p : paragraphs) { newNote.addCloneParagraph(p); } notebookIndex.addIndexDoc(newNote); newNote.persist(); return newNote; } Notebook(ZeppelinConfiguration conf, NotebookRepo notebookRepo,
      SchedulerFactory schedulerFactory,
      InterpreterFactory replFactory, JobListenerFactory jobListenerFactory,
      SearchService notebookIndex); Note createNote(); Note createNote(List<String> interpreterIds); Note cloneNote(String sourceNoteID, String newNoteName); void bindInterpretersToNote(String id,
      List<String> interpreterSettingIds); List<String> getBindedInterpreterSettingsIds(String id); List<InterpreterSetting> getBindedInterpreterSettings(String id); Note getNote(String id); void removeNote(String id); void reloadAllNotes(); List<Note> getAllNotes(); JobListenerFactory getJobListenerFactory(); void setJobListenerFactory(JobListenerFactory jobListenerFactory); void refreshCron(String id); InterpreterFactory getInterpreterFactory(); ZeppelinConfiguration getConf(); void close();  }
@Test public void testCloneNote() throws IOException, CloneNotSupportedException, InterruptedException { Note note = notebook.createNote(); note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList()); final Paragraph p = note.addParagraph(); p.setText("hello world"); note.runAll(); while(p.isTerminated()==false || p.getResult()==null) Thread.yield(); p.setStatus(Status.RUNNING); Note cloneNote = notebook.cloneNote(note.getId(), "clone note"); Paragraph cp = cloneNote.paragraphs.get(0); assertEquals(cp.getStatus(), Status.READY); assertNotEquals(cp.getId(), p.getId()); assertEquals(cp.text, p.text); assertEquals(cp.getResult().message(), p.getResult().message()); }