FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: address incorrect universe domain validation when quota project id is set by mpeddada1 · Pull Request #3257 · googleapis/sdk-platform-java · GitHub

This repository was archived by the owner on May 14, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,9 @@ public boolean hasRequestMetadataOnly() {
public void refresh() throws IOException {
this.wrappedCredentials.refresh();
}

@Override
public String getUniverseDomain() throws IOException {
return this.wrappedCredentials.getUniverseDomain();
}
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,15 @@ void quotaProjectIdHidingCredentials_getAuthenticationType() throws IOException

Mockito.verify(credentials, Mockito.atLeastOnce()).refresh();
}

@Test
void quotaProjectIdHidingCredentials_getUniverseDomain() throws IOException {
Credentials credentials = Mockito.mock(GoogleCredentials.class);
Mockito.when(credentials.getUniverseDomain()).thenReturn("example.com");

QuotaProjectIdHidingCredentials quotaProjectIdHidingCredentials =
new QuotaProjectIdHidingCredentials(credentials);

assertEquals(quotaProjectIdHidingCredentials.getUniverseDomain(), "example.com");
}
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -444,4 +444,23 @@ void endpointResolution_builderBuilderBackToBuilder() throws IOException {
echoStubSettingsBuilder = echoStubSettings.toBuilder();
Truth.assertThat(echoStubSettingsBuilder.getEndpoint()).isEqualTo(customEndpoint);
}

@Test
void universeDomainValidation_quotaProjectId_credentialsNonGDUMatchesUserConfiguration()
throws IOException {
String universeDomain = "random.com";
EchoSettings echoSettings =
ExtendedEchoSettings.newBuilder()
.setQuotaProjectId("exampleProject")
.setCredentialsProvider(UniverseDomainCredentialsProvider.create(universeDomain))
.setEndpoint(TestClientInitializer.DEFAULT_GRPC_ENDPOINT)
.setUniverseDomain(universeDomain)
.setTransportChannelProvider(
EchoSettings.defaultGrpcTransportProviderBuilder()
.setChannelConfigurator(ManagedChannelBuilder::usePlaintext)
.build())
.build();
echoClient = EchoClient.create(echoSettings);
Truth.assertThat(echoClient.echo(DEFAULT_REQUEST).getContent()).isEqualTo("echo");
}
}

Back | FazBrowse Home | New Git URL