File tree 3 files changed +35
-0
lines changed
main/java/com/google/api/gax/rpc/internal
test/java/com/google/api/gax/rpc/internal
showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it
3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -89,4 +89,9 @@ public boolean hasRequestMetadataOnly() {
89
89
public void refresh () throws IOException {
90
90
this .wrappedCredentials .refresh ();
91
91
}
92
+
93
+ @ Override
94
+ public String getUniverseDomain () throws IOException {
95
+ return this .wrappedCredentials .getUniverseDomain ();
96
+ }
92
97
}
Original file line number Diff line number Diff line change @@ -101,4 +101,15 @@ void quotaProjectIdHidingCredentials_getAuthenticationType() throws IOException
101
101
102
102
Mockito .verify (credentials , Mockito .atLeastOnce ()).refresh ();
103
103
}
104
+
105
+ @ Test
106
+ void quotaProjectIdHidingCredentials_getUniverseDomain () throws IOException {
107
+ Credentials credentials = Mockito .mock (GoogleCredentials .class );
108
+ Mockito .when (credentials .getUniverseDomain ()).thenReturn ("example.com" );
109
+
110
+ QuotaProjectIdHidingCredentials quotaProjectIdHidingCredentials =
111
+ new QuotaProjectIdHidingCredentials (credentials );
112
+
113
+ assertEquals (quotaProjectIdHidingCredentials .getUniverseDomain (), "example.com" );
114
+ }
104
115
}
Original file line number Diff line number Diff line change @@ -444,4 +444,23 @@ void endpointResolution_builderBuilderBackToBuilder() throws IOException {
444
444
echoStubSettingsBuilder = echoStubSettings .toBuilder ();
445
445
Truth .assertThat (echoStubSettingsBuilder .getEndpoint ()).isEqualTo (customEndpoint );
446
446
}
447
+
448
+ @ Test
449
+ void universeDomainValidation_quotaProjectId_credentialsNonGDUMatchesUserConfiguration ()
450
+ throws IOException {
451
+ String universeDomain = "random.com" ;
452
+ EchoSettings echoSettings =
453
+ ExtendedEchoSettings .newBuilder ()
454
+ .setQuotaProjectId ("exampleProject" )
455
+ .setCredentialsProvider (UniverseDomainCredentialsProvider .create (universeDomain ))
456
+ .setEndpoint (TestClientInitializer .DEFAULT_GRPC_ENDPOINT )
457
+ .setUniverseDomain (universeDomain )
458
+ .setTransportChannelProvider (
459
+ EchoSettings .defaultGrpcTransportProviderBuilder ()
460
+ .setChannelConfigurator (ManagedChannelBuilder ::usePlaintext )
461
+ .build ())
462
+ .build ();
463
+ echoClient = EchoClient .create (echoSettings );
464
+ Truth .assertThat (echoClient .echo (DEFAULT_REQUEST ).getContent ()).isEqualTo ("echo" );
465
+ }
447
466
}
You can’t perform that action at this time.
0 commit comments