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 TypeMethodDescriptionvoid
close()
dryRunQuery
(String projectId, JobConfigurationQuery query, String location) Dry runs the query in the given project.void
expectDryRunQuery
(String projectId, String query, JobStatistics result) getJob
(JobReference jobRef) Gets the specifiedJob
by the givenJobReference
.int
pollJob
(JobReference jobRef, int maxAttempts) Waits for the job is Done, and returns the job.void
setNumFailuresExpected
(int numFailuresExpected) static void
setUp()
void
startCopyJob
(JobReference jobRef, JobConfigurationTableCopy copyConfig) Start a BigQuery copy job.void
startExtractJob
(JobReference jobRef, JobConfigurationExtract extractConfig) Start a BigQuery extract job.void
startLoadJob
(JobReference jobRef, JobConfigurationLoad loadConfig) Start a BigQuery load job.void
startLoadJob
(JobReference jobRef, JobConfigurationLoad loadConfig, com.google.api.client.http.AbstractInputStreamContent streamContent) Start a BigQuery load job with stream content.void
startQueryJob
(JobReference jobRef, JobConfigurationQuery query) Start a BigQuery query job.
-
Constructor Details
-
FakeJobService
public FakeJobService() -
FakeJobService
public FakeJobService(int numFailures)
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
setNumFailuresExpected
public void setNumFailuresExpected(int numFailuresExpected) -
setUp
public static void setUp() -
startLoadJob
Description copied from interface:BigQueryServices.JobService
Start a BigQuery load job.- Specified by:
startLoadJob
in 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.JobService
Start a BigQuery load job with stream content.- Specified by:
startLoadJob
in interfaceBigQueryServices.JobService
- Throws:
InterruptedException
IOException
-
startExtractJob
public void startExtractJob(JobReference jobRef, JobConfigurationExtract extractConfig) throws IOException Description copied from interface:BigQueryServices.JobService
Start a BigQuery extract job.- Specified by:
startExtractJob
in interfaceBigQueryServices.JobService
- Throws:
IOException
-
getNumExtractJobCalls
public int getNumExtractJobCalls() -
startQueryJob
Description copied from interface:BigQueryServices.JobService
Start a BigQuery query job.- Specified by:
startQueryJob
in interfaceBigQueryServices.JobService
-
startCopyJob
public void startCopyJob(JobReference jobRef, JobConfigurationTableCopy copyConfig) throws IOException Description copied from interface:BigQueryServices.JobService
Start a BigQuery copy job.- Specified by:
startCopyJob
in interfaceBigQueryServices.JobService
- Throws:
IOException
-
pollJob
Description copied from interface:BigQueryServices.JobService
Waits for the job is Done, and returns the job.Returns null if the
maxAttempts
retries reached.- Specified by:
pollJob
in interfaceBigQueryServices.JobService
- Throws:
InterruptedException
-
expectDryRunQuery
-
dryRunQuery
Description copied from interface:BigQueryServices.JobService
Dry runs the query in the given project.- Specified by:
dryRunQuery
in interfaceBigQueryServices.JobService
-
getAllJobs
-
getJob
Description copied from interface:BigQueryServices.JobService
- Specified by:
getJob
in interfaceBigQueryServices.JobService
-