1616
1717package com .google .cloud .bigquery .jdbc .it ;
1818
19+
1920import static org .junit .jupiter .api .Assertions .assertEquals ;
2021import static org .junit .jupiter .api .Assertions .assertFalse ;
2122import static org .junit .jupiter .api .Assertions .assertNotNull ;
@@ -90,7 +91,7 @@ public void testValidServiceAccountAuthentication() throws SQLException, IOExcep
9091 Files .write (tempFile .toPath (), authJson .toString ().getBytes ());
9192
9293 String connection_uri =
93- "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443; "
94+ getBaseConnectionUrl () + " "
9495 + "ProjectId="
9596 + authJson .get ("project_id" ).getAsString ()
9697 + ";OAuthType=0;"
@@ -105,7 +106,7 @@ public void testValidServiceAccountAuthentication() throws SQLException, IOExcep
105106 @ Test
106107 public void testServiceAccountAuthenticationMissingOAuthPvtKeyPath () throws SQLException {
107108 String connection_uri =
108- "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443; "
109+ getBaseConnectionUrl () + " "
109110 + "ProjectId="
110111 + PROJECT_ID
111112 + ";OAuthType=0;" ;
@@ -127,7 +128,7 @@ public void testValidServiceAccountAuthenticationOAuthPvtKeyAsPath()
127128 Files .write (tempFile .toPath (), authJson .toString ().getBytes ());
128129
129130 String connection_uri =
130- "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443; "
131+ getBaseConnectionUrl () + " "
131132 + "ProjectId="
132133 + authJson .get ("project_id" ).getAsString ()
133134 + ";OAuthType=0;"
@@ -144,7 +145,7 @@ public void testValidServiceAccountAuthenticationViaEmailAndPkcs8Key()
144145 final JsonObject authJson = getAuthJson ();
145146
146147 String connection_uri =
147- "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443; "
148+ getBaseConnectionUrl () + " "
148149 + "ProjectId="
149150 + authJson .get ("project_id" ).getAsString ()
150151 + ";OAuthType=0;"
@@ -162,7 +163,7 @@ public void testValidServiceAccountAuthenticationOAuthPvtKeyAsJson()
162163 final JsonObject authJson = getAuthJson ();
163164
164165 String connection_uri =
165- "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443; "
166+ getBaseConnectionUrl () + " "
166167 + "ProjectId="
167168 + authJson .get ("project_id" ).getAsString ()
168169 + ";OAuthType=0;"
@@ -192,7 +193,7 @@ public void testValidServiceAccountAuthenticationP12() throws SQLException, IOEx
192193 @ Disabled
193194 public void testValidGoogleUserAccountAuthentication () throws SQLException {
194195 String connection_uri =
195- "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443; PROJECTID="
196+ getBaseConnectionUrl () + " PROJECTID="
196197 + PROJECT_ID
197198 + ";OAuthType=1;OAuthClientId=client_id;OAuthClientSecret=client_secret;" ;
198199
@@ -213,7 +214,7 @@ public void testValidGoogleUserAccountAuthentication() throws SQLException {
213214 @ Disabled
214215 public void testValidExternalAccountAuthentication () throws SQLException {
215216 String connection_uri =
216- "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443; PROJECTID="
217+ getBaseConnectionUrl () + " PROJECTID="
217218 + PROJECT_ID
218219 + ";OAUTHTYPE=4;"
219220 + "BYOID_AudienceUri=//iam.googleapis.com/projects/<project>/locations/<location>/workloadIdentityPools/<pool>/providers/<provider>;"
@@ -237,7 +238,7 @@ public void testValidExternalAccountAuthentication() throws SQLException {
237238 @ Disabled
238239 public void testValidExternalAccountAuthenticationFromFile () throws SQLException {
239240 String connection_uri =
240- "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443; PROJECTID="
241+ getBaseConnectionUrl () + " PROJECTID="
241242 + PROJECT_ID
242243 + ";OAUTHTYPE=4;"
243244 + "OAuthPvtKeyPath=/path/to/file;" ;
@@ -259,7 +260,7 @@ public void testValidExternalAccountAuthenticationFromFile() throws SQLException
259260 @ Disabled
260261 public void testValidExternalAccountAuthenticationRawJson () throws SQLException {
261262 String connection_uri =
262- "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443; PROJECTID="
263+ getBaseConnectionUrl () + " PROJECTID="
263264 + PROJECT_ID
264265 + ";OAUTHTYPE=4;OAuthPvtKey={\n "
265266 + " \" universe_domain\" : \" googleapis.com\" ,\n "
@@ -303,7 +304,7 @@ public void testValidPreGeneratedAccessTokenAuthentication(String scope, boolean
303304 String accessToken = credentials .getAccessToken ().getTokenValue ();
304305
305306 String connectionUri =
306- "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443; ProjectId="
307+ getBaseConnectionUrl () + " ProjectId="
307308 + authJson .get ("project_id" ).getAsString ()
308309 + ";OAuthType=2"
309310 + ";OAuthAccessToken="
@@ -319,7 +320,7 @@ public void testValidPreGeneratedAccessTokenAuthentication(String scope, boolean
319320 @ Disabled
320321 public void testValidRefreshTokenAuthentication () throws SQLException {
321322 String connection_uri =
322- "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443; PROJECTID="
323+ getBaseConnectionUrl () + " PROJECTID="
323324 + PROJECT_ID
324325 + ";OAUTHTYPE=2;OAuthRefreshToken=refresh_token;"
325326 + ";OAuthClientId=client;OAuthClientSecret=secret;" ;
0 commit comments