@Test public void testDownloadReportWithValidAwqlRequest() throws Exception { when(reportRequest.getRequestType()).thenReturn(RequestType.AWQL); String awqlString = "SELECT CampaignId, CampaignName, Impressions " + "FROM CAMPAIGN_PERFORMANCE_REPORT DURING THIS_MONTH"; when(reportRequest.getReportRequestString()).thenReturn(awqlString); testHttpServer.setMockResponseBody("test"); if (isTestRawDownload) { RawReportDownloadResponse response = helper.downloadReport(reportRequest); assertNotNull("Null response", response); assertEquals("Response status code not success", 200, response.getHttpStatus()); assertEquals( "Response charset incorrect", REPORT_CHARSET, response.getCharset()); assertEquals( "Response contents incorrect", "test", Streams.readAll(response.getInputStream(), response.getCharset())); } else { ReportDownloadResponse response = helper.downloadReport(reportRequest, exceptionBuilder); assertNotNull("Null response", response); assertEquals("Response status code not success", 200, response.getHttpStatus()); assertEquals( "Response contents incorrect", "test", Streams.readAll(response.getInputStream(), REPORT_CHARSET)); } String lastRequestBody = testHttpServer.getLastRequestBody(); assertThat( "awql parameter value incorrect", lastRequestBody, containsString("__rdquery=" + UrlEscapers.urlFormParameterEscaper().escape(awqlString))); assertThat("format parameter incorrect", lastRequestBody, containsString("__fmt=CSV")); }
@Override public ReportDownloadResponse downloadReport( ReportRequest reportRequest, Builder exceptionBuilder) throws ReportException, ReportDownloadResponseException { return impl.downloadReport(reportRequest, exceptionBuilder); }
AdHocReportDownloadHelper implements AdHocReportDownloadHelperInterface { @Override public ReportDownloadResponse downloadReport( ReportRequest reportRequest, Builder exceptionBuilder) throws ReportException, ReportDownloadResponseException { return impl.downloadReport(reportRequest, exceptionBuilder); } }
AdHocReportDownloadHelper implements AdHocReportDownloadHelperInterface { @Override public ReportDownloadResponse downloadReport( ReportRequest reportRequest, Builder exceptionBuilder) throws ReportException, ReportDownloadResponseException { return impl.downloadReport(reportRequest, exceptionBuilder); } @Inject  AdHocReportDownloadHelper(
      AdHocReportDownloadHelperImpl helperImpl, AdsUtilityRegistry adsUtilityRegistry); }
AdHocReportDownloadHelper implements AdHocReportDownloadHelperInterface { @Override public ReportDownloadResponse downloadReport( ReportRequest reportRequest, Builder exceptionBuilder) throws ReportException, ReportDownloadResponseException { return impl.downloadReport(reportRequest, exceptionBuilder); } @Inject  AdHocReportDownloadHelper(
      AdHocReportDownloadHelperImpl helperImpl, AdsUtilityRegistry adsUtilityRegistry); @Override ReportDownloadResponse downloadReport(
      ReportRequest reportRequest, Builder exceptionBuilder); @Override RawReportDownloadResponse downloadReport(ReportRequest reportRequest); @Override ReportDownloadResponse handleResponse(
      RawReportDownloadResponse rawResponse, Builder exceptionBuilder); @Override int getReportDownloadTimeout(); @Override void setReportDownloadTimeout(int reportDownloadTimeout); }
AdHocReportDownloadHelper implements AdHocReportDownloadHelperInterface { @Override public ReportDownloadResponse downloadReport( ReportRequest reportRequest, Builder exceptionBuilder) throws ReportException, ReportDownloadResponseException { return impl.downloadReport(reportRequest, exceptionBuilder); } @Inject  AdHocReportDownloadHelper(
      AdHocReportDownloadHelperImpl helperImpl, AdsUtilityRegistry adsUtilityRegistry); @Override ReportDownloadResponse downloadReport(
      ReportRequest reportRequest, Builder exceptionBuilder); @Override RawReportDownloadResponse downloadReport(ReportRequest reportRequest); @Override ReportDownloadResponse handleResponse(
      RawReportDownloadResponse rawResponse, Builder exceptionBuilder); @Override int getReportDownloadTimeout(); @Override void setReportDownloadTimeout(int reportDownloadTimeout);  }