Java Code Examples for com.google.cloud.storage.testing.RemoteStorageHelper#create()

The following examples show how to use com.google.cloud.storage.testing.RemoteStorageHelper#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractGCSIT.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setUp() {
    try {
        helper = RemoteStorageHelper.create();
        storage = helper.getOptions().getService();

        if (storage.get(BUCKET) != null) {
            // As the generateBucketName function uses a UUID, this should pretty much never happen
            fail("Bucket " + BUCKET + " exists. Please rerun the test to generate a new bucket name.");
        }

        // Create the bucket
        storage.create(BucketInfo.of(BUCKET));
    } catch (StorageException e) {
        fail("Can't create bucket " + BUCKET + ": " + e.getLocalizedMessage());
    }

    if (storage.get(BUCKET) == null) {
        fail("Setup incomplete, tests will fail");
    }
}
 
Example 2
Source File: AbstractGCSIT.java    From nifi with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setUp() {
    try {
        helper = RemoteStorageHelper.create();
        storage = helper.getOptions().getService();

        if (storage.get(BUCKET) != null) {
            // As the generateBucketName function uses a UUID, this should pretty much never happen
            fail("Bucket " + BUCKET + " exists. Please rerun the test to generate a new bucket name.");
        }

        // Create the bucket
        storage.create(BucketInfo.of(BUCKET));
    } catch (StorageException e) {
        fail("Can't create bucket " + BUCKET + ": " + e.getLocalizedMessage());
    }

    if (storage.get(BUCKET) == null) {
        fail("Setup incomplete, tests will fail");
    }
}
 
Example 3
Source File: GcsBucket.java    From gcp-ingestion with Mozilla Public License 2.0 5 votes vote down vote up
/** Find credentials in the environment and create a bucket in GCS. */
@Override
protected void starting(Description description) {
  RemoteStorageHelper storageHelper = RemoteStorageHelper.create();
  storage = storageHelper.getOptions().getService();
  bucket = RemoteStorageHelper.generateBucketName();
  storage.create(BucketInfo.newBuilder(bucket).build());
}
 
Example 4
Source File: KeyStoreIntegrationTest.java    From gcp-ingestion with Mozilla Public License 2.0 5 votes vote down vote up
/** Create a storage bucket for metadata and keys. */
@Before
public void createBucket() {
  RemoteStorageHelper storageHelper = RemoteStorageHelper.create();
  storage = storageHelper.getOptions().getService();
  projectId = storageHelper.getOptions().getProjectId();
  bucket = RemoteStorageHelper.generateBucketName();
  storage.create(BucketInfo.of(bucket));
}
 
Example 5
Source File: StorageIntegrationTest.java    From gcp-ingestion with Mozilla Public License 2.0 5 votes vote down vote up
/** Find credentials in the environment and create a bucket in GCS. */
@Before
public void createBucket() {
  RemoteStorageHelper storageHelper = RemoteStorageHelper.create();
  storage = storageHelper.getOptions().getService();
  projectId = storageHelper.getOptions().getProjectId();
  bucket = RemoteStorageHelper.generateBucketName();
  storage.create(BucketInfo.of(bucket));
}
 
Example 6
Source File: ITStorageSnippets.java    From google-cloud-java with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void beforeClass() {
  RemoteStorageHelper helper = RemoteStorageHelper.create();
  storage = helper.getOptions().getService();
  storageSnippets = new StorageSnippets(storage);
  storageSnippets.createBucket(BUCKET);
}
 
Example 7
Source File: ITBucketSnippets.java    From google-cloud-java with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void beforeClass() {
  RemoteStorageHelper helper = RemoteStorageHelper.create();
  storage = helper.getOptions().getService();
  bucketSnippets = new BucketSnippets(storage.create(BucketInfo.of(BUCKET)));
}
 
Example 8
Source File: ITStorageHmacKeySnippets.java    From google-cloud-java with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void beforeClass() {
  RemoteStorageHelper helper = RemoteStorageHelper.create();
  storage = helper.getOptions().getService();
  storageSnippets = new StorageSnippets(storage);
}
 
Example 9
Source File: ITBlobSnippets.java    From google-cloud-java with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void beforeClass() {
  RemoteStorageHelper helper = RemoteStorageHelper.create();
  storage = helper.getOptions().getService();
  storage.create(BucketInfo.of(BUCKET));
}