use of com.google.api.services.drive.model.About in project components by Talend.
the class GoogleDriveRuntimeTest method testValidateConnection.
@Test
public void testValidateConnection() throws Exception {
About about = new About();
User user = new User();
user.setEmailAddress("test@example.org");
about.setUser(user);
when(drive.about().get().setFields(anyString()).execute()).thenReturn(about);
assertEquals(Result.OK, testRuntime.validateConnection(testRuntime.getConnectionProperties()).getStatus());
}
use of com.google.api.services.drive.model.About in project components by Talend.
the class GoogleDriveDataSourceTest method testValidate.
@Test
public void testValidate() throws Exception {
dataSource.initialize(container, inputProperties);
assertEquals(Result.ERROR, dataSource.validate(container).getStatus());
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();
inputProperties.getDatasetProperties().getDatastoreProperties().serviceAccountJSONFile.setValue("service.json");
dataSource.initialize(container, inputProperties);
About about = new About();
User user = new User();
user.setEmailAddress("test@example.org");
about.setUser(user);
when(drive.about().get().setFields(anyString()).execute()).thenReturn(about);
assertEquals(Result.OK, dataSource.validate(container).getStatus());
}
use of com.google.api.services.drive.model.About in project keepass2android by PhilippC.
the class GoogleDriveFileStorage method finishInitialization.
private void finishInitialization(AccountData newAccountData, String accountName) throws IOException {
if (TextUtils.isEmpty(newAccountData.mRootFolderId)) {
logDebug("Finish init account for " + accountName);
About about = newAccountData.drive.about().get().execute();
newAccountData.mRootFolderId = about.getRootFolderId();
} else {
logDebug("Account for " + accountName + " already fully initialized.");
}
}
Aggregations