use of com.google.cloud.http.HttpTransportOptions in project google-cloud-java by GoogleCloudPlatform.
the class RemoteStorageHelper method create.
/**
* Creates a {@code RemoteStorageHelper} object for the given project id and JSON key input
* stream.
*
* @param projectId id of the project to be used for running the tests
* @param keyStream input stream for a JSON key
* @return A {@code RemoteStorageHelper} object for the provided options
* @throws com.google.cloud.storage.testing.RemoteStorageHelper.StorageHelperException if
* {@code keyStream} is not a valid JSON key stream
*/
public static RemoteStorageHelper create(String projectId, InputStream keyStream) throws StorageHelperException {
try {
HttpTransportOptions transportOptions = StorageOptions.getDefaultHttpTransportOptions();
transportOptions = transportOptions.toBuilder().setConnectTimeout(60000).setReadTimeout(60000).build();
StorageOptions storageOptions = StorageOptions.newBuilder().setCredentials(GoogleCredentials.fromStream(keyStream)).setProjectId(projectId).setRetrySettings(retrySettings()).setTransportOptions(transportOptions).build();
return new RemoteStorageHelper(storageOptions);
} catch (IOException ex) {
if (log.isLoggable(Level.WARNING)) {
log.log(Level.WARNING, ex.getMessage());
}
throw StorageHelperException.translate(ex);
}
}
use of com.google.cloud.http.HttpTransportOptions in project google-cloud-java by GoogleCloudPlatform.
the class RemoteStorageHelper method create.
/**
* Creates a {@code RemoteStorageHelper} object using default project id and authentication
* credentials.
*/
public static RemoteStorageHelper create() throws StorageHelperException {
HttpTransportOptions transportOptions = StorageOptions.getDefaultHttpTransportOptions();
transportOptions = transportOptions.toBuilder().setConnectTimeout(60000).setReadTimeout(60000).build();
StorageOptions storageOptions = StorageOptions.newBuilder().setRetrySettings(retrySettings()).setTransportOptions(transportOptions).build();
return new RemoteStorageHelper(storageOptions);
}
use of com.google.cloud.http.HttpTransportOptions in project google-cloud-java by GoogleCloudPlatform.
the class RemoteComputeHelper method create.
/**
* Creates a {@code RemoteComputeHelper} object for the given project id and JSON key input
* stream.
*
* @param projectId id of the project to be used for running the tests
* @param keyStream input stream for a JSON key
* @return A {@code RemoteComputeHelper} object for the provided options
* @throws ComputeHelperException if {@code keyStream} is not a valid JSON key stream
*/
public static RemoteComputeHelper create(String projectId, InputStream keyStream) {
try {
HttpTransportOptions transportOptions = ComputeOptions.getDefaultHttpTransportOptions();
transportOptions = transportOptions.toBuilder().setConnectTimeout(60000).setReadTimeout(60000).build();
ComputeOptions computeOptions = ComputeOptions.newBuilder().setCredentials(ServiceAccountCredentials.fromStream(keyStream)).setProjectId(projectId).setRetrySettings(retrySettings()).setTransportOptions(transportOptions).build();
return new RemoteComputeHelper(computeOptions);
} catch (IOException ex) {
if (log.isLoggable(Level.WARNING)) {
log.log(Level.WARNING, ex.getMessage());
}
throw ComputeHelperException.translate(ex);
}
}
use of com.google.cloud.http.HttpTransportOptions in project google-cloud-java by GoogleCloudPlatform.
the class RemoteDatastoreHelper method create.
/**
* Creates a {@code RemoteStorageHelper} object.
*/
public static RemoteDatastoreHelper create() {
HttpTransportOptions transportOptions = DatastoreOptions.getDefaultHttpTransportOptions();
transportOptions = transportOptions.toBuilder().setConnectTimeout(60000).setReadTimeout(60000).build();
DatastoreOptions datastoreOption = DatastoreOptions.newBuilder().setNamespace(UUID.randomUUID().toString()).setRetrySettings(retrySettings()).setTransportOptions(transportOptions).build();
return new RemoteDatastoreHelper(datastoreOption);
}
use of com.google.cloud.http.HttpTransportOptions in project google-cloud-java by GoogleCloudPlatform.
the class RemoteTranslateHelper method create.
/**
* Creates a {@code RemoteStorageHelper} object.
*/
public static RemoteTranslateHelper create() {
HttpTransportOptions transportOptions = TranslateOptions.getDefaultHttpTransportOptions();
transportOptions = transportOptions.toBuilder().setConnectTimeout(60000).setReadTimeout(60000).build();
TranslateOptions translateOption = TranslateOptions.newBuilder().setRetrySettings(retryParams()).setTransportOptions(transportOptions).build();
return new RemoteTranslateHelper(translateOption);
}
Aggregations