Examples of RawReportDownloadResponse


Examples of com.google.api.ads.adwords.lib.utils.RawReportDownloadResponse

  }

  @Test
  public void testSuccess() throws Exception {
    ByteArrayInputStream stream = new ByteArrayInputStream("Report data".getBytes());
    RawReportDownloadResponse rawResponse = new RawReportDownloadResponse(200, stream);
    ReportDownloadResponse response =
        new ReportDownloader(adWordsSession).handleResponse(rawResponse);
    assertEquals(200, response.getHttpStatus());
    assertEquals(stream, response.getInputStream());
    assertEquals("SUCCESS", response.getHttpResponseMessage());
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.RawReportDownloadResponse

  @Test
  public void testFailure_cannotReadStream() throws Exception {
    InputStream stream = Mockito.mock(InputStream.class);
    when(stream.read(isA(byte[].class))).thenThrow(new IOException());
    RawReportDownloadResponse rawResponse = new RawReportDownloadResponse(400, stream);
    try {
      new ReportDownloader(adWordsSession).handleResponse(rawResponse);
      fail("Should have thrown an exception");
    } catch (ReportDownloadResponseException e) {
      assertEquals(400, e.getHttpStatus());
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.RawReportDownloadResponse

  }

  @Test
  public void testFailure_validXmlResponse() throws Exception {
    InputStream stream = new ByteArrayInputStream(GOLDEN_ERROR_XML.getBytes());
    RawReportDownloadResponse rawResponse = new RawReportDownloadResponse(400, stream);
    try {
      new ReportDownloader(adWordsSession).handleResponse(rawResponse);
      fail("Should have thrown an exception");
    } catch (DetailedReportDownloadResponseException e) {
      assertEquals(400, e.getHttpStatus());
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.RawReportDownloadResponse

  }

  @Test
  public void testFailure_mostlyValidXmlResponse() throws Exception {
    InputStream stream = new ByteArrayInputStream(ERROR_XML.getBytes());
    RawReportDownloadResponse rawResponse = new RawReportDownloadResponse(400, stream);
    try {
      new ReportDownloader(adWordsSession).handleResponse(rawResponse);
      fail("Should have thrown an exception");
    } catch (DetailedReportDownloadResponseException e) {
      assertEquals(400, e.getHttpStatus());
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.RawReportDownloadResponse

  }

  @Test
  public void testFailure_invalidXmlResponse() throws Exception {
    InputStream stream = new ByteArrayInputStream(ERROR_TEXT.getBytes());
    RawReportDownloadResponse rawResponse = new RawReportDownloadResponse(400, stream);
    try {
      new ReportDownloader(adWordsSession).handleResponse(rawResponse);
      fail("Should have thrown an exception");
    } catch (DetailedReportDownloadResponseException e) {
      assertEquals(400, e.getHttpStatus());
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.RawReportDownloadResponse

  }

  @Test
  public void testSuccess() throws Exception {
    ByteArrayInputStream stream = new ByteArrayInputStream("Report data".getBytes());
    RawReportDownloadResponse rawResponse = new RawReportDownloadResponse(200, stream);
    ReportDownloadResponse response =
        new ReportDownloader(adWordsSession).handleResponse(rawResponse);
    assertEquals(200, response.getHttpStatus());
    assertEquals(stream, response.getInputStream());
    assertEquals("SUCCESS", response.getHttpResponseMessage());
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.RawReportDownloadResponse

  @Test
  public void testFailure_cannotReadStream() throws Exception {
    InputStream stream = Mockito.mock(InputStream.class);
    when(stream.read(isA(byte[].class))).thenThrow(new IOException());
    RawReportDownloadResponse rawResponse = new RawReportDownloadResponse(400, stream);
    try {
      new ReportDownloader(adWordsSession).handleResponse(rawResponse);
      fail("Should have thrown an exception");
    } catch (ReportDownloadResponseException e) {
      assertEquals(400, e.getHttpStatus());
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.RawReportDownloadResponse

  }

  @Test
  public void testFailure_validXmlResponse() throws Exception {
    InputStream stream = new ByteArrayInputStream(GOLDEN_ERROR_XML.getBytes());
    RawReportDownloadResponse rawResponse = new RawReportDownloadResponse(400, stream);
    try {
      new ReportDownloader(adWordsSession).handleResponse(rawResponse);
      fail("Should have thrown an exception");
    } catch (DetailedReportDownloadResponseException e) {
      assertEquals(400, e.getHttpStatus());
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.RawReportDownloadResponse

  }

  @Test
  public void testFailure_mostlyValidXmlResponse() throws Exception {
    InputStream stream = new ByteArrayInputStream(ERROR_XML.getBytes());
    RawReportDownloadResponse rawResponse = new RawReportDownloadResponse(400, stream);
    try {
      new ReportDownloader(adWordsSession).handleResponse(rawResponse);
      fail("Should have thrown an exception");
    } catch (DetailedReportDownloadResponseException e) {
      assertEquals(400, e.getHttpStatus());
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.RawReportDownloadResponse

  }

  @Test
  public void testFailure_invalidXmlResponse() throws Exception {
    InputStream stream = new ByteArrayInputStream(ERROR_TEXT.getBytes());
    RawReportDownloadResponse rawResponse = new RawReportDownloadResponse(400, stream);
    try {
      new ReportDownloader(adWordsSession).handleResponse(rawResponse);
      fail("Should have thrown an exception");
    } catch (DetailedReportDownloadResponseException e) {
      assertEquals(400, e.getHttpStatus());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.