/** * Constructor used by Guice. * * @param session Used to pull authentication data. * @param authorizationHeaderProvider Used to population the authentication data into a header. * @param userAgentCombiner Used to populate the User-Agent header. * @param adWordsLibConfiguration Used to obtain configuration options affecting report requests. * @param responseInterceptor Response interceptor to use for requests generated by this factory * helper. */ @Inject ReportRequestFactoryHelper(AdWordsSession session, AuthorizationHeaderProvider authorizationHeaderProvider, UserAgentCombiner userAgentCombiner, HttpTransport httpTransport, AdWordsLibConfiguration adWordsLibConfiguration, ReportResponseInterceptor responseInterceptor) { this.session = session; this.authorizationHeaderProvider = authorizationHeaderProvider; this.userAgentCombiner = userAgentCombiner; this.httpTransport = httpTransport; this.reportDownloadTimeout = (session.getReportingConfiguration() != null && session.getReportingConfiguration().getReportDownloadTimeout() != null) ? session.getReportingConfiguration().getReportDownloadTimeout() : adWordsLibConfiguration.getReportDownloadTimeout(); this.responseInterceptor = responseInterceptor; }
/** * Constructor used by Guice. * * @param session Used to pull authentication data. * @param authorizationHeaderProvider Used to population the authentication data into a header. * @param userAgentCombiner Used to populate the User-Agent header. * @param adWordsLibConfiguration Used to obtain configuration options affecting report requests. * @param responseInterceptor Response interceptor to use for requests generated by this factory * helper. */ @Inject ReportRequestFactoryHelper(AdWordsSession session, AuthorizationHeaderProvider authorizationHeaderProvider, UserAgentCombiner userAgentCombiner, HttpTransport httpTransport, AdWordsLibConfiguration adWordsLibConfiguration, ReportResponseInterceptor responseInterceptor) { this.session = session; this.authorizationHeaderProvider = authorizationHeaderProvider; this.userAgentCombiner = userAgentCombiner; this.httpTransport = httpTransport; this.reportDownloadTimeout = (session.getReportingConfiguration() != null && session.getReportingConfiguration().getReportDownloadTimeout() != null) ? session.getReportingConfiguration().getReportDownloadTimeout() : adWordsLibConfiguration.getReportDownloadTimeout(); this.responseInterceptor = responseInterceptor; }
assertEquals("read timeout is incorrect", timeoutFromLibConfig, request.getReadTimeout()); } else { Integer expectedTimeout = reportingConfiguration.getReportDownloadTimeout(); if (expectedTimeout == null) {
assertNull( "download timeout is not null, but no reporting options in config", reportingConfig.getReportDownloadTimeout());
assertFalse(session.getReportingConfiguration().isUseRawEnumValues()); assertEquals( 9999999, session.getReportingConfiguration().getReportDownloadTimeout().intValue()); assertNull( "includeZeroImpressions is not settable from ads.properties, so should be null",