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

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


    selector.setIds(ids);
    selector.setStatsSelector(new StatsSelector(new DateRange("20090101", "20090131"), null));

    // Get all campaigns.
    CampaignPage page = campaignService.get(selector);
    Campaign testCampaign = page.getEntries()[0];

    // Set the generated fields.
    campaign1.setCampaignStats(testCampaign.getCampaignStats());
    campaign1.setAdServingOptimizationStatus(testCampaign.getAdServingOptimizationStatus());
    campaign1.setConversionOptimizerEligibility(testCampaign.getConversionOptimizerEligibility());

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


  public void testUpdateCampaign() throws Exception {
    if (this.campaign1 == null) {
      testCreateCampaign();
    }

    Campaign campaign = new Campaign();
    campaign.setId(campaign1.getId());
    campaign.setStatus(CampaignStatus.ACTIVE);

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

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

    CampaignOperation[] operations = new CampaignOperation[] {operation};
    CampaignReturnValue result = campaignService.mutate(operations);
    Campaign testCampaign = result.getValue()[0];

    // Set the updated fields.
    campaign1.setStatus(CampaignStatus.ACTIVE);
    budget.getAmount().setComparableValueType(
        testCampaign.getBudget().getAmount().getComparableValueType());
    campaign1.setBudget(budget);

    // Set the generated fields.
    campaign1.setCampaignStats(testCampaign.getCampaignStats());
    campaign1.setAdServingOptimizationStatus(testCampaign.getAdServingOptimizationStatus());
    campaign1.setServingStatus(testCampaign.getServingStatus());
    campaign1.setConversionOptimizerEligibility(testCampaign.getConversionOptimizerEligibility());

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

    if (campaign1 == null || campaign2 == null) {
      this.testCreateCampaigns();
    }

    // Create campaign.
    Campaign campaign1 = new Campaign();
    campaign1.setId(this.campaign1.getId());
    campaign1.setStatus(CampaignStatus.DELETED);

    Campaign campaign2 = new Campaign();
    campaign2.setId(this.campaign2.getId());
    campaign2.setStatus(CampaignStatus.DELETED);

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

    // Create operations.
    CampaignOperation operation1 = new CampaignOperation();
    operation1.setOperand(campaign1);
    operation1.setOperator(Operator.SET);

    CampaignOperation operation2 = new CampaignOperation();
    operation2.setOperand(campaign2);
    operation2.setOperator(Operator.SET);

    CampaignOperation[] operations = new CampaignOperation[] {operation1, operation2};
    CampaignReturnValue result = campaignService.mutate(operations);
    Campaign testCampaign1 = result.getValue()[0];
    Campaign testCampaign2 = result.getValue()[1];

    // Set the updated fields.
    this.campaign1.setStatus(CampaignStatus.DELETED);
    budget.getAmount().setComparableValueType(
        testCampaign1.getBudget().getAmount().getComparableValueType());
    this.campaign1.setBudget(budget);

    this.campaign2.setStatus(CampaignStatus.DELETED);
    budget.getAmount().setComparableValueType(
        testCampaign2.getBudget().getAmount().getComparableValueType());
    this.campaign2.setBudget(budget);

    // Set the generated fields.
    this.campaign1.setCampaignStats(testCampaign1.getCampaignStats());
    this.campaign1.setAdServingOptimizationStatus(testCampaign1.getAdServingOptimizationStatus());
    this.campaign1.setServingStatus(testCampaign1.getServingStatus());
    this.campaign1.setConversionOptimizerEligibility(testCampaign1
        .getConversionOptimizerEligibility());

    this.campaign2.setCampaignStats(testCampaign2.getCampaignStats());
    this.campaign2.setAdServingOptimizationStatus(testCampaign2.getAdServingOptimizationStatus());
    this.campaign2.setServingStatus(testCampaign2.getServingStatus());
    this.campaign2.setConversionOptimizerEligibility(testCampaign2
        .getConversionOptimizerEligibility());

    TestUtils.assertDeepReflectionEquals(this.campaign1, testCampaign1);
    TestUtils.assertDeepReflectionEquals(this.campaign2, testCampaign2);
  }
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

    selector.setStatsSelector(new CampaignAdExtensionStatsSelector(range, null));
    selector.setCampaignIds(new long[] {campaignId});
    selector.setStatuses(new CampaignAdExtensionStatus[] {CampaignAdExtensionStatus.ACTIVE,
        CampaignAdExtensionStatus.DELETED});

    CampaignAdExtensionPage page = service.get(selector);

    assertNotNull(page);
    assertNotNull(page.getEntries());
    assertTrue("Expected at least 1 entry", page.getTotalNumEntries() >= 1);
  }
View Full Code Here

  public void testGetAllForAdExtension() throws Exception {
    // Create selector.
    CampaignAdExtensionSelector selector = new CampaignAdExtensionSelector();
    selector.setAdExtensionIds(new long[] {adExtensionId});

    CampaignAdExtensionPage page = service.get(selector);

    assertNotNull(page);
    assertNotNull(page.getEntries());
    assertTrue("Expected at least 1 entry", page.getTotalNumEntries() >= 1);
  }
View Full Code Here

   */
  public void testGetAll() throws Exception {
    // Create selector.
    CampaignAdExtensionSelector selector = new CampaignAdExtensionSelector();

    CampaignAdExtensionPage page = service.get(selector);

    assertNotNull(page);
    assertNotNull(page.getEntries());
    assertTrue("Expected at least 1 entry", page.getTotalNumEntries() >= 1);
  }
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.