Search in sources :

Example 1 with GoogleDriveCreateProperties

use of org.talend.components.google.drive.create.GoogleDriveCreateProperties in project components by Talend.

the class GoogleDriveCreateReaderTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    properties = new GoogleDriveCreateProperties("test");
    properties.setupProperties();
    properties = (GoogleDriveCreateProperties) setupConnectionWithInstalledApplicationWithIdAndSecret(properties);
    // 
    properties.parentFolder.setValue(FOLDER_ROOT);
    properties.newFolder.setValue(FOLDER_CREATE);
    File fc = new File();
    fc.setId(FOLDER_CREATE_ID);
    when(drive.files().create(any(File.class)).setFields(eq("id")).execute()).thenReturn(fc);
}
Also used : GoogleDriveCreateProperties(org.talend.components.google.drive.create.GoogleDriveCreateProperties) File(com.google.api.services.drive.model.File) Before(org.junit.Before)

Example 2 with GoogleDriveCreateProperties

use of org.talend.components.google.drive.create.GoogleDriveCreateProperties in project components by Talend.

the class GoogleDriveCreateRuntimeTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    properties = new GoogleDriveCreateProperties("test");
    properties.setupProperties();
    properties = (GoogleDriveCreateProperties) setupConnectionWithInstalledApplicationWithIdAndSecret(properties);
    // 
    properties.parentFolder.setValue(FOLDER_ROOT);
    properties.newFolder.setValue(FOLDER_CREATE);
    testRuntime = spy(GoogleDriveCreateRuntime.class);
    doReturn(drive).when(testRuntime).getDriveService();
    File fc = new File();
    fc.setId(FOLDER_CREATE_ID);
    when(drive.files().create(any(File.class)).setFields(eq("id")).execute()).thenReturn(fc);
    // 
    FileList flA = new FileList();
    List<File> fs = new ArrayList<>();
    File fA = new File();
    fA.setId("A");
    fs.add(fA);
    flA.setFiles(fs);
    when(drive.files().list().setQ(eq(qA)).execute()).thenReturn(flA);
    FileList flB = new FileList();
    List<File> fsA = new ArrayList<>();
    File fB = new File();
    fB.setId("B");
    fsA.add(fB);
    flB.setFiles(fsA);
    when(drive.files().list().setQ(eq(qB)).execute()).thenReturn(flB);
    FileList flC = new FileList();
    List<File> fsC = new ArrayList<>();
    File fC = new File();
    fC.setId("C");
    fsC.add(fC);
    flC.setFiles(fsC);
    when(drive.files().list().setQ(eq(qC)).execute()).thenReturn(flC);
}
Also used : GoogleDriveCreateProperties(org.talend.components.google.drive.create.GoogleDriveCreateProperties) 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 Before (org.junit.Before)2 GoogleDriveCreateProperties (org.talend.components.google.drive.create.GoogleDriveCreateProperties)2 FileList (com.google.api.services.drive.model.FileList)1 ArrayList (java.util.ArrayList)1