Search in sources :

Example 6 with RemoteStorageHelper

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);
}
Also used : RemoteStorageHelper(com.google.cloud.storage.testing.RemoteStorageHelper) BucketInfo(com.google.cloud.storage.BucketInfo) BeforeClass(org.junit.BeforeClass)

Example 7 with RemoteStorageHelper

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);
}
Also used : RemoteStorageHelper(com.google.cloud.storage.testing.RemoteStorageHelper) BeforeClass(org.junit.BeforeClass)

Example 8 with RemoteStorageHelper

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);
}
Also used : RemoteStorageHelper(com.google.cloud.storage.testing.RemoteStorageHelper) BeforeClass(org.junit.BeforeClass)

Example 9 with RemoteStorageHelper

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);
}
Also used : RemoteStorageHelper(com.google.cloud.storage.testing.RemoteStorageHelper) LifecycleRule(com.google.cloud.storage.BucketInfo.LifecycleRule) BeforeClass(org.junit.BeforeClass)

Aggregations

RemoteStorageHelper (com.google.cloud.storage.testing.RemoteStorageHelper)9 BeforeClass (org.junit.BeforeClass)9 DatasetInfo (com.google.cloud.bigquery.DatasetInfo)2 Job (com.google.cloud.bigquery.Job)2 LoadJobConfiguration (com.google.cloud.bigquery.LoadJobConfiguration)2 RemoteBigQueryHelper (com.google.cloud.bigquery.testing.RemoteBigQueryHelper)2 BucketInfo (com.google.cloud.storage.BucketInfo)1 LifecycleRule (com.google.cloud.storage.BucketInfo.LifecycleRule)1 InputStream (java.io.InputStream)1