@Test public void testDownloadReportWithValidXmlRequest() throws Exception { when(reportRequest.getRequestType()).thenReturn(RequestType.XML); String xmlString = "<reportDefinition xmlns=\"https: + " <selector> " + " <fields>CampaignId</fields> " + " <fields>CampaignName</fields> " + " <fields>Impressions</fields> " + " <predicates> " + " <field>Status</field> " + " <operator>IN</operator> " + " <values>ENABLED</values> " + " <values>PAUSED</values> " + " </predicates> " + " </selector> " + " <reportName>Custom Adgroup Performance Report</reportName>" + " <reportType>CAMPAIGN_PERFORMANCE_REPORT</reportType>" + " <dateRangeType>LAST_7_DAYS</dateRangeType> " + " <downloadFormat>CSV</downloadFormat> " + "</reportDefinition> "; when(reportRequest.getReportRequestString()).thenReturn(xmlString); 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( "xml parameter value incorrect", lastRequestBody, containsString("__rdxml=" + UrlEscapers.urlFormParameterEscaper().escape(xmlString))); }
@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);  }