Search in sources :

Example 1 with GoogleDriveGetProperties

use of org.talend.components.google.drive.get.GoogleDriveGetProperties in project components by Talend.

the class GoogleDriveGetRuntimeTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    properties = new GoogleDriveGetProperties("test");
    properties.setupProperties();
    properties = (GoogleDriveGetProperties) setupConnectionWithInstalledApplicationWithJson(properties);
    // 
    properties.file.setValue("google-drive-get");
    testRuntime = spy(GoogleDriveGetRuntime.class);
    doReturn(drive).when(testRuntime).getDriveService();
    FileList fileList = new FileList();
    List<File> files = new ArrayList<>();
    File f = new File();
    f.setId(FILE_GET_ID);
    files.add(f);
    fileList.setFiles(files);
    when(drive.files().list().setQ(anyString()).execute()).thenReturn(fileList);
    File file = new File();
    file.setId("fileName-id");
    file.setMimeType(GoogleDriveMimeTypes.MIME_TYPE_JSON);
    file.setFileExtension("json");
    when(drive.files().get(anyString()).setFields(anyString()).execute()).thenReturn(file);
}
Also used : FileList(com.google.api.services.drive.model.FileList) GoogleDriveGetProperties(org.talend.components.google.drive.get.GoogleDriveGetProperties) ArrayList(java.util.ArrayList) File(com.google.api.services.drive.model.File) Before(org.junit.Before)

Example 2 with GoogleDriveGetProperties

use of org.talend.components.google.drive.get.GoogleDriveGetProperties in project components by Talend.

the class GoogleDriveGetReaderTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    // 
    properties = new GoogleDriveGetProperties("test");
    properties.setupProperties();
    properties = (GoogleDriveGetProperties) setupConnectionWithInstalledApplicationWithJson(properties);
    // 
    properties.file.setValue("google-drive-get");
    FileList fileList = new FileList();
    List<File> files = new ArrayList<>();
    File f = new File();
    f.setId(FILE_GET_ID);
    files.add(f);
    fileList.setFiles(files);
    when(drive.files().list().setQ(anyString()).execute()).thenReturn(fileList);
    File file = new File();
    file.setId(FILE_GET_ID);
    file.setMimeType(GoogleDriveMimeTypes.MIME_TYPE_JSON);
    file.setFileExtension("json");
    when(drive.files().get(anyString()).setFields(anyString()).execute()).thenReturn(file);
}
Also used : FileList(com.google.api.services.drive.model.FileList) GoogleDriveGetProperties(org.talend.components.google.drive.get.GoogleDriveGetProperties) 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 GoogleDriveGetProperties (org.talend.components.google.drive.get.GoogleDriveGetProperties)2