Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import static org.junit.Assert.fail;

import com.google.cloud.Page;
import com.google.cloud.WaitForOption;
import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.BigQuery.DatasetField;
import com.google.cloud.bigquery.BigQuery.DatasetOption;
Expand Down Expand Up @@ -899,7 +900,7 @@ public void testListJobsWithSelectedFields() {
}

@Test
public void testCreateAndGetJob() {
public void testCreateAndGetJob() throws InterruptedException, TimeoutException {
String sourceTableName = "test_create_and_get_job_source_table";
String destinationTableName = "test_create_and_get_job_destination_table";
TableId sourceTable = TableId.of(DATASET, sourceTableName);
Expand Down Expand Up @@ -930,11 +931,18 @@ public void testCreateAndGetJob() {
assertEquals(createdJob.getSelfLink(), remoteJob.getSelfLink());
assertEquals(createdJob.getUserEmail(), remoteJob.getUserEmail());
assertTrue(createdTable.delete());

Job completedJob =
remoteJob.waitFor(
WaitForOption.checkEvery(1, TimeUnit.SECONDS),
WaitForOption.timeout(1, TimeUnit.MINUTES));
assertNotNull(completedJob);
assertNull(completedJob.getStatus().getError());
assertTrue(bigquery.delete(DATASET, destinationTableName));
}

@Test
public void testCreateAndGetJobWithSelectedFields() {
public void testCreateAndGetJobWithSelectedFields() throws InterruptedException, TimeoutException {
String sourceTableName = "test_create_and_get_job_with_selected_fields_source_table";
String destinationTableName = "test_create_and_get_job_with_selected_fields_destination_table";
TableId sourceTable = TableId.of(DATASET, sourceTableName);
Expand Down Expand Up @@ -972,6 +980,13 @@ public void testCreateAndGetJobWithSelectedFields() {
assertNull(remoteJob.getSelfLink());
assertNull(remoteJob.getUserEmail());
assertTrue(createdTable.delete());

Job completedJob =
remoteJob.waitFor(
WaitForOption.checkEvery(1, TimeUnit.SECONDS),
WaitForOption.timeout(1, TimeUnit.MINUTES));
assertNotNull(completedJob);
assertNull(completedJob.getStatus().getError());
assertTrue(bigquery.delete(DATASET, destinationTableName));
}

Expand Down