Package com.google.cloud.storage.testing (2.24.0)

A testing helper for Google Cloud Storage.

A simple usage example:

Before the test:


 RemoteStorageHelper helper = RemoteStorageHelper.create();
 Storage storage = helper.getOptions().getService();
 String bucket = RemoteStorageHelper.generateBucketName();
 storage.create(BucketInfo.of(bucket));
 

After the test:


 RemoteStorageHelper.forceDelete(storage, bucket, 5, TimeUnit.SECONDS);
 

See Also: Google Cloud Java tools for testing

Classes

RemoteStorageHelper

Utility to create a remote storage configuration for testing. Storage options can be obtained via the #getOptions() ()} method. Returned options have custom StorageOptions#getRetrySettings(): RetrySettings#getMaxAttempts() is 10, RetrySettings#getMaxRetryDelay() is 30000, RetrySettings#getTotalTimeout() is 120000 and RetrySettings#getInitialRetryDelay() is 250. HttpTransportOptions#getConnectTimeout() and HttpTransportOptions#getReadTimeout() are both set to 60000.

StorageRpcTestBase

A stub implementation of StorageRpc which can be used outside of the Storage module for testing purposes. All the methods throw an UnsupportedOperationException.

Exceptions

RemoteStorageHelper.StorageHelperException