@Test public void testListDrives() throws Exception { final AttributedList<Path> list = new OneDriveListService(session).list(new Path("/", EnumSet.of(Path.Type.directory)), new DisabledListProgressListener()); assertFalse(list.isEmpty()); for(Path f : list) { assertEquals(new Path("/", EnumSet.of(Path.Type.directory)), f.getParent()); } assertTrue(list.contains(new OneDriveHomeFinderService(session).find())); }
@Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { if(directory.isRoot()) { final AttributedList<Path> list = new AttributedList<>(); list.add(MYFILES_NAME); list.add(SHARED_NAME); listener.chunk(directory, list); return list; } else if(SHARED_NAME.equals(directory)) { return new OneDriveSharedWithMeListService(session).list(directory, listener); } else { return new GraphItemListService(session).list(directory, listener); } }
OneDriveListService implements ListService { @Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { if(directory.isRoot()) { final AttributedList<Path> list = new AttributedList<>(); list.add(MYFILES_NAME); list.add(SHARED_NAME); listener.chunk(directory, list); return list; } else if(SHARED_NAME.equals(directory)) { return new OneDriveSharedWithMeListService(session).list(directory, listener); } else { return new GraphItemListService(session).list(directory, listener); } } }
OneDriveListService implements ListService { @Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { if(directory.isRoot()) { final AttributedList<Path> list = new AttributedList<>(); list.add(MYFILES_NAME); list.add(SHARED_NAME); listener.chunk(directory, list); return list; } else if(SHARED_NAME.equals(directory)) { return new OneDriveSharedWithMeListService(session).list(directory, listener); } else { return new GraphItemListService(session).list(directory, listener); } } OneDriveListService(final GraphSession session); }
OneDriveListService implements ListService { @Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { if(directory.isRoot()) { final AttributedList<Path> list = new AttributedList<>(); list.add(MYFILES_NAME); list.add(SHARED_NAME); listener.chunk(directory, list); return list; } else if(SHARED_NAME.equals(directory)) { return new OneDriveSharedWithMeListService(session).list(directory, listener); } else { return new GraphItemListService(session).list(directory, listener); } } OneDriveListService(final GraphSession session); @Override AttributedList<Path> list(final Path directory, final ListProgressListener listener); }
OneDriveListService implements ListService { @Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { if(directory.isRoot()) { final AttributedList<Path> list = new AttributedList<>(); list.add(MYFILES_NAME); list.add(SHARED_NAME); listener.chunk(directory, list); return list; } else if(SHARED_NAME.equals(directory)) { return new OneDriveSharedWithMeListService(session).list(directory, listener); } else { return new GraphItemListService(session).list(directory, listener); } } OneDriveListService(final GraphSession session); @Override AttributedList<Path> list(final Path directory, final ListProgressListener listener); static final Path MYFILES_NAME; static final Path SHARED_NAME; }