Skip to content

Commit f73bd27

Browse files
chore: use credential-specific fromStream method (#2242)
1 parent 442565e commit f73bd27

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/test/java/com/google/cloud/spanner/jdbc/JdbcDatabaseMetaDataTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import static org.mockito.Mockito.mock;
2424
import static org.mockito.Mockito.when;
2525

26-
import com.google.auth.oauth2.GoogleCredentials;
26+
import com.google.auth.oauth2.ServiceAccountCredentials;
2727
import com.google.cloud.spanner.Dialect;
2828
import com.google.cloud.spanner.connection.ConnectionOptions;
2929
import com.google.cloud.spanner.connection.ConnectionOptionsTest;
@@ -555,8 +555,8 @@ public void testGetVersionColumns() throws SQLException {
555555

556556
@Test
557557
public void testGetUserName() throws SQLException, IOException {
558-
GoogleCredentials credentials =
559-
GoogleCredentials.fromStream(
558+
ServiceAccountCredentials credentials =
559+
ServiceAccountCredentials.fromStream(
560560
Objects.requireNonNull(ConnectionOptionsTest.class.getResource("test-key.json"))
561561
.openStream());
562562
JdbcConnection connection = mock(JdbcConnection.class);

src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcConnectTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import com.google.auth.oauth2.AccessToken;
2222
import com.google.auth.oauth2.GoogleCredentials;
23+
import com.google.auth.oauth2.ServiceAccountCredentials;
2324
import com.google.cloud.spanner.Database;
2425
import com.google.cloud.spanner.Dialect;
2526
import com.google.cloud.spanner.ParallelIntegrationTest;
@@ -230,7 +231,8 @@ public void testConnectWithDataSourceWithConflictingValues() throws SQLException
230231
public void testConnectWithOAuthToken() throws Exception {
231232
GoogleCredentials credentials;
232233
if (hasValidKeyFile()) {
233-
credentials = GoogleCredentials.fromStream(Files.newInputStream(Paths.get(getKeyFile())));
234+
credentials =
235+
ServiceAccountCredentials.fromStream(Files.newInputStream(Paths.get(getKeyFile())));
234236
} else {
235237
try {
236238
credentials = GoogleCredentials.getApplicationDefault();

0 commit comments

Comments
 (0)