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

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


    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

    // Get CampaignService
    CampaignServiceInterface campaignService =
        user.getService(AdWordsService.V201008.CAMPAIGN_SERVICE);

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

    // 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

    CampaignServiceInterface campaignService;

    campaignService = user.getService(AdWordsService.V201008.CAMPAIGN_SERVICE);

    // Create campaign with DELETED status.
    Campaign campaign = new Campaign();
    campaign.setId(campaignId);
    campaign.setStatus(CampaignStatus.DELETED);

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

  /**
   * Test whether we can create a campaign.
   */
  public void testCreateCampaign() throws Exception {
    // Create campaign.
    Campaign campaign = new Campaign();
    campaign.setName("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);

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

    // Add campaign.
    CampaignReturnValue result = campaignService.mutate(operations);
    Campaign testCampaign = result.getValue()[0];

    // Set the generated fields.
    campaign.setId(testCampaign.getId());
    campaign.getBudget().getAmount()
        .setComparableValueType(testCampaign.getBudget().getAmount().getComparableValueType());
    campaign.getBiddingStrategy().setBiddingStrategyType(
        testCampaign.getBiddingStrategy().getBiddingStrategyType());
    campaign.setStartDate(testCampaign.getStartDate());
    campaign.setEndDate(testCampaign.getEndDate());
    campaign.setFrequencyCap(testCampaign.getFrequencyCap());
    campaign.setConversionOptimizerEligibility(testCampaign.getConversionOptimizerEligibility());
    campaign.setServingStatus(testCampaign.getServingStatus());
    campaign.setAdServingOptimizationStatus(testCampaign.getAdServingOptimizationStatus());
    ((ManualCPC) campaign.getBiddingStrategy()).setPositionPreference(((ManualCPC) testCampaign
        .getBiddingStrategy()).getPositionPreference());
    ((ManualCPC) campaign.getBiddingStrategy()).setEnhancedCpcEnabled(((ManualCPC) testCampaign
        .getBiddingStrategy()).getEnhancedCpcEnabled());

    TestUtils.assertDeepReflectionEquals(campaign, testCampaign);
    this.campaign1 = campaign;
  }
View Full Code Here

   * Test whether we can create a campaign.
   */
  public void testCreateCampaigns() throws Exception {

    // Create campaign.
    Campaign campaign1 = new Campaign();
    campaign1.setName("Campaign #" + System.currentTimeMillis());
    campaign1.setStatus(CampaignStatus.PAUSED);
    campaign1.setBiddingStrategy(new ManualCPC());

    // Create campaign.
    Campaign campaign2 = new Campaign();
    campaign2.setName("Campaign #" + (System.currentTimeMillis() + 1L));
    campaign2.setStatus(CampaignStatus.PAUSED);
    campaign2.setBiddingStrategy(new ManualCPC());

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

    // Create operations.
    CampaignOperation operation1 = new CampaignOperation();
    operation1.setOperand(campaign1);
    operation1.setOperator(Operator.ADD);
    CampaignOperation operation2 = new CampaignOperation();
    operation2.setOperand(campaign2);
    operation2.setOperator(Operator.ADD);

    CampaignOperation[] operations = new CampaignOperation[] {operation1, operation2};

    // Add campaigns.
    CampaignReturnValue result = campaignService.mutate(operations);
    Campaign testCampaign1 = result.getValue()[0];
    Campaign testCampaign2 = result.getValue()[1];

    // Set the generated fields.
    campaign1.setId(testCampaign1.getId());
    campaign1.getBudget().getAmount()
        .setComparableValueType(testCampaign1.getBudget().getAmount().getComparableValueType());
    campaign1.getBiddingStrategy().setBiddingStrategyType(
        testCampaign1.getBiddingStrategy().getBiddingStrategyType());
    campaign1.setStartDate(testCampaign1.getStartDate());
    campaign1.setEndDate(testCampaign1.getEndDate());
    campaign1.setFrequencyCap(testCampaign1.getFrequencyCap());
    campaign1.setConversionOptimizerEligibility(testCampaign1.getConversionOptimizerEligibility());
    campaign1.setServingStatus(testCampaign1.getServingStatus());
    campaign1.setAdServingOptimizationStatus(testCampaign1.getAdServingOptimizationStatus());
    ((ManualCPC) campaign1.getBiddingStrategy()).setPositionPreference(((ManualCPC) testCampaign1
        .getBiddingStrategy()).getPositionPreference());
    ((ManualCPC) campaign1.getBiddingStrategy()).setEnhancedCpcEnabled(((ManualCPC) testCampaign1
        .getBiddingStrategy()).getEnhancedCpcEnabled());

    campaign2.setId(testCampaign2.getId());
    campaign2.getBudget().getAmount()
        .setComparableValueType(testCampaign2.getBudget().getAmount().getComparableValueType());
    campaign2.getBiddingStrategy().setBiddingStrategyType(
        testCampaign2.getBiddingStrategy().getBiddingStrategyType());
    campaign2.setStartDate(testCampaign2.getStartDate());
    campaign2.setEndDate(testCampaign2.getEndDate());
    campaign2.setFrequencyCap(testCampaign2.getFrequencyCap());
    campaign2.setConversionOptimizerEligibility(testCampaign2.getConversionOptimizerEligibility());
    campaign2.setServingStatus(testCampaign2.getServingStatus());
    campaign2.setAdServingOptimizationStatus(testCampaign2.getAdServingOptimizationStatus());
    ((ManualCPC) campaign2.getBiddingStrategy()).setPositionPreference(((ManualCPC) testCampaign2
        .getBiddingStrategy()).getPositionPreference());
    ((ManualCPC) campaign2.getBiddingStrategy()).setEnhancedCpcEnabled(((ManualCPC) testCampaign2
        .getBiddingStrategy()).getEnhancedCpcEnabled());

    TestUtils.assertDeepReflectionEquals(campaign1, testCampaign1);
    TestUtils.assertDeepReflectionEquals(campaign2, testCampaign2);

View Full Code Here

TOP

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

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.