VFSNotebookRepo implements NotebookRepo { @Override public List<NoteInfo> list(AuthenticationInfo subject) throws IOException { FileObject rootDir = getRootDir(); FileObject[] children = rootDir.getChildren(); List<NoteInfo> infos = new LinkedList<NoteInfo>(); for (FileObject f : children) { String fileName = f.getName().getBaseName(); if (f.isHidden() || fileName.startsWith(".") || fileName.startsWith("#") || fileName.startsWith("~")) { continue; } if (!isDirectory(f)) { continue; } NoteInfo info = null; try { info = getNoteInfo(f); if (info != null) { infos.add(info); } } catch (Exception e) { logger.error("Can't read note " + f.getName().toString(), e); } } return infos; } VFSNotebookRepo(ZeppelinConfiguration conf); @Override List<NoteInfo> list(AuthenticationInfo subject); @Override Note get(String noteId, AuthenticationInfo subject); @Override synchronized void save(Note note, AuthenticationInfo subject); @Override void remove(String noteId, AuthenticationInfo subject); @Override void close(); @Override Revision checkpoint(String noteId, String checkpointMsg, AuthenticationInfo subject); @Override Note get(String noteId, Revision rev, AuthenticationInfo subject); @Override List<Revision> revisionHistory(String noteId, AuthenticationInfo subject);  }
@Test public void testInvalidJsonFile() throws IOException { int numNotes = notebookRepo.list(null).size(); File testNoteDir = new File(mainNotebookDir, "test"); testNoteDir.mkdir(); FileUtils.writeStringToFile(new File(testNoteDir, "note.json"), ""); assertEquals(numNotes, notebookRepo.list(null).size()); }