Search in sources :

Example 1 with RemoteStorageHelper

use of com.google.cloud.storage.testing.RemoteStorageHelper in project google-cloud-java by GoogleCloudPlatform.

the class ITBigQueryTest method beforeClass.

@BeforeClass
public static void beforeClass() throws InterruptedException, TimeoutException {
    RemoteBigQueryHelper bigqueryHelper = RemoteBigQueryHelper.create();
    RemoteStorageHelper storageHelper = RemoteStorageHelper.create();
    bigquery = bigqueryHelper.getOptions().getService();
    storage = storageHelper.getOptions().getService();
    storage.create(BucketInfo.of(BUCKET));
    storage.create(BlobInfo.newBuilder(BUCKET, LOAD_FILE).setContentType("text/plain").build(), CSV_CONTENT.getBytes(StandardCharsets.UTF_8));
    storage.create(BlobInfo.newBuilder(BUCKET, JSON_LOAD_FILE).setContentType("application/json").build(), JSON_CONTENT.getBytes(StandardCharsets.UTF_8));
    DatasetInfo info = DatasetInfo.newBuilder(DATASET).setDescription(DESCRIPTION).setLabels(LABELS).build();
    bigquery.create(info);
    LoadJobConfiguration configuration = LoadJobConfiguration.newBuilder(TABLE_ID, "gs://" + BUCKET + "/" + JSON_LOAD_FILE, FormatOptions.json()).setCreateDisposition(JobInfo.CreateDisposition.CREATE_IF_NEEDED).setSchema(TABLE_SCHEMA).build();
    Job job = bigquery.create(JobInfo.of(configuration));
    job = job.waitFor();
    assertNull(job.getStatus().getError());
}
Also used : DatasetInfo(com.google.cloud.bigquery.DatasetInfo) RemoteStorageHelper(com.google.cloud.storage.testing.RemoteStorageHelper) RemoteBigQueryHelper(com.google.cloud.bigquery.testing.RemoteBigQueryHelper) LoadJobConfiguration(com.google.cloud.bigquery.LoadJobConfiguration) Job(com.google.cloud.bigquery.Job) BeforeClass(org.junit.BeforeClass)

Example 2 with RemoteStorageHelper

use of com.google.cloud.storage.testing.RemoteStorageHelper in project google-cloud-java by GoogleCloudPlatform.

the class ITBucketSnippets method beforeClass.

@BeforeClass
public static void beforeClass() {
    RemoteStorageHelper helper = RemoteStorageHelper.create();
    storage = helper.getOptions().getService();
    bucketSnippets = new BucketSnippets(storage.create(BucketInfo.of(BUCKET)));
}
Also used : RemoteStorageHelper(com.google.cloud.storage.testing.RemoteStorageHelper) BeforeClass(org.junit.BeforeClass)

Example 3 with RemoteStorageHelper

use of com.google.cloud.storage.testing.RemoteStorageHelper in project google-cloud-java by GoogleCloudPlatform.

the class ITBlobSnippets method beforeClass.

@BeforeClass
public static void beforeClass() {
    RemoteStorageHelper helper = RemoteStorageHelper.create();
    storage = helper.getOptions().getService();
    storage.create(BucketInfo.of(BUCKET));
    storage.create(BlobInfo.newBuilder(BUCKET, BLOB).build(), CONTENT);
}
Also used : RemoteStorageHelper(com.google.cloud.storage.testing.RemoteStorageHelper) BeforeClass(org.junit.BeforeClass)

Example 4 with RemoteStorageHelper

use of com.google.cloud.storage.testing.RemoteStorageHelper in project google-cloud-java by GoogleCloudPlatform.

the class ITStorageHmacKeySnippets method beforeClass.

@BeforeClass
public static void beforeClass() {
    RemoteStorageHelper helper = RemoteStorageHelper.create();
    storage = helper.getOptions().getService();
    storageSnippets = new StorageSnippets(storage);
}
Also used : RemoteStorageHelper(com.google.cloud.storage.testing.RemoteStorageHelper) BeforeClass(org.junit.BeforeClass)

Example 5 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)

Aggregations

RemoteStorageHelper (com.google.cloud.storage.testing.RemoteStorageHelper)6 BeforeClass (org.junit.BeforeClass)6 DatasetInfo (com.google.cloud.bigquery.DatasetInfo)1 Job (com.google.cloud.bigquery.Job)1 LoadJobConfiguration (com.google.cloud.bigquery.LoadJobConfiguration)1 RemoteBigQueryHelper (com.google.cloud.bigquery.testing.RemoteBigQueryHelper)1