Skip to content

Commit 46e654e

Browse files
committed
chore: Migrate executor tests to use ServiceAccountCredentials.fromStream()
1 parent 94d0474 commit 46e654e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

google-cloud-spanner-executor/src/main/java/com/google/cloud/executor/spanner/CloudClientExecutor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.google.api.gax.rpc.UnavailableException;
2828
import com.google.auth.Credentials;
2929
import com.google.auth.oauth2.GoogleCredentials;
30+
import com.google.auth.oauth2.ServiceAccountCredentials;
3031
import com.google.cloud.ByteArray;
3132
import com.google.cloud.Date;
3233
import com.google.cloud.NoCredentials;
@@ -888,7 +889,7 @@ private synchronized TraceServiceClient getTraceServiceClient() throws IOExcepti
888889
credentials = NoCredentials.getInstance();
889890
} else {
890891
credentials =
891-
GoogleCredentials.fromStream(
892+
ServiceAccountCredentials.fromStream(
892893
new ByteArrayInputStream(
893894
FileUtils.readFileToByteArray(new File(WorkerProxy.serviceKeyFile))),
894895
HTTP_TRANSPORT_FACTORY);

google-cloud-spanner-executor/src/main/java/com/google/cloud/executor/spanner/WorkerProxy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import com.google.api.client.http.javanet.NetHttpTransport;
2020
import com.google.auth.Credentials;
2121
import com.google.auth.http.HttpTransportFactory;
22-
import com.google.auth.oauth2.GoogleCredentials;
22+
import com.google.auth.oauth2.ServiceAccountCredentials;
2323
import com.google.cloud.opentelemetry.trace.TraceConfiguration;
2424
import com.google.cloud.opentelemetry.trace.TraceExporter;
2525
import com.google.cloud.spanner.ErrorCode;
@@ -87,7 +87,7 @@ public static OpenTelemetrySdk setupOpenTelemetrySdk() throws Exception {
8787
// Read credentials from the serviceKeyFile.
8888
HttpTransportFactory HTTP_TRANSPORT_FACTORY = NetHttpTransport::new;
8989
Credentials credentials =
90-
GoogleCredentials.fromStream(
90+
ServiceAccountCredentials.fromStream(
9191
new ByteArrayInputStream(FileUtils.readFileToByteArray(new File(serviceKeyFile))),
9292
HTTP_TRANSPORT_FACTORY);
9393

0 commit comments

Comments
 (0)