|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -package com.google.gcloud.bigquery; |
18 | | - |
19 | | -import static com.google.gcloud.bigquery.BigQuery.DatasetField; |
20 | | -import static com.google.gcloud.bigquery.BigQuery.JobField; |
21 | | -import static com.google.gcloud.bigquery.BigQuery.JobListOption; |
22 | | -import static com.google.gcloud.bigquery.BigQuery.JobOption; |
23 | | -import static com.google.gcloud.bigquery.BigQuery.TableField; |
24 | | -import static com.google.gcloud.bigquery.BigQuery.TableOption; |
| 17 | +package com.google.gcloud.bigquery.it; |
| 18 | + |
25 | 19 | import static org.junit.Assert.assertEquals; |
26 | 20 | import static org.junit.Assert.assertFalse; |
27 | 21 | import static org.junit.Assert.assertNotNull; |
|
32 | 26 | import com.google.common.collect.ImmutableList; |
33 | 27 | import com.google.common.collect.ImmutableMap; |
34 | 28 | import com.google.gcloud.Page; |
| 29 | +import com.google.gcloud.WriteChannel; |
| 30 | +import com.google.gcloud.bigquery.BigQuery; |
| 31 | +import com.google.gcloud.bigquery.BigQuery.DatasetField; |
35 | 32 | import com.google.gcloud.bigquery.BigQuery.DatasetOption; |
| 33 | +import com.google.gcloud.bigquery.BigQuery.JobField; |
| 34 | +import com.google.gcloud.bigquery.BigQuery.JobListOption; |
| 35 | +import com.google.gcloud.bigquery.BigQuery.JobOption; |
| 36 | +import com.google.gcloud.bigquery.BigQuery.TableField; |
| 37 | +import com.google.gcloud.bigquery.BigQuery.TableOption; |
| 38 | +import com.google.gcloud.bigquery.BigQueryError; |
| 39 | +import com.google.gcloud.bigquery.BigQueryException; |
| 40 | +import com.google.gcloud.bigquery.CopyJobConfiguration; |
| 41 | +import com.google.gcloud.bigquery.Dataset; |
| 42 | +import com.google.gcloud.bigquery.DatasetId; |
| 43 | +import com.google.gcloud.bigquery.DatasetInfo; |
| 44 | +import com.google.gcloud.bigquery.ExternalTableDefinition; |
| 45 | +import com.google.gcloud.bigquery.ExtractJobConfiguration; |
| 46 | +import com.google.gcloud.bigquery.Field; |
| 47 | +import com.google.gcloud.bigquery.FieldValue; |
| 48 | +import com.google.gcloud.bigquery.FormatOptions; |
| 49 | +import com.google.gcloud.bigquery.InsertAllRequest; |
| 50 | +import com.google.gcloud.bigquery.InsertAllResponse; |
| 51 | +import com.google.gcloud.bigquery.Job; |
| 52 | +import com.google.gcloud.bigquery.JobInfo; |
| 53 | +import com.google.gcloud.bigquery.LoadJobConfiguration; |
| 54 | +import com.google.gcloud.bigquery.QueryJobConfiguration; |
| 55 | +import com.google.gcloud.bigquery.QueryRequest; |
| 56 | +import com.google.gcloud.bigquery.QueryResponse; |
| 57 | +import com.google.gcloud.bigquery.Schema; |
| 58 | +import com.google.gcloud.bigquery.StandardTableDefinition; |
| 59 | +import com.google.gcloud.bigquery.Table; |
| 60 | +import com.google.gcloud.bigquery.TableDefinition; |
| 61 | +import com.google.gcloud.bigquery.TableId; |
| 62 | +import com.google.gcloud.bigquery.TableInfo; |
| 63 | +import com.google.gcloud.bigquery.ViewDefinition; |
| 64 | +import com.google.gcloud.bigquery.WriteChannelConfiguration; |
36 | 65 | import com.google.gcloud.bigquery.testing.RemoteBigQueryHelper; |
37 | 66 | import com.google.gcloud.storage.BlobInfo; |
38 | 67 | import com.google.gcloud.storage.BucketInfo; |
|
45 | 74 | import org.junit.Test; |
46 | 75 | import org.junit.rules.Timeout; |
47 | 76 |
|
48 | | -import java.io.FileNotFoundException; |
49 | 77 | import java.io.IOException; |
50 | 78 | import java.nio.ByteBuffer; |
51 | 79 | import java.nio.charset.StandardCharsets; |
@@ -140,7 +168,7 @@ public class ITBigQueryTest { |
140 | 168 | public Timeout globalTimeout = Timeout.seconds(300); |
141 | 169 |
|
142 | 170 | @BeforeClass |
143 | | - public static void beforeClass() throws IOException, InterruptedException { |
| 171 | + public static void beforeClass() throws InterruptedException { |
144 | 172 | RemoteBigQueryHelper bigqueryHelper = RemoteBigQueryHelper.create(); |
145 | 173 | RemoteGcsHelper gcsHelper = RemoteGcsHelper.create(); |
146 | 174 | bigquery = bigqueryHelper.options().service(); |
@@ -685,7 +713,7 @@ public void testListJobsWithSelectedFields() { |
685 | 713 | } |
686 | 714 |
|
687 | 715 | @Test |
688 | | - public void testCreateAndGetJob() throws InterruptedException { |
| 716 | + public void testCreateAndGetJob() { |
689 | 717 | String sourceTableName = "test_create_and_get_job_source_table"; |
690 | 718 | String destinationTableName = "test_create_and_get_job_destination_table"; |
691 | 719 | TableId sourceTable = TableId.of(DATASET, sourceTableName); |
@@ -717,7 +745,7 @@ public void testCreateAndGetJob() throws InterruptedException { |
717 | 745 | } |
718 | 746 |
|
719 | 747 | @Test |
720 | | - public void testCreateAndGetJobWithSelectedFields() throws InterruptedException { |
| 748 | + public void testCreateAndGetJobWithSelectedFields() { |
721 | 749 | String sourceTableName = "test_create_and_get_job_with_selected_fields_source_table"; |
722 | 750 | String destinationTableName = "test_create_and_get_job_with_selected_fields_destination_table"; |
723 | 751 | TableId sourceTable = TableId.of(DATASET, sourceTableName); |
@@ -874,20 +902,20 @@ public void testCancelJob() throws InterruptedException { |
874 | 902 | } |
875 | 903 |
|
876 | 904 | @Test |
877 | | - public void testCancelNonExistingJob() throws InterruptedException { |
| 905 | + public void testCancelNonExistingJob() { |
878 | 906 | assertFalse(bigquery.cancel("test_cancel_non_existing_job")); |
879 | 907 | } |
880 | 908 |
|
881 | 909 | @Test |
882 | | - public void testInsertFromFile() throws InterruptedException, FileNotFoundException { |
| 910 | + public void testInsertFromFile() throws InterruptedException { |
883 | 911 | String destinationTableName = "test_insert_from_file_table"; |
884 | 912 | TableId tableId = TableId.of(DATASET, destinationTableName); |
885 | 913 | WriteChannelConfiguration configuration = WriteChannelConfiguration.builder(tableId) |
886 | 914 | .formatOptions(FormatOptions.json()) |
887 | 915 | .createDisposition(JobInfo.CreateDisposition.CREATE_IF_NEEDED) |
888 | 916 | .schema(TABLE_SCHEMA) |
889 | 917 | .build(); |
890 | | - try (TableDataWriteChannel channel = bigquery.writer(configuration)) { |
| 918 | + try (WriteChannel channel = bigquery.writer(configuration)) { |
891 | 919 | channel.write(ByteBuffer.wrap(JSON_CONTENT.getBytes(StandardCharsets.UTF_8))); |
892 | 920 | } catch (IOException e) { |
893 | 921 | fail("IOException was not expected"); |
|
0 commit comments