Package com.google.api.ads.adwords.jaxws.v201309.cm

Examples of com.google.api.ads.adwords.jaxws.v201309.cm.Predicate


    Selector selector = builder.build();

    Assert.assertNotNull(selector.getPredicates());
    Assert.assertEquals(1, selector.getPredicates().size());

    Predicate predicate = selector.getPredicates().get(0);
    Assert.assertEquals("Status", predicate.getField());
    Assert.assertEquals(PredicateOperator.IN, predicate.getOperator());
    Assert.assertNotNull(predicate.getValues());
    Assert.assertEquals(2, predicate.getValues().size());
    Assert.assertEquals(CampaignStatus.ACTIVE.toString(), predicate.getValues().get(0));
    Assert.assertEquals(CampaignStatus.DELETED.toString(), predicate.getValues().get(1));

  }
View Full Code Here


  public void testUniqueInternalPredicateState() {
    SelectorBuilder builder = new SelectorBuilder();
    Selector selectorOne = builder.by("Id", "test").build();
    Selector selectorTwo = builder.build();

    Predicate predicateTwo = selectorTwo.getPredicates().get(0);
    predicateTwo.setField("Status");

    Assert.assertEquals("Id", selectorOne.getPredicates().get(0).getField());
    Assert.assertEquals("Status", selectorTwo.getPredicates().get(0).getField());
  }
View Full Code Here

   * to clean the builder, the best way to do it, is by creating a new instance.
   *
   * @return the new Selector containing all the configuration that was set previously.
   */
  public Selector build() {
    Selector selectorCopy = new Selector();

    Set<OrderBy> orderingCopy = this.copyOrderingSet();
    Set<Predicate> predicatesCopy = this.copyPredicatesSet();

    selectorCopy.getFields().addAll(Sets.newLinkedHashSet(this.fields));
    selectorCopy.getOrdering().addAll(orderingCopy);
    selectorCopy.getPredicates().addAll(predicatesCopy);

    if (this.dateRange != null) {
      DateRange newDateRange = new DateRange();
      newDateRange.setMin(this.dateRange.getMin());
      newDateRange.setMax(this.dateRange.getMax());
      selectorCopy.setDateRange(newDateRange);
    }
    if (this.paging != null) {
      Paging newPaging = new Paging();
      newPaging.setStartIndex(this.paging.getStartIndex());
      newPaging.setNumberResults(this.paging.getNumberResults());
      selectorCopy.setPaging(newPaging);
    }

    return selectorCopy;
  }
View Full Code Here

    String formatStart = dateFormat.format(start.toDate());
    String formatEnd = dateFormat.format(end.toDate());

    builder = builder.fields("Id", "Name", "Status").forDateRange(start, end);

    Selector selector = builder.build();

    Assert.assertEquals(selector.getDateRange().getMin(), formatStart);
    Assert.assertEquals(selector.getDateRange().getMax(), formatEnd);

    String formatEndPlusOne = dateFormat.format(end.plusDays(1).toDate());

    DateRange dateRange = new DateRange();
    dateRange.setMin(formatStart);
    dateRange.setMax(formatEndPlusOne);

    selector.setDateRange(dateRange);

    Assert.assertEquals(selector.getDateRange().getMin(), formatStart);
    Assert.assertEquals(selector.getDateRange().getMax(), formatEndPlusOne);

    Selector selectorRebuilt =
        builder.fields("Id", "Name", "Status").forDateRange(start, end).build();

    Assert.assertEquals(selectorRebuilt.getDateRange().getMin(), formatStart);
    Assert.assertEquals(selectorRebuilt.getDateRange().getMax(), formatEnd);

  }
View Full Code Here

    SelectorBuilder builder = new SelectorBuilder();

    builder =
        builder.fields("Id", "Name", "Status", "StartDate", "EndDate", "ServingStatus", "Settings");

    Selector selector = builder.build();

    Assert.assertEquals(7, selector.getFields().size());

    Assert.assertEquals("Id", selector.getFields().get(0));
    Assert.assertEquals("Name", selector.getFields().get(1));
    Assert.assertEquals("Status", selector.getFields().get(2));
    Assert.assertEquals("StartDate", selector.getFields().get(3));
    Assert.assertEquals("EndDate", selector.getFields().get(4));
    Assert.assertEquals("ServingStatus", selector.getFields().get(5));
    Assert.assertEquals("Settings", selector.getFields().get(6));

    selector = builder.fields("Id",
        "Name",
        "Status",
        "StartDate",
        "EndDate",
        "ServingStatus",
        "Settings",
        "Id",
        "AverageCpc").build();

    Assert.assertEquals(8, selector.getFields().size());

    Assert.assertEquals("Id", selector.getFields().get(0));
    Assert.assertEquals("Name", selector.getFields().get(1));
    Assert.assertEquals("Status", selector.getFields().get(2));
    Assert.assertEquals("StartDate", selector.getFields().get(3));
    Assert.assertEquals("EndDate", selector.getFields().get(4));
    Assert.assertEquals("ServingStatus", selector.getFields().get(5));
    Assert.assertEquals("Settings", selector.getFields().get(6));
    Assert.assertEquals("AverageCpc", selector.getFields().get(7));

  }
View Full Code Here

    SelectorBuilder builder = new SelectorBuilder();

    builder =
        builder.fields("Id", "Name", "Status", "StartDate", "EndDate", "ServingStatus", "Settings");

    Selector selector = builder.build();

    Assert.assertEquals(7, selector.getFields().size());

    Assert.assertEquals("Id", selector.getFields().get(0));
    Assert.assertEquals("Name", selector.getFields().get(1));
    Assert.assertEquals("Status", selector.getFields().get(2));
    Assert.assertEquals("StartDate", selector.getFields().get(3));
    Assert.assertEquals("EndDate", selector.getFields().get(4));
    Assert.assertEquals("ServingStatus", selector.getFields().get(5));
    Assert.assertEquals("Settings", selector.getFields().get(6));

  }
View Full Code Here

  @Test
  public void testPredicatesBuild() {
    SelectorBuilder builder = new SelectorBuilder();

    builder = builder.byId(10L);
    Selector selector = builder.build();

    Assert.assertNotNull(selector.getPredicates());
    Assert.assertEquals(1, selector.getPredicates().size());

    Predicate predicate = selector.getPredicates().get(0);
    Assert.assertEquals("Id", predicate.getField());
    Assert.assertEquals(PredicateOperator.EQUALS, predicate.getOperator());
    Assert.assertNotNull(predicate.getValues());
    Assert.assertEquals(1, predicate.getValues().size());
    Assert.assertEquals("10", predicate.getValues().get(0));
View Full Code Here

  public void testPredicatesInBuild() {
    SelectorBuilder builder = new SelectorBuilder();

    builder =
        builder.in("Status", CampaignStatus.ACTIVE.toString(), CampaignStatus.DELETED.toString());
    Selector selector = builder.build();

    Assert.assertNotNull(selector.getPredicates());
    Assert.assertEquals(1, selector.getPredicates().size());

    Predicate predicate = selector.getPredicates().get(0);
    Assert.assertEquals("Status", predicate.getField());
    Assert.assertEquals(PredicateOperator.IN, predicate.getOperator());
    Assert.assertNotNull(predicate.getValues());
    Assert.assertEquals(2, predicate.getValues().size());
    Assert.assertEquals(CampaignStatus.ACTIVE.toString(), predicate.getValues().get(0));
View Full Code Here

  @Test
  public void testOrderByBuild() {
    SelectorBuilder builder = new SelectorBuilder();

    builder = builder.orderAscBy("AverageCpm");
    Selector selector = builder.build();

    Assert.assertNotNull(selector.getOrdering());
    Assert.assertEquals(1, selector.getOrdering().size());

    OrderBy orderBy = selector.getOrdering().get(0);

    Assert.assertEquals("AverageCpm", orderBy.getField());
    Assert.assertEquals(SortOrder.ASCENDING, orderBy.getSortOrder());

    builder.orderDescBy("AverageCpc");
    selector = builder.build();

    Assert.assertNotNull(selector.getOrdering());
    Assert.assertEquals(2, selector.getOrdering().size());

    orderBy = selector.getOrdering().get(0);

    Assert.assertEquals("AverageCpm", orderBy.getField());
    Assert.assertEquals(SortOrder.ASCENDING, orderBy.getSortOrder());

    orderBy = selector.getOrdering().get(1);

    Assert.assertEquals("AverageCpc", orderBy.getField());
    Assert.assertEquals(SortOrder.DESCENDING, orderBy.getSortOrder());

    selector = builder.removeOrderBy("AverageCpm").build();

    Assert.assertNotNull(selector.getOrdering());
    Assert.assertEquals(1, selector.getOrdering().size());

    orderBy = selector.getOrdering().get(0);

    Assert.assertEquals("AverageCpc", orderBy.getField());
    Assert.assertEquals(SortOrder.DESCENDING, orderBy.getSortOrder());

  }
View Full Code Here

    DateTime end = new DateTime(2013, 3, 26, 0, 0, 0, 0);
    String formatStart = dateFormat.format(start.toDate());
    String formatEnd = dateFormat.format(end.toDate());

    builder = builder.forDateRange(start, end);
    Selector selector = builder.build();

    Assert.assertEquals(selector.getDateRange().getMin(), formatStart);
    Assert.assertEquals(selector.getDateRange().getMax(), formatEnd);
  }
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.jaxws.v201309.cm.Predicate

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.