Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit 90a5d9d

Browse files
committed
lint + fix unittest
1 parent 5819829 commit 90a5d9d

5 files changed

Lines changed: 32 additions & 26 deletions

File tree

google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryConnection.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,10 @@ private BigQuery getBigQueryConnection() {
10651065
}
10661066

10671067
BigQueryOptions options = bigQueryOptions.setHeaderProvider(HEADER_PROVIDER).build();
1068-
options.setDefaultJobCreationMode(this.useStatelessQueryMode ? JobCreationMode.JOB_CREATION_OPTIONAL : JobCreationMode.JOB_CREATION_REQUIRED);
1068+
options.setDefaultJobCreationMode(
1069+
this.useStatelessQueryMode
1070+
? JobCreationMode.JOB_CREATION_OPTIONAL
1071+
: JobCreationMode.JOB_CREATION_REQUIRED);
10691072
return options.getService();
10701073
}
10711074

google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryConnectionProperty.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public String getDescription() {
3636
}
3737

3838
public String getDefaultValue() {
39-
if (defaultValueSupplier != null){
39+
if (defaultValueSupplier != null) {
4040
return defaultValueSupplier.get();
4141
}
4242
return defaultValue;

google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryJdbcOAuthUtility.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ private static GoogleCredentials getGoogleServiceAccountCredentials(
367367
PrivateKey key = null;
368368
InputStream stream = null;
369369
byte[] keyBytes = pvtKey != null ? pvtKey.getBytes() : null;
370-
370+
371371
if (isFileExists(keyPath)) {
372372
keyBytes = Files.readAllBytes(Paths.get(keyPath));
373373
}

google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryJdbcUrlUtility.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
import java.util.List;
2727
import java.util.Map;
2828
import java.util.Map.Entry;
29-
import java.util.function.Supplier;
3029
import java.util.Properties;
3130
import java.util.Set;
31+
import java.util.function.Supplier;
3232
import java.util.logging.Level;
3333
import java.util.regex.Matcher;
3434
import java.util.regex.Pattern;
@@ -682,7 +682,10 @@ static String parseStringProperty(
682682
}
683683

684684
static String parseStringPropertyLazyDefault(
685-
String url, String propertyName, Supplier<String> defaultValueSupplier, String callerClassName) {
685+
String url,
686+
String propertyName,
687+
Supplier<String> defaultValueSupplier,
688+
String callerClassName) {
686689
LOG.finest("++enter++\t" + callerClassName);
687690
String parsedValue = BigQueryJdbcUrlUtility.parseUriProperty(url, propertyName);
688691
if (parsedValue != null) {

google-cloud-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/BigQueryConnectionTest.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public class BigQueryConnectionTest {
4040

4141
private static final String DEFAULT_VERSION = "0.0.0";
4242
private static final String DEFAULT_JDBC_TOKEN_VALUE = "Google-BigQuery-JDBC-Driver";
43+
private static final String BASE_URL =
44+
"jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;"
45+
+ "OAuthType=2;OAuthAccessToken=redacted;ProjectId=project;";
4346
private String expectedVersion;
4447

4548
@Before
@@ -386,34 +389,31 @@ public void testBigQueryReadClientKeepAliveSettings() throws SQLException, IOExc
386389

387390
@Test
388391
public void testBigQueryJobCreationMode_required() throws Exception {
389-
String url =
390-
"jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;"
391-
+ "OAuthType=3;JobCreationMode=1;";
392-
try (BigQueryConnection connection = new BigQueryConnection(url)) {
393-
BigQuery bq = connection.getBigQuery();
394-
assertEquals(bq.getOptions().getDefaultJobCreationMode(), JobCreationMode.JOB_CREATION_REQUIRED);
395-
}
392+
String url = BASE_URL + "JobCreationMode=1;";
393+
try (BigQueryConnection connection = new BigQueryConnection(url)) {
394+
BigQuery bq = connection.getBigQuery();
395+
assertEquals(
396+
bq.getOptions().getDefaultJobCreationMode(), JobCreationMode.JOB_CREATION_REQUIRED);
397+
}
396398
}
397399

398400
@Test
399401
public void testBigQueryJobCreationMode_optional() throws Exception {
400-
String url =
401-
"jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;"
402-
+ "OAuthType=3;JobCreationMode=2;";
403-
try (BigQueryConnection connection = new BigQueryConnection(url)) {
404-
BigQuery bq = connection.getBigQuery();
405-
assertEquals(bq.getOptions().getDefaultJobCreationMode(), JobCreationMode.JOB_CREATION_OPTIONAL);
406-
}
402+
String url = BASE_URL + "JobCreationMode=2;";
403+
try (BigQueryConnection connection = new BigQueryConnection(url)) {
404+
BigQuery bq = connection.getBigQuery();
405+
assertEquals(
406+
bq.getOptions().getDefaultJobCreationMode(), JobCreationMode.JOB_CREATION_OPTIONAL);
407+
}
407408
}
408409

409410
@Test
410411
public void testBigQueryJobCreationMode_default() throws Exception {
411-
String url =
412-
"jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;"
413-
+ "OAuthType=3;";
414-
try (BigQueryConnection connection = new BigQueryConnection(url)) {
415-
BigQuery bq = connection.getBigQuery();
416-
assertEquals(bq.getOptions().getDefaultJobCreationMode(), JobCreationMode.JOB_CREATION_OPTIONAL);
417-
}
412+
String url = BASE_URL;
413+
try (BigQueryConnection connection = new BigQueryConnection(url)) {
414+
BigQuery bq = connection.getBigQuery();
415+
assertEquals(
416+
bq.getOptions().getDefaultJobCreationMode(), JobCreationMode.JOB_CREATION_OPTIONAL);
417+
}
418418
}
419419
}

0 commit comments

Comments
 (0)