com.google.api.services.drive.Drive.Files.List Java Examples
The following examples show how to use
com.google.api.services.drive.Drive.Files.List.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GoogleDriveListReaderTest.java From components with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { super.setUp(); // stubbing mockList = mock(List.class, RETURNS_DEEP_STUBS); when(drive.files().list()).thenReturn(mockList); when(drive.files().list().setQ(eq(qA)).execute()).thenReturn(createFolderFileList("A", false)); when(drive.files().list().setQ(eq(qGSA)).execute()).thenReturn(createFolderFileList("A", false)); when(drive.files().list().setQ(eq(qB)).execute()).thenReturn(createFolderFileList("B", false)); when(drive.files().list().setQ(eq(qC)).execute()).thenReturn(createFolderFileList("C", false)); // properties = new GoogleDriveListProperties("test"); properties.setupProperties(); properties = (GoogleDriveListProperties) setupConnectionWithInstalledApplicationWithIdAndSecret(properties); properties.folder.setValue(FOLDER_ROOT); }
Example #2
Source File: GoogleDriveInputReaderTest.java From components with Apache License 2.0 | 4 votes |
@Test public void testAdvance() throws Exception { dataSource = spy(dataSource); Drive drive = mock(Drive.class, RETURNS_DEEP_STUBS); GoogleDriveUtils utils = mock(GoogleDriveUtils.class, RETURNS_DEEP_STUBS); doReturn(drive).when(dataSource).getDriveService(); doReturn(utils).when(dataSource).getDriveUtils(); List mockList = mock(List.class, RETURNS_DEEP_STUBS); when(drive.files().list()).thenReturn(mockList); // // String qA = "name='A' and 'root' in parents and mimeType='application/vnd.google-apps.folder' and trashed=false"; // // when(drive.files().list().setQ(eq(qA)).execute()).thenReturn(createFolderFileList("A", false)); // // GoogleDriveAbstractListReader alr = mock(GoogleDriveAbstractListReader.class); // doReturn(true).when(alr).start(); inputProperties.getDatasetProperties().folder.setValue("A"); FileList fileList = new FileList(); File f = new File(); f.setName("sd"); f.setMimeType("text/text"); f.setId("id-1"); f.setModifiedTime(com.google.api.client.util.DateTime.parseRfc3339("2017-09-29T10:00:00")); f.setSize(100L); f.setKind("drive#fileName"); f.setTrashed(false); f.setParents(Collections.singletonList(FOLDER_ROOT)); f.setWebViewLink("https://toto.com"); fileList.setFiles(Arrays.asList(f, f, f, f, f)); when(mockList.execute()).thenReturn(fileList); dataSource.initialize(container, inputProperties); reader = (GoogleDriveInputReader) dataSource.createReader(container); reader.setLimit(2); assertTrue(reader.start()); reader.getCurrent(); assertTrue(reader.advance()); reader.getCurrent(); assertFalse(reader.advance()); }