use of org.apache.beam.sdk.extensions.gcp.auth.TestCredential in project beam by apache.
the class MonitoringUtilTest method testOverridesEndpointWithStagedDataflowEndpoint.
@Test
public void testOverridesEndpointWithStagedDataflowEndpoint() {
DataflowPipelineOptions options = PipelineOptionsFactory.create().as(DataflowPipelineOptions.class);
options.setProject(PROJECT_ID);
options.setGcpCredential(new TestCredential());
String stagingDataflowEndpoint = "v0neverExisted";
options.setDataflowEndpoint(stagingDataflowEndpoint);
String cancelCommand = MonitoringUtil.getGcloudCancelCommand(options, JOB_ID);
assertEquals("CLOUDSDK_API_ENDPOINT_OVERRIDES_DATAFLOW=https://dataflow.googleapis.com/v0neverExisted/ " + "gcloud beta dataflow jobs --project=someProject cancel 1234", cancelCommand);
}
use of org.apache.beam.sdk.extensions.gcp.auth.TestCredential in project beam by apache.
the class GcsPathValidatorTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(mockGcsUtil.bucketAccessible(any(GcsPath.class))).thenReturn(true);
GcsOptions options = PipelineOptionsFactory.as(GcsOptions.class);
options.setGcpCredential(new TestCredential());
options.setGcsUtil(mockGcsUtil);
validator = GcsPathValidator.fromOptions(options);
}
use of org.apache.beam.sdk.extensions.gcp.auth.TestCredential in project beam by apache.
the class DataflowRunnerTest method testToString.
@Test
public void testToString() {
DataflowPipelineOptions options = PipelineOptionsFactory.as(DataflowPipelineOptions.class);
options.setJobName("TestJobName");
options.setProject("test-project");
options.setTempLocation("gs://test/temp/location");
options.setGcpCredential(new TestCredential());
options.setPathValidatorClass(NoopPathValidator.class);
options.setRunner(DataflowRunner.class);
assertEquals("DataflowRunner#testjobname", DataflowRunner.fromOptions(options).toString());
}
use of org.apache.beam.sdk.extensions.gcp.auth.TestCredential in project beam by apache.
the class DataflowRunnerTest method testGcpTempAndNoTempLocationSucceeds.
@Test
public void testGcpTempAndNoTempLocationSucceeds() throws Exception {
DataflowPipelineOptions options = PipelineOptionsFactory.as(DataflowPipelineOptions.class);
options.setRunner(DataflowRunner.class);
options.setGcpCredential(new TestCredential());
options.setProject("foo-project");
options.setGcpTempLocation(VALID_TEMP_BUCKET);
options.setGcsUtil(mockGcsUtil);
DataflowRunner.fromOptions(options);
}
use of org.apache.beam.sdk.extensions.gcp.auth.TestCredential in project beam by apache.
the class DataflowRunnerTest method testTempLocationAndNoGcpTempLocationSucceeds.
@Test
public void testTempLocationAndNoGcpTempLocationSucceeds() throws Exception {
DataflowPipelineOptions options = PipelineOptionsFactory.as(DataflowPipelineOptions.class);
options.setRunner(DataflowRunner.class);
options.setGcpCredential(new TestCredential());
options.setProject("foo-project");
options.setTempLocation(VALID_TEMP_BUCKET);
options.setGcsUtil(mockGcsUtil);
DataflowRunner.fromOptions(options);
}
Aggregations