|
| 1 | +/* |
| 2 | + * Copyright 2016 Google Inc. All Rights Reserved. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package com.google.cloud.examples.bigquery.snippets; |
| 18 | + |
| 19 | +import static org.junit.Assert.assertTrue; |
| 20 | + |
| 21 | +import com.google.cloud.bigquery.BigQuery; |
| 22 | +import com.google.cloud.bigquery.Job; |
| 23 | +import com.google.cloud.bigquery.JobConfiguration; |
| 24 | +import com.google.cloud.bigquery.JobInfo; |
| 25 | +import com.google.cloud.bigquery.QueryJobConfiguration; |
| 26 | +import com.google.cloud.bigquery.testing.RemoteBigQueryHelper; |
| 27 | + |
| 28 | +import org.junit.BeforeClass; |
| 29 | +import org.junit.Test; |
| 30 | + |
| 31 | +public class ITJobSnippets { |
| 32 | + |
| 33 | + private static BigQuery bigquery; |
| 34 | + |
| 35 | + @BeforeClass |
| 36 | + public static void beforeClass() { |
| 37 | + bigquery = RemoteBigQueryHelper.create().options().service(); |
| 38 | + } |
| 39 | + |
| 40 | + @Test |
| 41 | + public void testIsDone() throws Exception { |
| 42 | + JobConfiguration jobConfig = |
| 43 | + QueryJobConfiguration.builder( |
| 44 | + "SELECT corpus FROM `publicdata.samples.shakespeare` GROUP BY corpus;") |
| 45 | + .useLegacySql(false) |
| 46 | + .build(); |
| 47 | + JobInfo jobInfo = JobInfo.builder(jobConfig).build(); |
| 48 | + Job job = bigquery.create(jobInfo); |
| 49 | + JobSnippets jobSnippets = new JobSnippets(job); |
| 50 | + boolean result = jobSnippets.isDone(); |
| 51 | + assertTrue(result); |
| 52 | + } |
| 53 | +} |
0 commit comments