File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
gax-java/gax/src/test/java/com/google/api/gax/core Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,28 @@ void serviceAccountReplacedWithJwtTokens() throws Exception {
7171 assertThat (jwtCreds .getUniverseDomain ()).isEqualTo (Credentials .GOOGLE_DEFAULT_UNIVERSE );
7272 }
7373
74+ @ Test
75+ void serviceAccountReplacedWithJwtTokens_setEmptyDomain () throws Exception {
76+ ServiceAccountCredentials serviceAccountCredentials =
77+ CreateServiceAccountCredentials ().toBuilder ().setUniverseDomain ("" ).build ();
78+
79+ GoogleCredentialsProvider provider =
80+ GoogleCredentialsProvider .newBuilder ()
81+ .setScopesToApply (ImmutableList .of ("scope1" , "scope2" ))
82+ .setJwtEnabledScopes (ImmutableList .of ("scope1" ))
83+ .setOAuth2Credentials (serviceAccountCredentials )
84+ .build ();
85+
86+ Credentials credentials = provider .getCredentials ();
87+ assertThat (credentials ).isInstanceOf (ServiceAccountJwtAccessCredentials .class );
88+ ServiceAccountJwtAccessCredentials jwtCreds = (ServiceAccountJwtAccessCredentials ) credentials ;
89+ assertThat (jwtCreds .getClientId ()).isEqualTo (serviceAccountCredentials .getClientId ());
90+ assertThat (jwtCreds .getClientEmail ()).isEqualTo (serviceAccountCredentials .getClientEmail ());
91+ assertThat (jwtCreds .getPrivateKeyId ()).isEqualTo (serviceAccountCredentials .getPrivateKeyId ());
92+ assertThat (jwtCreds .getPrivateKey ()).isEqualTo (serviceAccountCredentials .getPrivateKey ());
93+ assertThat (jwtCreds .getUniverseDomain ()).isEqualTo (Credentials .GOOGLE_DEFAULT_UNIVERSE );
94+ }
95+
7496 @ Test
7597 void serviceAccountReplacedWithJwtTokens_customUniverseDomain () throws Exception {
7698 ServiceAccountCredentials serviceAccountCredentials =
You can’t perform that action at this time.
0 commit comments