Package com.google.api.ads.adwords.lib.utils.v201406

Examples of com.google.api.ads.adwords.lib.utils.v201406.DetailedReportDownloadResponseException


      ValidationException,
      ReportException,
      ReportDownloadResponseException,
      IOException {

    DetailedReportDownloadResponseException ex = new DetailedReportDownloadResponseException(
        404, "Testing");
    ex.setType("DetailedReportDownloadResponseException");
    ex.setTrigger("UnitTest non-Retryable Server Error");
    doThrow(ex).when(mockedRunnableDownloader).downloadFileToFileSystem();

    mockedRunnableDownloader.run();
    verify(mockedRunnableDownloader, times(1)).downloadFileToFileSystem();
    verify(mockedRunnableDownloader, times(1)).run();
View Full Code Here


        } catch (ReportException e) {
          System.out.println("\n(Error: " + e.getMessage() + " " + e.getCause() + " Retry# " + i
              + "/" + retriesCount + ")");
        } catch (ReportDownloadResponseException e) {
          if (e instanceof DetailedReportDownloadResponseException) {
            DetailedReportDownloadResponseException detailedException =
                (DetailedReportDownloadResponseException) e;
            System.out.println("\n(Error: " + detailedException.getType() + " Trigger:"
                + detailedException.getTrigger() + ")");
            // Not retrying DetailedReportDownloadResponseException errors.
            break;
          } else {
            System.out.println("\n(Error: " + e.getMessage() + " " + e.getCause() + " Retry# " + i
                + "/" + retriesCount + ")");
View Full Code Here

    // Enable to allow rows with zero impressions to show.
    reportDefinition.setIncludeZeroImpressions(true);
    reportDefinition.setSelector(reportSelector);

    ReportDownloadResponse response =
        new ReportDownloader(session).downloadReport(reportDefinition);
    if (response.getHttpStatus() == HttpURLConnection.HTTP_OK) {
      FileOutputStream fos = new FileOutputStream(new File(reportFile));
      Streams.copy(response.getInputStream(), fos);
      fos.close();
      System.out.println("Report successfully downloaded: " + reportFile);
View Full Code Here

    try {
      // Set the property api.adwords.reportDownloadTimeout or call
      // ReportDownloader.setReportDownloadTimeout to set a timeout (in milliseconds)
      // for CONNECT and READ in report downloads.
      ReportDownloadResponse response =
          new ReportDownloader(session).downloadReport(query, DownloadFormat.CSV);
      FileOutputStream fos = new FileOutputStream(new File(reportFile));
      Streams.copy(response.getInputStream(), fos);
      fos.close();
      System.out.println("Report successfully downloaded: " + reportFile);
    } catch (ReportDownloadResponseException e) {
View Full Code Here

    try
    {
      // Set the property api.adwords.reportDownloadTimeout or call
      // ReportDownloader.setReportDownloadTimeout to set a timeout (in milliseconds)
      // for CONNECT and READ in report downloads.
      ReportDownloadResponse response = new ReportDownloader(session).downloadReport(reportDefinition);
      // FileOutputStream fos = new FileOutputStream(new File(reportFile));
      // Streams.copy(response.getInputStream(), fos);
      // fos.close();
      // System.out.println("Report successfully downloaded: " + reportFile);
      output = getStringFromInputStream (response.getInputStream());
View Full Code Here

    try {
      // Set the property api.adwords.reportDownloadTimeout or call
      // ReportDownloader.setReportDownloadTimeout to set a timeout (in milliseconds)
      // for CONNECT and READ in report downloads.
      ReportDownloadResponse response =
          new ReportDownloader(session).downloadReport(reportDefinition);
      FileOutputStream fos = new FileOutputStream(new File(reportFile));
      Streams.copy(response.getInputStream(), fos);
      fos.close();
      System.out.println("Report successfully downloaded: " + reportFile);
    } catch (ReportDownloadResponseException e) {
View Full Code Here

  protected InputStream getReportInputStream()
      throws ValidationException, ReportException, ReportDownloadResponseException {

    InputStream inputStream = null;

    ReportDownloader reportDownloader = new ReportDownloader(adWordsSession);
    ReportDownloadResponse reportDownloadResponse =
        reportDownloader.downloadReport(this.reportDefinition);

    if (reportDownloadResponse.getHttpStatus() == HttpURLConnection.HTTP_OK) {
      inputStream = reportDownloadResponse.getInputStream();

    } else {
View Full Code Here

      IOException,
      FileNotFoundException {

    File reportFile = null;

    ReportDownloader reportDownloader = new ReportDownloader(adWordsSession);
    ReportDownloadResponse reportDownloadResponse =
        reportDownloader.downloadReport(this.reportDefinition);

    if (reportDownloadResponse.getHttpStatus() == HttpURLConnection.HTTP_OK) {
      File tempFile = this.createTempFile(this.cid, this.reportDefinition.getReportType().value());
      BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(tempFile));
      copy(reportDownloadResponse.getInputStream(), output);
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.lib.utils.v201406.DetailedReportDownloadResponseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.