use of com.google.cloud.storage.testing.RemoteStorageHelper in project java-storage-nio by googleapis.
the class ITGcsNio method beforeClass.
@BeforeClass
public static void beforeClass() throws IOException {
// loads the credentials from local disk as par README
RemoteStorageHelper gcsHelper = RemoteStorageHelper.create();
storageOptions = gcsHelper.getOptions();
project = storageOptions.getProjectId();
storage = storageOptions.getService();
// create and populate test bucket
storage.create(BucketInfo.of(BUCKET));
storage.create(BucketInfo.of(TARGET_BUCKET));
fillFile(storage, BUCKET, SML_FILE, SML_SIZE);
fillFile(storage, BUCKET, BIG_FILE, BIG_SIZE);
BucketInfo requesterPaysBucket = BucketInfo.newBuilder(REQUESTER_PAYS_BUCKET).setRequesterPays(true).build();
storage.create(requesterPaysBucket);
fillRequesterPaysFile(storage, SML_FILE, SML_SIZE);
}
use of com.google.cloud.storage.testing.RemoteStorageHelper in project google-cloud-java by GoogleCloudPlatform.
the class ITStorageSnippets method beforeClass.
@BeforeClass
public static void beforeClass() {
RemoteStorageHelper helper = RemoteStorageHelper.create();
storage = helper.getOptions().getService();
storageSnippets = new StorageSnippets(storage);
storageSnippets.createBucket(BUCKET);
}
use of com.google.cloud.storage.testing.RemoteStorageHelper in project google-cloud-java by GoogleCloudPlatform.
the class ITGcsNio method beforeClass.
@BeforeClass
public static void beforeClass() throws IOException {
// loads the credentials from local disk as par README
RemoteStorageHelper gcsHelper = RemoteStorageHelper.create();
storageOptions = gcsHelper.getOptions();
storage = storageOptions.getService();
// create and populate test bucket
storage.create(BucketInfo.of(BUCKET));
fillFile(storage, SML_FILE, SML_SIZE);
fillFile(storage, BIG_FILE, BIG_SIZE);
}
use of com.google.cloud.storage.testing.RemoteStorageHelper in project java-docs-samples by GoogleCloudPlatform.
the class ITStoragetransferSamplesTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
RemoteStorageHelper helper = RemoteStorageHelper.create();
storage = helper.getOptions().getService();
storage.create(BucketInfo.newBuilder(SOURCE_GCS_BUCKET).setLocation("us").setLifecycleRules(ImmutableList.of(new LifecycleRule(LifecycleAction.newDeleteAction(), LifecycleCondition.newBuilder().setAge(1).build()))).build());
storage.create(BucketInfo.newBuilder(SINK_GCS_BUCKET).setLocation("us").setLifecycleRules(ImmutableList.of(new LifecycleRule(LifecycleAction.newDeleteAction(), LifecycleCondition.newBuilder().setAge(1).build()))).setStorageClass(StorageClass.NEARLINE).build());
sts = StorageTransferServiceClient.create();
String serviceAccount = sts.getGoogleServiceAccount(GetGoogleServiceAccountRequest.newBuilder().setProjectId(PROJECT_ID).build()).getAccountEmail();
grantBucketsStsPermissions(serviceAccount, SOURCE_GCS_BUCKET);
grantBucketsStsPermissions(serviceAccount, SINK_GCS_BUCKET);
s3 = AmazonS3ClientBuilder.standard().withRegion(Regions.US_WEST_1).build();
s3.createBucket(AMAZON_BUCKET);
}
Aggregations