Sha256: aa786aa36461d2a33f05628e2e71f9c540549d062ba9766650b81dd64f896bac
Contents?: true
Size: 1.55 KB
Versions: 1
Compression:
Stored size: 1.55 KB
Contents
package org.embulk.output.gcs_streaming; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assume.assumeNotNull; import java.util.Optional; public class TestGcsClient { private static String gcpProjectId; private static Optional<String> gcpJsonKeyfile; /* * This test case requires environment variables * GCP_PROJECT_ID * GCP_JSON_KEYFILE * And prepare gcloud authentication ADC, following command. * $ gcloud auth application-default login */ @BeforeClass public static void initializeConstant() { gcpProjectId = System.getenv("GCP_PROJECT_ID"); gcpJsonKeyfile = Optional.of(System.getenv("GCP_JSON_KEYFILE")); assumeNotNull(gcpJsonKeyfile, gcpProjectId); // skip test cases, if environment variables are not set. } @Test public void testGetStorageSuccess() throws RuntimeException { Optional<String> empty = Optional.empty(); GcsClient client = new GcsClient(gcpProjectId, empty); } @Test public void testGetStorageSuccessFromJsonKeyfile() throws RuntimeException { GcsClient client = new GcsClient(gcpProjectId, gcpJsonKeyfile); } @Test(expected = RuntimeException.class) public void testGetStorageFailFromJsonKeyfile() throws RuntimeException { Optional<String> notFoundJsonKeyfile = Optional.of("/path/to/key.json"); GcsClient client = new GcsClient(gcpProjectId, notFoundJsonKeyfile); assertEquals(1, 2); } }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
embulk-output-gcs_streaming-0.1.0 | src/test/java/org/embulk/output/gcs_streaming/TestGcsClient.java |