@@ -186,7 +186,6 @@ public void testFromStreamServiceAccount() throws IOException {
186186 "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr.apps.googleusercontent.com" ;
187187 final String serviceAccountEmail =
188188 "36680232662-vrd7ji19qgchd0ah2csanun6bnr@developer.gserviceaccount.com" ;
189- final String projectId = "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr" ;
190189
191190 MockTokenServerTransport transport = new MockTokenServerTransport ();
192191 transport .addServiceAccount (serviceAccountEmail , accessToken );
@@ -198,7 +197,6 @@ public void testFromStreamServiceAccount() throws IOException {
198197 serviceAccountContents .put ("client_email" , serviceAccountEmail );
199198 serviceAccountContents .put ("private_key" , SA_KEY_TEXT );
200199 serviceAccountContents .put ("private_key_id" , SA_KEY_ID );
201- serviceAccountContents .put ("project_id" , projectId );
202200 serviceAccountContents .put ("type" , GoogleCredential .SERVICE_ACCOUNT_FILE_TYPE );
203201 String json = serviceAccountContents .toPrettyString ();
204202 InputStream serviceAccountStream = new ByteArrayInputStream (json .getBytes ());
@@ -218,7 +216,6 @@ public void testFromStreamServiceAccountAlternateTokenUri() throws IOException {
218216 "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr.apps.googleusercontent.com" ;
219217 final String serviceAccountEmail =
220218 "36680232662-vrd7ji19qgchd0ah2csanun6bnr@developer.gserviceaccount.com" ;
221- final String projectId = "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr" ;
222219
223220 final String tokenServerUrl = "http://another.auth.com/token" ;
224221 MockTokenServerTransport transport = new MockTokenServerTransport (tokenServerUrl );
@@ -231,7 +228,6 @@ public void testFromStreamServiceAccountAlternateTokenUri() throws IOException {
231228 serviceAccountContents .put ("client_email" , serviceAccountEmail );
232229 serviceAccountContents .put ("private_key" , SA_KEY_TEXT );
233230 serviceAccountContents .put ("private_key_id" , SA_KEY_ID );
234- serviceAccountContents .put ("project_id" , projectId );
235231 serviceAccountContents .put ("type" , GoogleCredential .SERVICE_ACCOUNT_FILE_TYPE );
236232 serviceAccountContents .put ("token_uri" , tokenServerUrl );
237233 String json = serviceAccountContents .toPrettyString ();
@@ -251,7 +247,6 @@ public void testFromStreamServiceAccountAlternateTokenUri() throws IOException {
251247 public void testFromStreamServiceAccountMissingClientIdThrows () throws IOException {
252248 final String serviceAccountEmail =
253249 "36680232662-vrd7ji19qgchd0ah2csanun6bnr@developer.gserviceaccount.com" ;
254- final String projectId = "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr" ;
255250
256251 MockHttpTransport transport = new MockTokenServerTransport ();
257252
@@ -261,7 +256,6 @@ public void testFromStreamServiceAccountMissingClientIdThrows() throws IOExcepti
261256 serviceAccountContents .put ("client_email" , serviceAccountEmail );
262257 serviceAccountContents .put ("private_key" , SA_KEY_TEXT );
263258 serviceAccountContents .put ("private_key_id" , SA_KEY_ID );
264- serviceAccountContents .put ("project_id" , projectId );
265259 serviceAccountContents .put ("type" , GoogleCredential .SERVICE_ACCOUNT_FILE_TYPE );
266260 String json = serviceAccountContents .toPrettyString ();
267261 InputStream serviceAccountStream = new ByteArrayInputStream (json .getBytes ());
@@ -277,7 +271,6 @@ public void testFromStreamServiceAccountMissingClientIdThrows() throws IOExcepti
277271 public void testFromStreamServiceAccountMissingClientEmailThrows () throws IOException {
278272 final String serviceAccountId =
279273 "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr.apps.googleusercontent.com" ;
280- final String projectId = "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr" ;
281274
282275 MockHttpTransport transport = new MockTokenServerTransport ();
283276
@@ -287,7 +280,6 @@ public void testFromStreamServiceAccountMissingClientEmailThrows() throws IOExce
287280 serviceAccountContents .put ("client_id" , serviceAccountId );
288281 serviceAccountContents .put ("private_key" , SA_KEY_TEXT );
289282 serviceAccountContents .put ("private_key_id" , SA_KEY_ID );
290- serviceAccountContents .put ("project_id" , projectId );
291283 serviceAccountContents .put ("type" , GoogleCredential .SERVICE_ACCOUNT_FILE_TYPE );
292284 String json = serviceAccountContents .toPrettyString ();
293285 InputStream serviceAccountStream = new ByteArrayInputStream (json .getBytes ());
@@ -305,7 +297,6 @@ public void testFromStreamServiceAccountMissingPrivateKeyThrows() throws IOExcep
305297 "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr.apps.googleusercontent.com" ;
306298 final String serviceAccountEmail =
307299 "36680232662-vrd7ji19qgchd0ah2csanun6bnr@developer.gserviceaccount.com" ;
308- final String projectId = "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr" ;
309300
310301 MockHttpTransport transport = new MockTokenServerTransport ();
311302
@@ -315,7 +306,6 @@ public void testFromStreamServiceAccountMissingPrivateKeyThrows() throws IOExcep
315306 serviceAccountContents .put ("client_id" , serviceAccountId );
316307 serviceAccountContents .put ("client_email" , serviceAccountEmail );
317308 serviceAccountContents .put ("private_key_id" , SA_KEY_ID );
318- serviceAccountContents .put ("project_id" , projectId );
319309 serviceAccountContents .put ("type" , GoogleCredential .SERVICE_ACCOUNT_FILE_TYPE );
320310 String json = serviceAccountContents .toPrettyString ();
321311 InputStream serviceAccountStream = new ByteArrayInputStream (json .getBytes ());
@@ -333,7 +323,6 @@ public void testFromStreamServiceAccountMissingPrivateKeyIdThrows() throws IOExc
333323 "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr.apps.googleusercontent.com" ;
334324 final String serviceAccountEmail =
335325 "36680232662-vrd7ji19qgchd0ah2csanun6bnr@developer.gserviceaccount.com" ;
336- final String projectId = "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr" ;
337326
338327 MockHttpTransport transport = new MockTokenServerTransport ();
339328
@@ -343,7 +332,6 @@ public void testFromStreamServiceAccountMissingPrivateKeyIdThrows() throws IOExc
343332 serviceAccountContents .put ("client_id" , serviceAccountId );
344333 serviceAccountContents .put ("client_email" , serviceAccountEmail );
345334 serviceAccountContents .put ("private_key" , SA_KEY_TEXT );
346- serviceAccountContents .put ("project_id" , projectId );
347335 serviceAccountContents .put ("type" , GoogleCredential .SERVICE_ACCOUNT_FILE_TYPE );
348336 String json = serviceAccountContents .toPrettyString ();
349337 InputStream serviceAccountStream = new ByteArrayInputStream (json .getBytes ());
@@ -356,33 +344,6 @@ public void testFromStreamServiceAccountMissingPrivateKeyIdThrows() throws IOExc
356344 }
357345 }
358346
359- public void testFromStreamServiceAccountMissingProjectIdThrows () throws IOException {
360- final String serviceAccountId =
361- "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr.apps.googleusercontent.com" ;
362- final String serviceAccountEmail =
363- "36680232662-vrd7ji19qgchd0ah2csanun6bnr@developer.gserviceaccount.com" ;
364-
365- MockHttpTransport transport = new MockTokenServerTransport ();
366-
367- // Write out user file
368- GenericJson serviceAccountContents = new GenericJson ();
369- serviceAccountContents .setFactory (JSON_FACTORY );
370- serviceAccountContents .put ("client_id" , serviceAccountId );
371- serviceAccountContents .put ("client_email" , serviceAccountEmail );
372- serviceAccountContents .put ("private_key" , SA_KEY_TEXT );
373- serviceAccountContents .put ("private_key_id" , SA_KEY_ID );
374- serviceAccountContents .put ("type" , GoogleCredential .SERVICE_ACCOUNT_FILE_TYPE );
375- String json = serviceAccountContents .toPrettyString ();
376- InputStream serviceAccountStream = new ByteArrayInputStream (json .getBytes ());
377-
378- try {
379- GoogleCredential .fromStream (serviceAccountStream , transport , JSON_FACTORY );
380- fail ();
381- } catch (IOException expected ) {
382- assertTrue (expected .getMessage ().contains ("project_id" ));
383- }
384- }
385-
386347 public void testFromStreamUser () throws IOException {
387348 final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2" ;
388349 final String clientSecret = "jakuaL9YyieakhECKL2SwZcu" ;
0 commit comments