Source:
public void testRestartInterpreterPerNote() throws IOException, InterruptedException { Note note = ZeppelinServer.notebook.createNote(null); note.addParagraph(); Paragraph p = note.getLastParagraph(); Map config = p.getConfig(); config.put("enabled", true); p.setConfig(config); p.setText("%md markdown"); note.run(p.getId()); while (p.getStatus() != Status.FINISHED) { Thread.sleep(100); } assertEquals("<p>markdown</p>\n", p.getResult().message()); InterpreterSetting mdIntpSetting = null; for (InterpreterSetting setting : ZeppelinServer.notebook.getInterpreterFactory().getInterpreterSettings(note.getId())) { if (setting.getName().equals("md")) { mdIntpSetting = setting; break; } } String jsonRequest = "{\"noteId\":\"" + note.getId() + "\"}"; LOG.info("=========>{}", jsonRequest); mdIntpSetting.getOption().setPerNoteProcess(true); mdIntpSetting.getOption().setPerNoteSession(false); PutMethod put = httpPut("/interpreter/setting/restart/" + mdIntpSetting.getId(), jsonRequest); assertThat("isolated interpreter restart:", put, isAllowed()); put.releaseConnection(); mdIntpSetting.getOption().setPerNoteSession(true); mdIntpSetting.getOption().setPerNoteProcess(false); put = httpPut("/interpreter/setting/restart/" + mdIntpSetting.getId(), jsonRequest); assertThat("scoped interpreter restart:", put, isAllowed()); put.releaseConnection(); mdIntpSetting.getOption().setPerNoteProcess(false); mdIntpSetting.getOption().setPerNoteSession(false); put = httpPut("/interpreter/setting/restart/" + mdIntpSetting.getId(), jsonRequest); assertThat("shared interpreter restart:", put, isAllowed()); put.releaseConnection(); ZeppelinServer.notebook.removeNote(note.getId(), null); }

Target:
public void testRestartInterpreterPerNote() throws IOException, InterruptedException { Note note = ZeppelinServer.notebook.createNote(anonymous); note.addParagraph(); Paragraph p = note.getLastParagraph(); Map config = p.getConfig(); config.put("enabled", true); p.setConfig(config); p.setText("%md markdown"); p.setAuthenticationInfo(anonymous); note.run(p.getId()); while (p.getStatus() != Status.FINISHED) { Thread.sleep(100); } assertEquals("<p>markdown</p>\n", p.getResult().message()); InterpreterSetting mdIntpSetting = null; for (InterpreterSetting setting : ZeppelinServer.notebook.getInterpreterFactory().getInterpreterSettings(note.getId())) { if (setting.getName().equals("md")) { mdIntpSetting = setting; break; } } String jsonRequest = "{\"noteId\":\"" + note.getId() + "\"}"; mdIntpSetting.getOption().setPerNote(InterpreterOption.ISOLATED); PutMethod put = httpPut("/interpreter/setting/restart/" + mdIntpSetting.getId(), jsonRequest); assertThat("isolated interpreter restart:", put, isAllowed()); put.releaseConnection(); mdIntpSetting.getOption().setPerNote(InterpreterOption.SCOPED); put = httpPut("/interpreter/setting/restart/" + mdIntpSetting.getId(), jsonRequest); assertThat("scoped interpreter restart:", put, isAllowed()); put.releaseConnection(); mdIntpSetting.getOption().setPerNote(InterpreterOption.SHARED); put = httpPut("/interpreter/setting/restart/" + mdIntpSetting.getId(), jsonRequest); assertThat("shared interpreter restart:", put, isAllowed()); put.releaseConnection(); ZeppelinServer.notebook.removeNote(note.getId(), anonymous); }