Package com.google.api.adwords.v201008

Examples of com.google.api.adwords.v201008.AdGroupAdServiceTest


    operation.setOperator(Operator.REMOVE);

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

    // Add ad extension override.
    AdExtensionOverrideReturnValue result = adExtensionOverrideService.mutate(operations);
  }
View Full Code Here


   * @param adId the id of the ad
   * @param campaignAdExtensionId the id of the ad extension
   */
  public void createAdExtensionOverride(long adId, long campaignAdExtensionId) throws Exception {
    // Get the AdExtensionOverrideService.
    AdExtensionOverrideServiceInterface adExtensionOverrideService =
        user.getService(AdWordsService.V201008.AD_EXTENSION_OVERRIDE_SERVICE);

    // Create ad extension override.
    AdExtensionOverride adExtensionOverride = new AdExtensionOverride();
    adExtensionOverride.setAdId(adId);

    // Create ad extension using existing id.
    AdExtension adExtension = new AdExtension();
    adExtension.setId(campaignAdExtensionId);
    adExtensionOverride.setAdExtension(adExtension);

    // Create operations.
    AdExtensionOverrideOperation operation = new AdExtensionOverrideOperation();
    operation.setOperand(adExtensionOverride);
    operation.setOperator(Operator.ADD);

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

    // Add ad extension override.
    AdExtensionOverrideReturnValue result = adExtensionOverrideService.mutate(operations);
  }
View Full Code Here

   * @param adId the id of the ad
   * @param campaignAdExtensionId the id of the ad extension
   */
  public void removeAdExtensionOverride(long adId, long campaignAdExtensionId) throws Exception {
    // Get the AdExtensionOverrideService.
    AdExtensionOverrideServiceInterface adExtensionOverrideService =
        user.getService(AdWordsService.V201008.AD_EXTENSION_OVERRIDE_SERVICE);

    // Create ad extension override.
    AdExtensionOverride adExtensionOverride = new AdExtensionOverride();
    adExtensionOverride.setAdId(adId);

    // Create ad extension using existing id.
    AdExtension adExtension = new AdExtension();
    adExtension.setId(campaignAdExtensionId);
    adExtensionOverride.setAdExtension(adExtension);

    // Create operations.
    AdExtensionOverrideOperation operation = new AdExtensionOverrideOperation();
    operation.setOperand(adExtensionOverride);
    operation.setOperator(Operator.REMOVE);

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

    // Add ad extension override.
    AdExtensionOverrideReturnValue result = adExtensionOverrideService.mutate(operations);
  }
View Full Code Here

    // Get the AdGroupService.
    AdGroupServiceInterface adGroupService;
    adGroupService = user.getService(AdWordsService.V201008.ADGROUP_SERVICE);

    // Create ad group.
    AdGroup adGroup = new AdGroup();
    adGroup.setName("Earth to Mars Cruises #" + System.currentTimeMillis());
    adGroup.setStatus(AdGroupStatus.ENABLED);
    adGroup.setCampaignId(campaignId);

    // Create ad group bid.
    ManualCPCAdGroupBids adGroupBids = new ManualCPCAdGroupBids();
    adGroupBids.setKeywordMaxCpc(new Bid(new Money(null, 10000000L)));
    adGroup.setBids(adGroupBids);

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

    textAd.setDescription2("Low-gravity fun for everyone!");
    textAd.setDisplayUrl("www.example.com");
    textAd.setUrl("http://www.example.com");

    // Create ad group ad.
    AdGroupAd ad = new AdGroupAd();
    ad.setAdGroupId(adGroupId);
    ad.setAd(textAd);

    // Create operations.
    AdGroupAdOperation textAdGroupAdOperation = new AdGroupAdOperation();
    textAdGroupAdOperation.setOperand(ad);
    textAdGroupAdOperation.setOperator(Operator.ADD);
    AdGroupAdOperation[] operations = new AdGroupAdOperation[] {textAdGroupAdOperation};

    // Add ads.
    AdGroupAdReturnValue result = service.mutate(operations);
    AdGroupAd testAd = result.getValue()[0];

    // Set the generated fields.
    ad.getAd().setApprovalStatus(testAd.getAd().getApprovalStatus());
    ad.getAd().setAdType(testAd.getAd().getAdType());
    ad.getAd().setId(testAd.getAd().getId());
    ad.setStatus(testAd.getStatus());

    TestUtils.assertDeepReflectionEquals(ad, testAd);
  }
View Full Code Here

    // Create ad with updated status.
    Ad ad = new Ad();
    ad.setId(adId);

    // Create ad with updated status
    AdGroupAd adGroupAd = new AdGroupAd();
    adGroupAd.setAdGroupId(adGroupId);
    adGroupAd.setAd(ad);
    adGroupAd.setStatus(AdGroupAdStatus.PAUSED);

    // Create operations.
    AdGroupAdOperation operation = new AdGroupAdOperation();
    operation.setOperand(adGroupAd);
    operation.setOperator(Operator.SET);

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

    // Update ad.
    AdGroupAdReturnValue result = service.mutate(operations);
    AdGroupAd testAdGroupAd = result.getValue()[0];

    assertEquals(adGroupAd.getStatus(), testAdGroupAd.getStatus());
  }
View Full Code Here

    // Create ad with updated status.
    Ad ad = new Ad();
    ad.setId(adId);

    // Create ad with updated status
    AdGroupAd adGroupAd = new AdGroupAd();
    adGroupAd.setAdGroupId(adGroupId);
    adGroupAd.setAd(ad);
    adGroupAd.setStatus(AdGroupAdStatus.PAUSED);

    // Create operations.
    AdGroupAdOperation operation = new AdGroupAdOperation();
    operation.setOperand(adGroupAd);
    operation.setOperator(Operator.REMOVE);

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

    // Remove ad.
    AdGroupAdReturnValue result = service.mutate(operations);
    AdGroupAd testAdGroupAd = result.getValue()[0];

    assertEquals(AdGroupAdStatus.DISABLED, testAdGroupAd.getStatus());
  }
View Full Code Here

    textAd.setDescription2("Low-gravity fun for everyone!");
    textAd.setDisplayUrl("www.example.com");
    textAd.setUrl("http://www.example.com");

    // Create ad group ad.
    AdGroupAd textAdGroupAd = new AdGroupAd();
    textAdGroupAd.setAdGroupId(adGroupId);
    textAdGroupAd.setAd(textAd);

    // Create operations.
    AdGroupAdOperation textAdGroupAdOperation = new AdGroupAdOperation();
    textAdGroupAdOperation.setOperand(textAdGroupAd);
    textAdGroupAdOperation.setOperator(Operator.ADD);
View Full Code Here

    AdGroupAd ad = new AdGroupAd();
    ad.setAdGroupId(adGroupId);
    ad.setAd(textAd);

    // Create operations.
    AdGroupAdOperation textAdGroupAdOperation = new AdGroupAdOperation();
    textAdGroupAdOperation.setOperand(ad);
    textAdGroupAdOperation.setOperator(Operator.ADD);
    AdGroupAdOperation[] operations = new AdGroupAdOperation[] {textAdGroupAdOperation};

    // Add ads.
    AdGroupAdReturnValue result = service.mutate(operations);
    AdGroupAd testAd = result.getValue()[0];
View Full Code Here

    adGroupAd.setAdGroupId(adGroupId);
    adGroupAd.setAd(ad);
    adGroupAd.setStatus(AdGroupAdStatus.PAUSED);

    // Create operations.
    AdGroupAdOperation operation = new AdGroupAdOperation();
    operation.setOperand(adGroupAd);
    operation.setOperator(Operator.SET);

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

    // Update ad.
    AdGroupAdReturnValue result = service.mutate(operations);
View Full Code Here

TOP

Related Classes of com.google.api.adwords.v201008.AdGroupAdServiceTest

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.