use of org.talend.components.google.drive.put.GoogleDrivePutProperties in project components by Talend.
the class GoogleDrivePutRuntimeTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
properties = new GoogleDrivePutProperties("test");
properties.connection.setupProperties();
properties.connection.setupLayout();
properties.schemaMain.setupProperties();
properties.schemaMain.setupLayout();
properties.setupProperties();
properties.setupLayout();
properties = (GoogleDrivePutProperties) setupConnectionWithAccessToken(properties);
properties.uploadMode.setValue(UploadMode.UPLOAD_LOCAL_FILE);
properties.fileName.setValue(FILE_PUT_NAME);
properties.localFilePath.setValue("c:/Users/undx/brasil.jpg");
properties.overwrite.setValue(true);
properties.destinationFolder.setValue("root");
testRuntime = spy(GoogleDrivePutRuntime.class);
doReturn(drive).when(testRuntime).getDriveService();
when(drive.files().list().setQ(anyString()).execute()).thenReturn(emptyFileList);
//
File putFile = new File();
putFile.setId(PUT_FILE_ID);
putFile.setParents(Collections.singletonList(PUT_FILE_PARENT_ID));
when(drive.files().create(any(File.class), any(AbstractInputStreamContent.class)).setFields(anyString()).execute()).thenReturn(putFile);
}
use of org.talend.components.google.drive.put.GoogleDrivePutProperties in project components by Talend.
the class GoogleDriveWriteOperationTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
properties = new GoogleDrivePutProperties("test");
properties.connection.setupProperties();
properties.connection.setupLayout();
properties.schemaMain.setupProperties();
properties.schemaMain.setupLayout();
properties = (GoogleDrivePutProperties) setupConnectionWithInstalledApplicationWithIdAndSecret(properties);
properties.setupLayout();
sink = new GoogleDriveSink();
sink.initialize(container, properties);
wop = new GoogleDriveWriteOperation(sink);
}
use of org.talend.components.google.drive.put.GoogleDrivePutProperties in project components by Talend.
the class GoogleDrivePutWriterTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
properties = new GoogleDrivePutProperties("test");
properties.connection.setupProperties();
properties.connection.setupLayout();
properties.schemaMain.setupProperties();
properties.schemaMain.setupLayout();
properties.setupProperties();
properties.setupLayout();
properties = (GoogleDrivePutProperties) setupConnectionWithAccessToken(properties);
properties.uploadMode.setValue(UploadMode.UPLOAD_LOCAL_FILE);
properties.fileName.setValue("GoogleDrive Put test BR");
properties.localFilePath.setValue("c:/Users/undx/brasil.jpg");
properties.overwrite.setValue(true);
properties.destinationFolder.setValue("root");
sink.initialize(container, properties);
wop = (GoogleDriveWriteOperation) sink.createWriteOperation();
writer = new GoogleDrivePutWriter(wop, properties, container);
when(drive.files().list().setQ(anyString()).execute()).thenReturn(emptyFileList);
//
File putFile = new File();
putFile.setId(PUT_FILE_ID);
putFile.setParents(Collections.singletonList(PUT_FILE_PARENT_ID));
when(drive.files().create(any(File.class), any(AbstractInputStreamContent.class)).setFields(anyString()).execute()).thenReturn(putFile);
}
use of org.talend.components.google.drive.put.GoogleDrivePutProperties in project components by Talend.
the class GoogleDrivePutReaderTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
properties = new GoogleDrivePutProperties("test");
properties.connection.setupProperties();
properties.connection.setupLayout();
properties.schemaMain.setupProperties();
properties.schemaMain.setupLayout();
properties.setupProperties();
properties.setupLayout();
properties = (GoogleDrivePutProperties) setupConnectionWithAccessToken(properties);
properties.uploadMode.setValue(UploadMode.UPLOAD_LOCAL_FILE);
properties.fileName.setValue(FILE_PUT_NAME);
properties.localFilePath.setValue(Paths.get(getClass().getClassLoader().getResource("service_account.json").toURI()).toString());
properties.overwrite.setValue(true);
properties.destinationFolder.setValue("root");
when(drive.files().list().setQ(anyString()).execute()).thenReturn(emptyFileList);
//
File putFile = new File();
putFile.setId(PUT_FILE_ID);
putFile.setParents(Collections.singletonList(PUT_FILE_PARENT_ID));
when(drive.files().create(any(File.class), any(AbstractInputStreamContent.class)).setFields(anyString()).execute()).thenReturn(putFile);
}
Aggregations