Class FakeJobService
java.lang.Object
org.apache.beam.sdk.io.gcp.testing.FakeJobService
- All Implemented Interfaces:
Serializable,AutoCloseable,BigQueryServices.JobService
@Internal
public class FakeJobService
extends Object
implements BigQueryServices.JobService, Serializable
A fake implementation of BigQuery's job service.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()dryRunQuery(String projectId, JobConfigurationQuery query, String location) Dry runs the query in the given project.voidexpectDryRunQuery(String projectId, String query, JobStatistics result) getJob(JobReference jobRef) Gets the specifiedJobby the givenJobReference.intpollJob(JobReference jobRef, int maxAttempts) Waits for the job is Done, and returns the job.voidsetNumFailuresExpected(int numFailuresExpected) static voidsetUp()voidstartCopyJob(JobReference jobRef, JobConfigurationTableCopy copyConfig) Start a BigQuery copy job.voidstartExtractJob(JobReference jobRef, JobConfigurationExtract extractConfig) Start a BigQuery extract job.voidstartLoadJob(JobReference jobRef, JobConfigurationLoad loadConfig) Start a BigQuery load job.voidstartLoadJob(JobReference jobRef, JobConfigurationLoad loadConfig, com.google.api.client.http.AbstractInputStreamContent streamContent) Start a BigQuery load job with stream content.voidstartQueryJob(JobReference jobRef, JobConfigurationQuery query) Start a BigQuery query job.
-
Constructor Details
-
FakeJobService
public FakeJobService() -
FakeJobService
public FakeJobService(int numFailures)
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
setNumFailuresExpected
public void setNumFailuresExpected(int numFailuresExpected) -
setUp
public static void setUp() -
startLoadJob
Description copied from interface:BigQueryServices.JobServiceStart a BigQuery load job.- Specified by:
startLoadJobin interfaceBigQueryServices.JobService- Throws:
IOException
-
startLoadJob
public void startLoadJob(JobReference jobRef, JobConfigurationLoad loadConfig, com.google.api.client.http.AbstractInputStreamContent streamContent) throws InterruptedException, IOException Description copied from interface:BigQueryServices.JobServiceStart a BigQuery load job with stream content.- Specified by:
startLoadJobin interfaceBigQueryServices.JobService- Throws:
InterruptedExceptionIOException
-
startExtractJob
public void startExtractJob(JobReference jobRef, JobConfigurationExtract extractConfig) throws IOException Description copied from interface:BigQueryServices.JobServiceStart a BigQuery extract job.- Specified by:
startExtractJobin interfaceBigQueryServices.JobService- Throws:
IOException
-
getNumExtractJobCalls
public int getNumExtractJobCalls() -
startQueryJob
Description copied from interface:BigQueryServices.JobServiceStart a BigQuery query job.- Specified by:
startQueryJobin interfaceBigQueryServices.JobService
-
startCopyJob
public void startCopyJob(JobReference jobRef, JobConfigurationTableCopy copyConfig) throws IOException Description copied from interface:BigQueryServices.JobServiceStart a BigQuery copy job.- Specified by:
startCopyJobin interfaceBigQueryServices.JobService- Throws:
IOException
-
pollJob
Description copied from interface:BigQueryServices.JobServiceWaits for the job is Done, and returns the job.Returns null if the
maxAttemptsretries reached.- Specified by:
pollJobin interfaceBigQueryServices.JobService- Throws:
InterruptedException
-
expectDryRunQuery
-
dryRunQuery
Description copied from interface:BigQueryServices.JobServiceDry runs the query in the given project.- Specified by:
dryRunQueryin interfaceBigQueryServices.JobService
-
getAllJobs
-
getJob
Description copied from interface:BigQueryServices.JobService- Specified by:
getJobin interfaceBigQueryServices.JobService
-