Package com.google.api.ads.adwords.awreporting.model.entities

Examples of com.google.api.ads.adwords.awreporting.model.entities.ReportBase


  /**
   * Tests the persistence and retrieval of Report Entities.
   */
  @Test
  public void testTokenPersistence() {
    ReportBase report = new ReportAccount(123L, 456L);
    report.setAccountDescriptiveName("testAccount");
    report.setId();
    List<Report> reportList = Lists.newArrayList();
    reportList.add(report);
    reportEntitiesPersister.persistReportEntities(reportList);

    List<ReportAccount> reportAccountList =
        reportEntitiesPersister.listReports(ReportAccount.class);
    Assert.assertNotNull(reportAccountList);
    Assert.assertTrue(reportAccountList.size() == 1);
    Assert.assertTrue(reportAccountList.get(0).getTopAccountId().equals(123L));
    Assert.assertTrue(reportAccountList.get(0).getAccountId().equals(456L));
    Assert.assertTrue(reportAccountList.get(0).getAccountDescriptiveName().equals("testAccount"));

    report = new ReportAccount(789L, 456L);
    report.setAccountDescriptiveName("updatedTestAccount");
    reportList = Lists.newArrayList();
    reportList.add(report);
    reportEntitiesPersister.persistReportEntities(reportList);

    reportAccountList = reportEntitiesPersister.listReports(ReportAccount.class);
View Full Code Here


   * Tests the gets methods.
   */
  @Test
  public void testGet() {

    ReportBase report1 = new ReportAccount(123L, 456L);
    report1.setAccountDescriptiveName("testAccount1");
    report1.setAdNetwork("test2");
    report1.setId();
    ReportBase report2 = new ReportAccount(124L, 4567L);
    report2.setAccountDescriptiveName("testAccount2");
    report2.setAdNetwork("test2");
    report2.setId();
    List<Report> reportList = Lists.newArrayList();
    reportList.add(report1);
    reportList.add(report2);
    reportEntitiesPersister.persistReportEntities(reportList);

View Full Code Here

   * Tests the gets methods with values for properties.
   */
  @Test
  public void testGetWithValue() {

    ReportBase report1 = new ReportAccount(123L, 456L);
    report1.setAccountDescriptiveName("testAccount1");
    report1.setAdNetwork("test2");
    report1.setId();
    ReportBase report2 = new ReportAccount(124L, 4567L);
    report2.setAccountDescriptiveName("testAccount2");
    report2.setAdNetwork("test2");
    report2.setId();
    List<Report> reportList = Lists.newArrayList();
    reportList.add(report1);
    reportList.add(report2);
    reportEntitiesPersister.persistReportEntities(reportList);

View Full Code Here

  public void testGetWithDate() {

    DateTime start = new DateTime(2013, 3, 9, 10, 10);
    DateTime end = new DateTime(2013, 3, 14, 10, 10);

    ReportBase report1 = new ReportAccount(123L, 456L);
    report1.setAccountDescriptiveName("testAccount1");
    report1.setAdNetwork("test2");
    report1.setDay(new DateTime(2013, 3, 10, 10, 10));
    report1.setId();
    ReportBase report2 = new ReportAccount(124L, 4567L);
    report2.setAccountDescriptiveName("testAccount2");
    report2.setAdNetwork("test2");
    report2.setDay(new DateTime(2013, 3, 13, 10, 10));
    report2.setId();
    List<Report> reportList = Lists.newArrayList();
    reportList.add(report1);
    reportList.add(report2);
    reportEntitiesPersister.persistReportEntities(reportList);
View Full Code Here

   * Tests the gets methods with a map of values for properties.
   */
  @Test
  public void testGetWithValueMap() {

    ReportBase report1 = new ReportAccount(123L, 456L);
    report1.setAccountDescriptiveName("testAccount1");
    report1.setAdNetwork("test2");
    report1.setId();
    ReportBase report2 = new ReportAccount(124L, 4567L);
    report2.setAccountDescriptiveName("testAccount2");
    report2.setAdNetwork("test2");
    report2.setId();
    List<Report> reportList = Lists.newArrayList();
    reportList.add(report1);
    reportList.add(report2);
    reportEntitiesPersister.persistReportEntities(reportList);

View Full Code Here

  public void testListMonthReports() {

    DateTime start = new DateTime(2013, 5, 4, 0, 0, 0, 0);
    DateTime end = new DateTime(2013, 7, 4, 0, 0, 0, 0);

    ReportBase report1 = new ReportAccount(123L, 456L);
    report1.setAccountDescriptiveName("testAccount1");
    report1.setAdNetwork("test1");
    report1.setMonth(start);
    report1.setDateStart(DateUtil.formatYearMonthDay(start));
    report1.setDateEnd(DateUtil.formatYearMonthDay(start));
    report1.setId();

    ReportBase report2 = new ReportAccount(124L, 456L);
    report2.setAccountDescriptiveName("testAccount2");
    report2.setAdNetwork("test2");
    report2.setMonth(start.plusMonths(1));
    report2.setDateStart(DateUtil.formatYearMonthDay(start.plusMonths(1)));
    report2.setDateEnd(DateUtil.formatYearMonthDay(start.plusMonths(1)));
    report2.setId();

    ReportBase report3 = new ReportAccount(125L, 456L);
    report3.setAccountDescriptiveName("testAccount3");
    report3.setAdNetwork("test3");
    report3.setMonth(start.plusMonths(10));
    report3.setDateStart(DateUtil.formatYearMonthDay(start.plusMonths(10)));
    report3.setDateEnd(DateUtil.formatYearMonthDay(start.plusMonths(10)));
    report3.setId();

    List<Report> reportList = Lists.newArrayList();
    reportList.add(report1);
    reportList.add(report2);
    reportList.add(report3);
View Full Code Here

    @Override
    public int compare(Report report1, Report report2) {

      if (report1 instanceof ReportBase && report2 instanceof ReportBase) {

        ReportBase report1base = ReportBase.class.cast(report1);
        ReportBase report2base = ReportBase.class.cast(report2);

        if (report1base.getDay() == null && report2base.getDay() == null) {
          return 0;
        }
        if (report1base.getDay() == null && report2base.getDay() != null) {
          return -1;
        }
        if (report1base.getDay() != null && report2base.getDay() == null) {
          return 1;
        }
        return report1base.getDay().compareTo(report2base.getDay());

      } else {

        if (report1.getDateStart() == null || report2.getDateStart() == null
            || report1.getDateEnd() == null || report2.getDateEnd() == null) {
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.awreporting.model.entities.ReportBase

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.