refactor(bigquery): Clean up sample test resources, fix comments (#3823) · googleapis/java-bigquery@63b8bdb · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Commit 63b8bdb

Browse files
authored
refactor(bigquery): Clean up sample test resources, fix comments (#3823)
* refactor(bigquery): Clean up sample test resources, fix comments * fix style
1 parent 4f178fe commit 63b8bdb

File tree

5 files changed

+8
-14
lines changed

5 files changed

+8
-14
lines changed

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,6 @@ public com.google.api.services.bigquery.model.Job call() throws IOException {
441441
&& createException.getCause() != null
442442
&& createException.getCause().getMessage() != null) {
443443

444-
/*GoogleJsonResponseException createExceptionCause =
445-
(GoogleJsonResponseException) createException.getCause();*/
446-
447444
Pattern pattern = Pattern.compile(".*Already.*Exists:.*Job.*", Pattern.CASE_INSENSITIVE);
448445
Matcher matcher = pattern.matcher(createException.getCause().getMessage());
449446

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/QueryJobConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ private Builder(com.google.api.services.bigquery.model.JobConfiguration configur
187187
this();
188188
JobConfigurationQuery queryConfigurationPb = configurationPb.getQuery();
189189
this.query = queryConfigurationPb.getQuery();
190-
// Allows to get undeclaredqueryparameters in jobstatistics2
190+
// Allows to get undeclared query parameters in jobstatistics
191191
if (queryConfigurationPb.getQueryParameters() == null
192192
&& queryConfigurationPb.getParameterMode() != null) {
193193
parameterMode = queryConfigurationPb.getParameterMode();

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/spi/v2/HttpBigQueryRpc.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,8 @@ public Dataset createSkipExceptionTranslation(Dataset dataset, Map<Option, ?> op
208208
.insert(dataset.getDatasetReference().getProjectId(), dataset)
209209
.setPrettyPrint(false)
210210
.setFields(Option.FIELDS.getString(options));
211-
for (Map.Entry<Option, ?> entry : options.entrySet()) {
212-
if (entry.getKey() == Option.ACCESS_POLICY_VERSION && entry.getValue() != null) {
213-
bqCreateRequest.setAccessPolicyVersion((Integer) entry.getValue());
214-
}
211+
if (options.containsKey(Option.ACCESS_POLICY_VERSION)) {
212+
bqCreateRequest.setAccessPolicyVersion((Integer) options.get(Option.ACCESS_POLICY_VERSION));
215213
}
216214
return bqCreateRequest.execute();
217215
}

google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ public void testUpdateDatasetWithSelectedFields() {
13341334
}
13351335

13361336
@Test
1337-
public void testUpdateDatabaseWithAccessPolicyVersion() throws IOException {
1337+
public void testUpdateDatasetWithAccessPolicyVersion() throws IOException {
13381338
String accessPolicyDataset = RemoteBigQueryHelper.generateDatasetName();
13391339
ServiceAccountCredentials credentials =
13401340
(ServiceAccountCredentials) GoogleCredentials.getApplicationDefault();
@@ -1827,7 +1827,7 @@ public void testCreateDatasetWithAccessPolicyVersion() throws IOException {
18271827
}
18281828

18291829
@Test(expected = BigQueryException.class)
1830-
public void testCreateDatabaseWithInvalidAccessPolicyVersion() throws IOException {
1830+
public void testCreateDatasetWithInvalidAccessPolicyVersion() throws IOException {
18311831
String accessPolicyDataset = RemoteBigQueryHelper.generateDatasetName();
18321832
ServiceAccountCredentials credentials =
18331833
(ServiceAccountCredentials) GoogleCredentials.getApplicationDefault();
@@ -4040,8 +4040,7 @@ public void testBQResultSetPagination() throws SQLException {
40404040
assertEquals(300000, cnt); // total 300000 rows should be read
40414041
}
40424042

4043-
// @Test - Temporarily disabling till https://github.com/googleapis/gax-java/issues/1712 or
4044-
// b/235591056 are resolved
4043+
@Test
40454044
public void testReadAPIIterationAndOrder()
40464045
throws SQLException { // use read API to read 300K records and check the order
40474046
String query =
@@ -4240,8 +4239,7 @@ public void testCreateDefaultConnection() throws BigQuerySQLException {
42404239
assertTrue(connection.close());
42414240
}
42424241

4243-
// @Test - Temporarily disabling till https://github.com/googleapis/gax-java/issues/1712 or
4244-
// b/235591056 are resolved
4242+
@Test
42454243
public void testReadAPIConnectionMultiClose()
42464244
throws
42474245
SQLException { // use read API to read 300K records, then closes the connection. This test

samples/snippets/src/test/java/com/example/bigquery/GrantViewAccessIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public void tearDown() {
9494
DeleteTable.deleteTable(viewDatasetName, viewName);
9595
DeleteTable.deleteTable(viewDatasetName, tableName);
9696
DeleteDataset.deleteDataset(PROJECT_ID, datasetName);
97+
DeleteDataset.deleteDataset(PROJECT_ID, viewDatasetName);
9798
// restores print statements in the original method
9899
System.out.flush();
99100
System.setOut(originalPrintStream);

0 commit comments

Comments
 (0)

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.