Search in sources :

Example 6 with BidLandscapeLandscapePoint

use of com.google.api.ads.adwords.axis.v201809.cm.BidLandscapeLandscapePoint in project googleads-java-lib by googleads.

the class ServiceQueryTest method testNextPageWithSpecifiedCriterionBidLandscapePage.

/**
 * Tests using {@link ServiceQuery#nextPage(CriterionBidLandscapePage)} ] to get a next page of
 * the result by specifying the previous criterion bid landscape page.
 */
@Test
public void testNextPageWithSpecifiedCriterionBidLandscapePage() {
    // Make criterion bid landscape page contain 400 bid landscape points (200 per criterion bid
    // landscape point).
    int numBidLandscapePoints = 200;
    BidLandscapeLandscapePoint bidLandscapeLandscapePoint = new BidLandscapeLandscapePoint();
    List<BidLandscapeLandscapePoint> bidLandscapeLandscapePoints = new ArrayList<>();
    bidLandscapeLandscapePoints.addAll(Collections.nCopies(numBidLandscapePoints, bidLandscapeLandscapePoint));
    CriterionBidLandscape bidLandscape = mock(CriterionBidLandscape.class);
    when(bidLandscape.getLandscapePoints()).thenReturn(bidLandscapeLandscapePoints.toArray(new BidLandscapeLandscapePoint[0]));
    CriterionBidLandscapePage page = mock(CriterionBidLandscapePage.class);
    when(page.getEntries()).thenReturn(new CriterionBidLandscape[] { bidLandscape, bidLandscape });
    expectedAwql = "SELECT Id, Name WHERE Status = \"ENABLED\" ORDER BY Name DESC LIMIT 400,100";
    serviceQuery.nextPage(page);
    assertEquals(expectedAwql, serviceQuery.toString());
}
Also used : CriterionBidLandscapePage(com.google.api.ads.adwords.axis.v201809.cm.CriterionBidLandscapePage) ArrayList(java.util.ArrayList) CriterionBidLandscape(com.google.api.ads.adwords.axis.v201809.cm.CriterionBidLandscape) BidLandscapeLandscapePoint(com.google.api.ads.adwords.axis.v201809.cm.BidLandscapeLandscapePoint) BidLandscapeLandscapePoint(com.google.api.ads.adwords.axis.v201809.cm.BidLandscapeLandscapePoint) Test(org.junit.Test)

Example 7 with BidLandscapeLandscapePoint

use of com.google.api.ads.adwords.axis.v201809.cm.BidLandscapeLandscapePoint in project googleads-java-lib by googleads.

the class ServiceQueryTest method testHasNextWithSpecifiedCriterionBidLandscapePage.

/**
 * Tests using {@link ServiceQuery#hasNext(CriterionBidLandscapePage)} to check if there is still
 * a next page.
 */
@Test
public void testHasNextWithSpecifiedCriterionBidLandscapePage() {
    // First iteration. There are no previous pages.
    CriterionBidLandscapePage page = null;
    assertTrue(serviceQuery.hasNext(page));
    // Make criterion bid landscape page contain 400 bid landscape points (200 per criterion bid
    // landscape point).
    int numBidLandscapePoints = 200;
    BidLandscapeLandscapePoint bidLandscapeLandscapePoint = new BidLandscapeLandscapePoint();
    List<BidLandscapeLandscapePoint> bidLandscapeLandscapePoints = new ArrayList<>();
    bidLandscapeLandscapePoints.addAll(Collections.nCopies(numBidLandscapePoints, bidLandscapeLandscapePoint));
    CriterionBidLandscape bidLandscape = mock(CriterionBidLandscape.class);
    when(bidLandscape.getLandscapePoints()).thenReturn(bidLandscapeLandscapePoints.toArray(new BidLandscapeLandscapePoint[0]));
    page = mock(CriterionBidLandscapePage.class);
    when(page.getEntries()).thenReturn(new CriterionBidLandscape[] { bidLandscape, bidLandscape });
    serviceQuery = new ServiceQuery.Builder().fields("Id", "Name").limit(0, 100).build();
    // 2 * 200 landscape points are greater than the page size that is 100.
    assertTrue(serviceQuery.hasNext(page));
    serviceQuery = new ServiceQuery.Builder().fields("Id", "Name").limit(0, 500).build();
    // 2 * 200 landscape points are less than the page size that is 500.
    assertFalse(serviceQuery.hasNext(page));
}
Also used : CriterionBidLandscapePage(com.google.api.ads.adwords.axis.v201809.cm.CriterionBidLandscapePage) ArrayList(java.util.ArrayList) CriterionBidLandscape(com.google.api.ads.adwords.axis.v201809.cm.CriterionBidLandscape) BidLandscapeLandscapePoint(com.google.api.ads.adwords.axis.v201809.cm.BidLandscapeLandscapePoint) BidLandscapeLandscapePoint(com.google.api.ads.adwords.axis.v201809.cm.BidLandscapeLandscapePoint) Test(org.junit.Test)

Example 8 with BidLandscapeLandscapePoint

use of com.google.api.ads.adwords.axis.v201809.cm.BidLandscapeLandscapePoint in project googleads-java-lib by googleads.

the class ServiceQueryTest method testHasNextWithSpecifiedAdGroupBidLandscapePage.

/**
 * Tests using {@link ServiceQuery#hasNext(AdGroupBidLandscapePage)} to check if there is still a
 * next page.
 */
@Test
public void testHasNextWithSpecifiedAdGroupBidLandscapePage() {
    // First iteration. There are no previous pages.
    AdGroupBidLandscapePage page = null;
    assertTrue(serviceQuery.hasNext(page));
    // Make ad group bid landscape page contain 400 bid landscape points (200 per ad group bid
    // landscape point).
    int numBidLandscapePoints = 200;
    BidLandscapeLandscapePoint bidLandscapeLandscapePoint = new BidLandscapeLandscapePoint();
    List<BidLandscapeLandscapePoint> bidLandscapeLandscapePoints = new ArrayList<>();
    bidLandscapeLandscapePoints.addAll(Collections.nCopies(numBidLandscapePoints, bidLandscapeLandscapePoint));
    AdGroupBidLandscape bidLandscape = mock(AdGroupBidLandscape.class);
    when(bidLandscape.getLandscapePoints()).thenReturn(bidLandscapeLandscapePoints);
    page = mock(AdGroupBidLandscapePage.class);
    when(page.getEntries()).thenReturn(ImmutableList.of(bidLandscape, bidLandscape));
    serviceQuery = new ServiceQuery.Builder().fields("Id", "Name").limit(0, 100).build();
    // 2 * 200 landscape points are greater than the page size that is 100.
    assertTrue(serviceQuery.hasNext(page));
    serviceQuery = new ServiceQuery.Builder().fields("Id", "Name").limit(0, 500).build();
    // 2 * 200 landscape points are less than the page size that is 500.
    assertFalse(serviceQuery.hasNext(page));
}
Also used : AdGroupBidLandscapePage(com.google.api.ads.adwords.jaxws.v201809.cm.AdGroupBidLandscapePage) ArrayList(java.util.ArrayList) BidLandscapeLandscapePoint(com.google.api.ads.adwords.jaxws.v201809.cm.BidLandscapeLandscapePoint) BidLandscapeLandscapePoint(com.google.api.ads.adwords.jaxws.v201809.cm.BidLandscapeLandscapePoint) AdGroupBidLandscape(com.google.api.ads.adwords.jaxws.v201809.cm.AdGroupBidLandscape) Test(org.junit.Test)

Example 9 with BidLandscapeLandscapePoint

use of com.google.api.ads.adwords.axis.v201809.cm.BidLandscapeLandscapePoint in project googleads-java-lib by googleads.

the class ServiceQueryTest method testNextPageWithSpecifiedAdGroupBidLandscapePage.

/**
 * Tests using {@link ServiceQuery#nextPage(AdGroupBidLandscapePage)} ] to get a next page of the
 * result by specifying the previous ad group bid landscape page.
 */
@Test
public void testNextPageWithSpecifiedAdGroupBidLandscapePage() {
    // Make ad group bid landscape page contain 400 bid landscape points (200 per ad group bid
    // landscape point).
    int numBidLandscapePoints = 200;
    BidLandscapeLandscapePoint bidLandscapeLandscapePoint = new BidLandscapeLandscapePoint();
    List<BidLandscapeLandscapePoint> bidLandscapeLandscapePoints = new ArrayList<>();
    bidLandscapeLandscapePoints.addAll(Collections.nCopies(numBidLandscapePoints, bidLandscapeLandscapePoint));
    AdGroupBidLandscape bidLandscape = mock(AdGroupBidLandscape.class);
    when(bidLandscape.getLandscapePoints()).thenReturn(bidLandscapeLandscapePoints);
    AdGroupBidLandscapePage page = mock(AdGroupBidLandscapePage.class);
    when(page.getEntries()).thenReturn(ImmutableList.of(bidLandscape, bidLandscape));
    expectedAwql = "SELECT Id, Name WHERE Status = \"ENABLED\" ORDER BY Name DESC LIMIT 400,100";
    serviceQuery.nextPage(page);
    assertEquals(expectedAwql, serviceQuery.toString());
}
Also used : AdGroupBidLandscapePage(com.google.api.ads.adwords.jaxws.v201809.cm.AdGroupBidLandscapePage) ArrayList(java.util.ArrayList) BidLandscapeLandscapePoint(com.google.api.ads.adwords.jaxws.v201809.cm.BidLandscapeLandscapePoint) BidLandscapeLandscapePoint(com.google.api.ads.adwords.jaxws.v201809.cm.BidLandscapeLandscapePoint) AdGroupBidLandscape(com.google.api.ads.adwords.jaxws.v201809.cm.AdGroupBidLandscape) Test(org.junit.Test)

Example 10 with BidLandscapeLandscapePoint

use of com.google.api.ads.adwords.axis.v201809.cm.BidLandscapeLandscapePoint in project googleads-java-lib by googleads.

the class ServiceQueryTest method testHasNextWithSpecifiedCriterionBidLandscapePage.

/**
 * Tests using {@link ServiceQuery#hasNext(CriterionBidLandscapePage)} to check if there is still
 * a next page.
 */
@Test
public void testHasNextWithSpecifiedCriterionBidLandscapePage() {
    // First iteration. There are no previous pages.
    CriterionBidLandscapePage page = null;
    assertTrue(serviceQuery.hasNext(page));
    // Make criterion bid landscape page contain 400 bid landscape points (200 per criterion bid
    // landscape point).
    int numBidLandscapePoints = 200;
    BidLandscapeLandscapePoint bidLandscapeLandscapePoint = new BidLandscapeLandscapePoint();
    List<BidLandscapeLandscapePoint> bidLandscapeLandscapePoints = new ArrayList<>();
    bidLandscapeLandscapePoints.addAll(Collections.nCopies(numBidLandscapePoints, bidLandscapeLandscapePoint));
    CriterionBidLandscape bidLandscape = mock(CriterionBidLandscape.class);
    when(bidLandscape.getLandscapePoints()).thenReturn(bidLandscapeLandscapePoints);
    page = mock(CriterionBidLandscapePage.class);
    when(page.getEntries()).thenReturn(ImmutableList.of(bidLandscape, bidLandscape));
    serviceQuery = new ServiceQuery.Builder().fields("Id", "Name").limit(0, 100).build();
    // 2 * 200 landscape points are greater than the page size that is 100.
    assertTrue(serviceQuery.hasNext(page));
    serviceQuery = new ServiceQuery.Builder().fields("Id", "Name").limit(0, 500).build();
    // 2 * 200 landscape points are less than the page size that is 500.
    assertFalse(serviceQuery.hasNext(page));
}
Also used : CriterionBidLandscapePage(com.google.api.ads.adwords.jaxws.v201809.cm.CriterionBidLandscapePage) ArrayList(java.util.ArrayList) CriterionBidLandscape(com.google.api.ads.adwords.jaxws.v201809.cm.CriterionBidLandscape) BidLandscapeLandscapePoint(com.google.api.ads.adwords.jaxws.v201809.cm.BidLandscapeLandscapePoint) BidLandscapeLandscapePoint(com.google.api.ads.adwords.jaxws.v201809.cm.BidLandscapeLandscapePoint) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)8 Test (org.junit.Test)8 BidLandscapeLandscapePoint (com.google.api.ads.adwords.axis.v201809.cm.BidLandscapeLandscapePoint)6 CriterionBidLandscape (com.google.api.ads.adwords.axis.v201809.cm.CriterionBidLandscape)4 CriterionBidLandscapePage (com.google.api.ads.adwords.axis.v201809.cm.CriterionBidLandscapePage)4 BidLandscapeLandscapePoint (com.google.api.ads.adwords.jaxws.v201809.cm.BidLandscapeLandscapePoint)4 AdGroupBidLandscape (com.google.api.ads.adwords.axis.v201809.cm.AdGroupBidLandscape)2 AdGroupBidLandscapePage (com.google.api.ads.adwords.axis.v201809.cm.AdGroupBidLandscapePage)2 DataServiceInterface (com.google.api.ads.adwords.axis.v201809.cm.DataServiceInterface)2 AdGroupBidLandscape (com.google.api.ads.adwords.jaxws.v201809.cm.AdGroupBidLandscape)2 AdGroupBidLandscapePage (com.google.api.ads.adwords.jaxws.v201809.cm.AdGroupBidLandscapePage)2 CriterionBidLandscape (com.google.api.ads.adwords.jaxws.v201809.cm.CriterionBidLandscape)2 CriterionBidLandscapePage (com.google.api.ads.adwords.jaxws.v201809.cm.CriterionBidLandscapePage)2 SelectorBuilder (com.google.api.ads.adwords.axis.utils.v201809.SelectorBuilder)1 ServiceQuery (com.google.api.ads.adwords.axis.utils.v201809.ServiceQuery)1 Selector (com.google.api.ads.adwords.axis.v201809.cm.Selector)1