Package com.google.api.adwords.v201008.cm

Examples of com.google.api.adwords.v201008.cm.AdExtensionOverrideReturnValue


    AdGroupAdSelector selector = new AdGroupAdSelector();
    selector.setAdIds(new long[] {adId});

    // Create date range.
    DateRange range = new DateRange(TestUtils.firstDayOfMonth(), TestUtils.today());
    selector.setStatsSelector(new AdStatsSelector(range, null));

    // Get ads with the selector created above.
    AdGroupAdPage page = service.get(selector);

    assertNotNull(page);
View Full Code Here


   * Provides ad extensions.
   */
  private AdExtension[] adExtensionProvider() {
    // Create location extension.
    LocationExtension locationExtension = new LocationExtension();
    locationExtension.setAddress(new Address("76 9th Ave", null, "New York", "NY", "NY", "10011",
        "US"));
    locationExtension.setGeoPoint(new GeoPoint(new Integer(40742412), new Integer(-74004378)));
    String encoded = "qrvM3QDB3iJsdO58XYyix7YGjYhU+jHs3GR0J6uqpGp55fMTsorT5ZLH69crnCWnM3"
        + "FVAFDO9Un4HNbc5/ORF0Y8hZL/sPevCyxMrjZ2gmwbQwi2fvDB2J7RhyWSV4uWA3LT"
        + "0sdG2b22nH34uDh88XZyTyZMk0Fgc6wmmIwKSlUdYlyCzJ00Qd2JGboNgcWnVeHC8c"
View Full Code Here

  /**
   * Test getting geocoding an address.
   */
  public void testGet() throws Exception {
    // Create address.
    Address address = new Address();
    address.setStreetAddress("1600 Amphitheatre Parkway");
    address.setCityName("Mountain View");
    address.setProvinceCode("US-CA");
    address.setPostalCode("94043");
    address.setCountryCode("US");

    // Create geo location selector.
    GeoLocationSelector selector = new GeoLocationSelector();
    selector.setAddresses(new Address[] {address});

View Full Code Here

    campaign.setName("Test Campaign " + System.currentTimeMillis());
    campaign.setStatus(CampaignStatus.PAUSED);
    campaign.setBiddingStrategy(new ManualCPC());

    // Create budget.
    Budget budget = new Budget();
    budget.setPeriod(BudgetBudgetPeriod.DAILY);
    budget.setAmount(new Money(null, 50000000L));
    budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);
    campaign.setBudget(budget);

    // Create operations.
    CampaignOperation operation = new CampaignOperation();
    operation.setOperand(campaign);
View Full Code Here

  /**
   * Test whether we can validate a correctly formed create campaign request.
   */
  public void testValidCreateCampaign() throws Exception {
    Campaign campaign = new Campaign();
    campaign.setName("Test Campaign " + System.currentTimeMillis());
    campaign.setStatus(CampaignStatus.PAUSED);
    campaign.setBiddingStrategy(new ManualCPC());

    // Create budget.
    Budget budget = new Budget();
    budget.setPeriod(BudgetBudgetPeriod.DAILY);
    budget.setAmount(new Money(null, 50000000L));
    budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);
    campaign.setBudget(budget);

    // Create operations.
    CampaignOperation operation = new CampaignOperation();
    operation.setOperand(campaign);
    operation.setOperator(Operator.ADD);
View Full Code Here

  /**
   * Test whether we can validate an incorrectly formed create campaign request.
   */
  public void testInvalidCreateCampaign() throws Exception {
    // Create campaign.
    Campaign campaign = new Campaign();

    // Create operations.
    CampaignOperation operation = new CampaignOperation();
    operation.setOperand(campaign);
    operation.setOperator(Operator.ADD);

    CampaignOperation[] operations = new CampaignOperation[] {operation};

    CampaignReturnValue result;
    try {
      result = service.mutate(operations);
      Campaign testCampaign = result.getValue()[0];
    } catch (ApiException e) {
      // Expected API Exception.
    } catch (Exception e) {
      throw e;
    }
View Full Code Here

  /**
   * Test adding an campaign ad extension.
   */
  public void testAdd() throws Exception {
    // Create campaign ad extension.
    CampaignAdExtension extension = new CampaignAdExtension();
    extension.setCampaignId(campaignId);
    extension.setAdExtension(adExtensionProvider()[0]);
    extension.setStatus(CampaignAdExtensionStatus.ACTIVE);

    // Create operations.
    CampaignAdExtensionOperation operation = new CampaignAdExtensionOperation();
    operation.setOperand(extension);
    operation.setOperator(Operator.ADD);

    CampaignAdExtensionOperation[] operations = new CampaignAdExtensionOperation[] {operation};

    // Add campaign ad extension.
    CampaignAdExtensionReturnValue result = service.mutate(operations);
    CampaignAdExtension testExtension = result.getValue()[0];

    // Exclude generated fields.
    extension.getAdExtension().setId(testExtension.getAdExtension().getId());
    extension.getAdExtension().setAdExtensionType(
        testExtension.getAdExtension().getAdExtensionType());
    ((LocationExtension) extension.getAdExtension()).getAddress().setProvinceCode(
        ((LocationExtension) testExtension.getAdExtension()).getAddress().getProvinceCode());
    ((LocationExtension) extension.getAdExtension())
        .setEncodedLocation(((LocationExtension) testExtension.getAdExtension())
            .getEncodedLocation());
    extension.setApprovalStatus(testExtension.getApprovalStatus());

    TestUtils.assertDeepReflectionEquals(extension, testExtension);
  }
View Full Code Here

  /**
   * Test removing a campaign ad extension.
   */
  public void testRemove() throws Exception {
    // Create campaign ad extension
    CampaignAdExtension extension = new CampaignAdExtension();
    extension.setCampaignId(campaignId);
    extension.setAdExtension(new AdExtension(adExtensionId, null));

    // Create operations.
    CampaignAdExtensionOperation operation = new CampaignAdExtensionOperation();
    operation.setOperand(extension);
    operation.setOperator(Operator.REMOVE);

    CampaignAdExtensionOperation[] operations = new CampaignAdExtensionOperation[] {operation};

    // Add campaign ad extension.
    CampaignAdExtensionReturnValue result = service.mutate(operations);
    CampaignAdExtension testExtension = result.getValue()[0];

    assertEquals(CampaignAdExtensionStatus.DELETED, testExtension.getStatus());
  }
View Full Code Here

    extension.setCampaignId(campaignId);
    extension.setAdExtension(adExtensionProvider()[0]);
    extension.setStatus(CampaignAdExtensionStatus.ACTIVE);

    // Create operations.
    CampaignAdExtensionOperation operation = new CampaignAdExtensionOperation();
    operation.setOperand(extension);
    operation.setOperator(Operator.ADD);

    CampaignAdExtensionOperation[] operations = new CampaignAdExtensionOperation[] {operation};

    // Add campaign ad extension.
    CampaignAdExtensionReturnValue result = service.mutate(operations);
View Full Code Here

    CampaignAdExtension extension = new CampaignAdExtension();
    extension.setCampaignId(campaignId);
    extension.setAdExtension(new AdExtension(adExtensionId, null));

    // Create operations.
    CampaignAdExtensionOperation operation = new CampaignAdExtensionOperation();
    operation.setOperand(extension);
    operation.setOperator(Operator.REMOVE);

    CampaignAdExtensionOperation[] operations = new CampaignAdExtensionOperation[] {operation};

    // Add campaign ad extension.
    CampaignAdExtensionReturnValue result = service.mutate(operations);
View Full Code Here

TOP

Related Classes of com.google.api.adwords.v201008.cm.AdExtensionOverrideReturnValue

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.