@Test public void linkedCustomerId_sentIfSpecified() { GoogleAdsClient client = GoogleAdsClient.newBuilder() .setCredentials(fakeCredentials) .setDeveloperToken(DEVELOPER_TOKEN) .setLinkedCustomerId(LINKED_CUSTOMER_ID) .setEnableGeneratedCatalog(enabledGeneratedCatalog) .setTransportChannelProvider(localChannelProvider) .setEndpoint("fake-address") .build(); mockService.addResponse(SearchGoogleAdsResponse.newBuilder().build()); try (GoogleAdsServiceClient googleAdsServiceClient = client.getLatestVersion().createGoogleAdsServiceClient()) { googleAdsServiceClient.search("123", "select blah"); } assertTrue( "linked customer ID not found", localChannelProvider.isHeaderSent( "linked-customer-id", Pattern.compile(String.valueOf(LINKED_CUSTOMER_ID)))); }
public static Builder newBuilder() { AutoValue_GoogleAdsClient.Builder clientBuilder = new AutoValue_GoogleAdsClient.Builder(); clientBuilder.setEnableGeneratedCatalog(true); InstantiatingGrpcChannelProvider transportChannelProvider = InstantiatingGrpcChannelProvider.newBuilder() .setInterceptorProvider( () -> ImmutableList.of( new LoggingInterceptor( new RequestLogger(), clientBuilder.getHeaders(), clientBuilder.getEndpoint()))) .setMaxInboundMetadataSize(16 * 1024 * 1024) .setMaxInboundMessageSize(64 * 1024 * 1024) .build(); clientBuilder .setEndpoint(DEFAULT_ENDPOINT) .setTransportChannelProvider(transportChannelProvider); return clientBuilder; }
GoogleAdsClient extends AbstractGoogleAdsClient { public static Builder newBuilder() { AutoValue_GoogleAdsClient.Builder clientBuilder = new AutoValue_GoogleAdsClient.Builder(); clientBuilder.setEnableGeneratedCatalog(true); InstantiatingGrpcChannelProvider transportChannelProvider = InstantiatingGrpcChannelProvider.newBuilder() .setInterceptorProvider( () -> ImmutableList.of( new LoggingInterceptor( new RequestLogger(), clientBuilder.getHeaders(), clientBuilder.getEndpoint()))) .setMaxInboundMetadataSize(16 * 1024 * 1024) .setMaxInboundMessageSize(64 * 1024 * 1024) .build(); clientBuilder .setEndpoint(DEFAULT_ENDPOINT) .setTransportChannelProvider(transportChannelProvider); return clientBuilder; } }
GoogleAdsClient extends AbstractGoogleAdsClient { public static Builder newBuilder() { AutoValue_GoogleAdsClient.Builder clientBuilder = new AutoValue_GoogleAdsClient.Builder(); clientBuilder.setEnableGeneratedCatalog(true); InstantiatingGrpcChannelProvider transportChannelProvider = InstantiatingGrpcChannelProvider.newBuilder() .setInterceptorProvider( () -> ImmutableList.of( new LoggingInterceptor( new RequestLogger(), clientBuilder.getHeaders(), clientBuilder.getEndpoint()))) .setMaxInboundMetadataSize(16 * 1024 * 1024) .setMaxInboundMessageSize(64 * 1024 * 1024) .build(); clientBuilder .setEndpoint(DEFAULT_ENDPOINT) .setTransportChannelProvider(transportChannelProvider); return clientBuilder; }  }
GoogleAdsClient extends AbstractGoogleAdsClient { public static Builder newBuilder() { AutoValue_GoogleAdsClient.Builder clientBuilder = new AutoValue_GoogleAdsClient.Builder(); clientBuilder.setEnableGeneratedCatalog(true); InstantiatingGrpcChannelProvider transportChannelProvider = InstantiatingGrpcChannelProvider.newBuilder() .setInterceptorProvider( () -> ImmutableList.of( new LoggingInterceptor( new RequestLogger(), clientBuilder.getHeaders(), clientBuilder.getEndpoint()))) .setMaxInboundMetadataSize(16 * 1024 * 1024) .setMaxInboundMessageSize(64 * 1024 * 1024) .build(); clientBuilder .setEndpoint(DEFAULT_ENDPOINT) .setTransportChannelProvider(transportChannelProvider); return clientBuilder; }  static Builder newBuilder(); abstract Credentials getCredentials(); abstract String getDeveloperToken(); abstract String getEndpoint(); @Nullable abstract Long getLoginCustomerId(); @Nullable abstract Long getLinkedCustomerId(); abstract Builder toBuilder(); }
GoogleAdsClient extends AbstractGoogleAdsClient { public static Builder newBuilder() { AutoValue_GoogleAdsClient.Builder clientBuilder = new AutoValue_GoogleAdsClient.Builder(); clientBuilder.setEnableGeneratedCatalog(true); InstantiatingGrpcChannelProvider transportChannelProvider = InstantiatingGrpcChannelProvider.newBuilder() .setInterceptorProvider( () -> ImmutableList.of( new LoggingInterceptor( new RequestLogger(), clientBuilder.getHeaders(), clientBuilder.getEndpoint()))) .setMaxInboundMetadataSize(16 * 1024 * 1024) .setMaxInboundMessageSize(64 * 1024 * 1024) .build(); clientBuilder .setEndpoint(DEFAULT_ENDPOINT) .setTransportChannelProvider(transportChannelProvider); return clientBuilder; }  static Builder newBuilder(); abstract Credentials getCredentials(); abstract String getDeveloperToken(); abstract String getEndpoint(); @Nullable abstract Long getLoginCustomerId(); @Nullable abstract Long getLinkedCustomerId(); abstract Builder toBuilder();  }