3838import com .google .api .core .ApiClock ;
3939import com .google .api .core .CurrentMillisClock ;
4040import com .google .auth .oauth2 .GoogleCredentials ;
41+ import com .google .auth .oauth2 .ServiceAccountCredentials ;
4142import com .google .cloud .spi .ServiceRpcFactory ;
4243import com .google .common .collect .ArrayListMultimap ;
4344import com .google .common .collect .Multimap ;
@@ -58,7 +59,7 @@ class ServiceOptionsTest {
5859 private static GoogleCredentials credentialsWithQuotaProject ;
5960 private static GoogleCredentials credentialsNotInGDU ;
6061
61- private static final String JSON_KEY =
62+ private static final String SA_JSON_KEY =
6263 "{\n "
6364 + " \" private_key_id\" : \" somekeyid\" ,\n "
6465 + " \" private_key\" : \" -----BEGIN PRIVATE KEY-----\\ nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggS"
@@ -87,7 +88,7 @@ class ServiceOptionsTest {
8788 + " \" universe_domain\" : \" googleapis.com\" \n "
8889 + "}" ;
8990
90- private static final String JSON_KEY_PROJECT_ID =
91+ private static final String SA_JSON_KEY_PROJECT_ID =
9192 "{\n "
9293 + " \" private_key_id\" : \" somekeyid\" ,\n "
9394 + " \" private_key\" : \" -----BEGIN PRIVATE KEY-----\\ nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggS"
@@ -117,7 +118,7 @@ class ServiceOptionsTest {
117118 + " \" universe_domain\" : \" googleapis.com\" \n "
118119 + "}" ;
119120
120- private static final String JSON_KEY_QUOTA_PROJECT_ID =
121+ private static final String SA_JSON_KEY_QUOTA_PROJECT_ID =
121122 "{\n "
122123 + " \" private_key_id\" : \" somekeyid\" ,\n "
123124 + " \" private_key\" : \" -----BEGIN PRIVATE KEY-----\\ nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggS"
@@ -149,7 +150,7 @@ class ServiceOptionsTest {
149150 + "}" ;
150151
151152 // Key added by copying the keys above and adding in the universe domain field
152- private static final String JSON_KEY_NON_GDU =
153+ private static final String SA_JSON_KEY_NON_GDU =
153154 "{\n "
154155 + " \" private_key_id\" : \" somekeyid\" ,\n "
155156 + " \" private_key\" : \" -----BEGIN PRIVATE KEY-----\\ nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggS"
@@ -179,16 +180,16 @@ class ServiceOptionsTest {
179180 + "}" ;
180181
181182 static {
182- credentials = loadCredentials ( JSON_KEY );
183- credentialsWithProjectId = loadCredentials ( JSON_KEY_PROJECT_ID );
184- credentialsWithQuotaProject = loadCredentials ( JSON_KEY_QUOTA_PROJECT_ID );
185- credentialsNotInGDU = loadCredentials ( JSON_KEY_NON_GDU );
183+ credentials = loadServiceAccountCredentials ( SA_JSON_KEY );
184+ credentialsWithProjectId = loadServiceAccountCredentials ( SA_JSON_KEY_PROJECT_ID );
185+ credentialsWithQuotaProject = loadServiceAccountCredentials ( SA_JSON_KEY_QUOTA_PROJECT_ID );
186+ credentialsNotInGDU = loadServiceAccountCredentials ( SA_JSON_KEY_NON_GDU );
186187 }
187188
188- static GoogleCredentials loadCredentials (String credentialFile ) {
189+ static GoogleCredentials loadServiceAccountCredentials (String credentialFile ) {
189190 try {
190191 InputStream keyStream = new ByteArrayInputStream (credentialFile .getBytes ());
191- return GoogleCredentials .fromStream (keyStream );
192+ return ServiceAccountCredentials .fromStream (keyStream );
192193 } catch (IOException e ) {
193194 fail ("Couldn't create fake JSON credentials." );
194195 }
0 commit comments