|
16 | 16 |
|
17 | 17 | package com.google.cloud.bigquery.it; |
18 | 18 |
|
| 19 | +import static com.google.cloud.bigquery.JobStatus.State.DONE; |
19 | 20 | import static org.junit.Assert.assertArrayEquals; |
20 | 21 | import static org.junit.Assert.assertEquals; |
21 | 22 | import static org.junit.Assert.assertFalse; |
@@ -1067,6 +1068,26 @@ public void testQueryJob() throws InterruptedException, TimeoutException { |
1067 | 1068 | assertNotNull(statistics.getQueryPlan()); |
1068 | 1069 | } |
1069 | 1070 |
|
| 1071 | + @Test |
| 1072 | + public void testQueryJobWithDryRun() throws InterruptedException, TimeoutException { |
| 1073 | + String tableName = "test_query_job_table"; |
| 1074 | + String query = new StringBuilder() |
| 1075 | + .append("SELECT TimestampField, StringField, BooleanField FROM ") |
| 1076 | + .append(TABLE_ID.getTable()) |
| 1077 | + .toString(); |
| 1078 | + TableId destinationTable = TableId.of(DATASET, tableName); |
| 1079 | + QueryJobConfiguration configuration = QueryJobConfiguration.newBuilder(query) |
| 1080 | + .setDefaultDataset(DatasetId.of(DATASET)) |
| 1081 | + .setDestinationTable(destinationTable) |
| 1082 | + .setDryRun(true) |
| 1083 | + .build(); |
| 1084 | + Job remoteJob = bigquery.create(JobInfo.of(configuration)); |
| 1085 | + System.out.println("job (dryrun): " + remoteJob); |
| 1086 | + assertNull(remoteJob.getJobId().getJob()); |
| 1087 | + assertEquals(DONE, remoteJob.getStatus().getState()); |
| 1088 | + assertNotNull(remoteJob.getConfiguration()); |
| 1089 | + } |
| 1090 | + |
1070 | 1091 | @Test |
1071 | 1092 | public void testExtractJob() throws InterruptedException, TimeoutException { |
1072 | 1093 | String tableName = "test_export_job_table"; |
|
0 commit comments