3939import com .google .ads .googleads .v10 .services .SearchGoogleAdsStreamResponse ;
4040import com .google .api .gax .grpc .GaxGrpcProperties ;
4141import com .google .api .gax .grpc .GrpcStatusCode ;
42+ import com .google .api .gax .grpc .InstantiatingGrpcChannelProvider ;
4243import com .google .api .gax .grpc .testing .LocalChannelProvider ;
4344import com .google .api .gax .grpc .testing .MockServiceHelper ;
4445import com .google .api .gax .rpc .ApiClientHeaderProvider ;
@@ -190,10 +191,7 @@ public void testBuildFromPropertiesFile_withoutLoginCustomerId() throws IOExcept
190191
191192 // Build a new client from the file.
192193 GoogleAdsClient client =
193- GoogleAdsClient .newBuilder ()
194- .fromPropertiesFile (propertiesFile )
195- .setTransportChannelProvider (localChannelProvider )
196- .build ();
194+ GoogleAdsClient .newBuilder ().fromPropertiesFile (propertiesFile ).build ();
197195 assertGoogleAdsClient (client , null , true );
198196 }
199197
@@ -253,7 +251,7 @@ public void setLoginCustomerId_canClearOnceSet() {
253251
254252 /** Tests building a client without the use of a properties file. */
255253 @ Test
256- public void buildWithoutPropertiesFile_supportsAllFields () throws IOException {
254+ public void buildWithoutPropertiesFile_supportsAllFields () {
257255 Credentials credentials =
258256 UserCredentials .newBuilder ()
259257 .setClientId (CLIENT_ID )
@@ -265,7 +263,6 @@ public void buildWithoutPropertiesFile_supportsAllFields() throws IOException {
265263 .setCredentials (credentials )
266264 .setDeveloperToken (DEVELOPER_TOKEN )
267265 .setLoginCustomerId (LOGIN_CUSTOMER_ID )
268- .setTransportChannelProvider (localChannelProvider )
269266 .build ();
270267 assertGoogleAdsClient (client , true );
271268 }
@@ -888,6 +885,20 @@ private void assertGoogleAdsClient(
888885 serviceAccountCredentials .getScopes ());
889886 }
890887
888+ if (client .getTransportChannelProvider () == client .getDefaultTransportChannelProvider ()) {
889+ InstantiatingGrpcChannelProvider channelProvider =
890+ (InstantiatingGrpcChannelProvider ) client .getTransportChannelProvider ();
891+ assertEquals (
892+ "Max inbound metadata size" ,
893+ GoogleAdsClient .DEFAULT_MAX_INBOUND_METADATA_SIZE ,
894+ channelProvider .getMaxInboundMetadataSize ());
895+ assertEquals (
896+ "Max inbound message size" ,
897+ GoogleAdsClient .DEFAULT_MAX_INBOUND_MESSAGE_SIZE ,
898+ // For some reason, this setting is only available on the builder.
899+ channelProvider .toBuilder ().getMaxInboundMessageSize ());
900+ }
901+
891902 assertEquals ("Developer token" , DEVELOPER_TOKEN , client .getDeveloperToken ());
892903 assertEquals ("Login customer id" , loginCustomerId , client .getLoginCustomerId ());
893904 }
0 commit comments