Search in sources :

Example 1 with GoogleDriveDeleteProperties

use of org.talend.components.google.drive.delete.GoogleDriveDeleteProperties in project components by Talend.

the class GoogleDriveDeleteReaderTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    // 
    properties = new GoogleDriveDeleteProperties("test");
    properties.setupProperties();
    properties = (GoogleDriveDeleteProperties) setupConnectionWithInstalledApplicationWithJson(properties);
    // 
    properties.file.setValue(FOLDER_DELETE);
    when(drive.files().update(anyString(), any(File.class)).execute()).thenReturn(null);
    when(drive.files().delete(anyString()).execute()).thenReturn(null);
    FileList fileList = new FileList();
    List<File> files = new ArrayList<>();
    File f = new File();
    f.setId(FOLDER_DELETE_ID);
    files.add(f);
    fileList.setFiles(files);
    when(drive.files().list().setQ(anyString()).execute()).thenReturn(fileList);
}
Also used : GoogleDriveDeleteProperties(org.talend.components.google.drive.delete.GoogleDriveDeleteProperties) FileList(com.google.api.services.drive.model.FileList) ArrayList(java.util.ArrayList) File(com.google.api.services.drive.model.File) Before(org.junit.Before)

Example 2 with GoogleDriveDeleteProperties

use of org.talend.components.google.drive.delete.GoogleDriveDeleteProperties in project components by Talend.

the class GoogleDriveDeleteRuntimeTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    properties = new GoogleDriveDeleteProperties("test");
    properties.setupProperties();
    properties = (GoogleDriveDeleteProperties) setupConnectionWithInstalledApplicationWithJson(properties);
    // 
    properties.file.setValue(FOLDER_DELETE);
    testRuntime = spy(GoogleDriveDeleteRuntime.class);
    doReturn(drive).when(testRuntime).getDriveService();
    when(drive.files().update(anyString(), any(File.class)).execute()).thenReturn(null);
    when(drive.files().delete(anyString()).execute()).thenReturn(null);
    deleteFileList = new FileList();
    List<File> files = new ArrayList<>();
    File f = new File();
    f.setId(FOLDER_DELETE_ID);
    files.add(f);
    deleteFileList.setFiles(files);
}
Also used : GoogleDriveDeleteProperties(org.talend.components.google.drive.delete.GoogleDriveDeleteProperties) FileList(com.google.api.services.drive.model.FileList) ArrayList(java.util.ArrayList) File(com.google.api.services.drive.model.File) Before(org.junit.Before)

Aggregations

File (com.google.api.services.drive.model.File)2 FileList (com.google.api.services.drive.model.FileList)2 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 GoogleDriveDeleteProperties (org.talend.components.google.drive.delete.GoogleDriveDeleteProperties)2