Package com.google.api.adwords.v200909.cm

Examples of com.google.api.adwords.v200909.cm.AdGroupCriterionServiceInterface


  public void testCreateServiceAccountantRemote() throws Exception {
    ServiceAccountantManager instance = ServiceAccountantManager.getInstance();
    instance.setAutoCreateAccountant(false);

    AdWordsUser testUser = new AdWordsUser("test_data/test.properties");
    CampaignServiceInterface campaignService =
        testUser.getService(AdWordsService.V200909.CAMPAIGN_SERVICE);
    campaignService.get(new CampaignSelector());

    assertNull("No service accountant should be created.", instance
        .getServiceAccountant(campaignService));

    ServiceAccountant serviceAccountant =
        ServiceAccountantManager.createServiceAccountant(campaignService);
    assertTrue("Service accountant should be empty.", serviceAccountant.getTotalUnitCount() == 0);

    campaignService.get(new CampaignSelector());

    long totalUnits = serviceAccountant.getTotalUnitCount();
    assertTrue("Service accountant not used.", totalUnits > 0);

    instance.clear();

    campaignService.get(new CampaignSelector());

    assertEquals("Service accountant still used.", totalUnits, serviceAccountant
        .getTotalUnitCount());
  }
View Full Code Here


  public void testCreateServiceAccountantService() throws Exception {
    ServiceAccountantManager instance = ServiceAccountantManager.getInstance();
    instance.setAutoCreateAccountant(false);

    AdWordsUser testUser = new AdWordsUser("test_data/test.properties");
    CampaignServiceInterface campaignService =
        testUser.getService(AdWordsService.V200909.CAMPAIGN_SERVICE);
    campaignService.get(new CampaignSelector());

    assertNull("No service accountant should be created.", instance
        .getServiceAccountant(campaignService));

    ServiceAccountant serviceAccountant =
        ServiceAccountantManager.createServiceAccountant(((Stub) campaignService)._getService());
    assertTrue("Service accountant should be empty.", serviceAccountant.getTotalUnitCount() == 0);

    campaignService.get(new CampaignSelector());

    long totalUnits = serviceAccountant.getTotalUnitCount();
    assertTrue("Service accountant not used.", totalUnits > 0);

    instance.clear();

    campaignService.get(new CampaignSelector());

    assertEquals("Service accountant still used.", totalUnits, serviceAccountant
        .getTotalUnitCount());
  }
View Full Code Here

        public void run() {
          try {
            AdWordsUser testUser = new AdWordsUser("test_data/test.properties");
            ServiceAccountantManager.getInstance().setAutoCreateAccountant(true);

            CampaignServiceInterface campaignService =
                testUser.getService(AdWordsService.V200909.CAMPAIGN_SERVICE);
            AdGroupServiceInterface adGroupService =
                testUser.getService(AdWordsService.V200909.ADGROUP_SERVICE);

            campaignService.get(new CampaignSelector());
            adGroupService.get(new AdGroupSelector());

            ServiceAccountant campaignServiceAccountant =
                ServiceAccountantManager.getInstance().getServiceAccountant(campaignService);
View Full Code Here

   * Performs some API methods via v200909.
   */
  private void performOperations() throws Exception {
    AdWordsUser testUser = new AdWordsUser("test_data/test.properties");

    CampaignServiceInterface campaignService =
        testUser.getService(AdWordsService.V200909.CAMPAIGN_SERVICE);
    AdGroupServiceInterface adGroupService =
        testUser.getService(AdWordsService.V200909.ADGROUP_SERVICE);

    campaignService.get(new CampaignSelector());
    adGroupService.get(new AdGroupSelector());
  }
View Full Code Here

          campaignService.mutate(new CampaignOperation[] {new CampaignOperation(Operator.ADD, null,
              null, campaign)});
      campaign = crv.getValue()[0];


      campaignTargetService.mutate(new CampaignTargetOperation[] {new CampaignTargetOperation(
          Operator.SET, null, new NetworkTargetList(campaign.getId(), null,
              new NetworkTarget[] {new NetworkTarget(null, NetworkCoverageType.GOOGLE_SEARCH)}))});

      NegativeCampaignCriterion negativeCampaignCriterion = new NegativeCampaignCriterion();
      negativeCampaignCriterion.setCampaignId(campaign.getId());
View Full Code Here

        }

        numAds = generator.nextInt(10) + 1;
        for (int k = 0; k < numAds; k++) {
          ImageAd ad = new ImageAd();
          Image image = new Image();
          image.setData(DataUtils.getTestImage());
          image.setName("name.jpg");
          ad.setImage(image);
          ad.setDisplayUrl("http://google.com/");
          ad.setUrl("http://example.com");
          ad.setName("name.jpg");
View Full Code Here

              "ADD", adGroupAd, null)});
        }

        numAds = generator.nextInt(10) + 1;
        for (int k = 0; k < numAds; k++) {
          ImageAd ad = new ImageAd();
          Image image = new Image();
          image.setData(DataUtils.getTestImage());
          image.setName("name.jpg");
          ad.setImage(image);
          ad.setDisplayUrl("http://google.com/");
          ad.setUrl("http://example.com");
          ad.setName("name.jpg");

          AdGroupAd adGroupAd = new AdGroupAd();
          adGroupAd.setAd(ad);
          adGroupAd.setAdGroupId(adGroup.getId());
View Full Code Here

        ArrayList<AdGroupCriterionOperation> criteriaOps =
            new ArrayList<AdGroupCriterionOperation>();

        int numKeywords = generator.nextInt(10) + 1;
        for (int k = 0; k < numKeywords; k++) {
          Keyword keyword = new Keyword();
          keyword.setText("test" + generator.nextInt(5000));
          keyword.setMatchType(KeywordMatchType.PHRASE);

          BiddableAdGroupCriterion criterion = new BiddableAdGroupCriterion();
          criterion.setAdGroupId(adGroup.getId());
          criterion.setCriterion(keyword);
View Full Code Here

    for (int i = 0; i < numCamp; i++) {
      Campaign campaign = new Campaign();
      campaign.setBudget(new Budget(BudgetBudgetPeriod.DAILY, new Money("USD", 1000000L),
          BudgetBudgetDeliveryMethod.STANDARD));
      campaign.setStatus(CampaignStatus.PAUSED);
      campaign.setBiddingStrategy(new ManualCPC());
      CampaignReturnValue crv =
          campaignService.mutate(new CampaignOperation[] {new CampaignOperation(Operator.ADD, null,
              null, campaign)});
      campaign = crv.getValue()[0];
View Full Code Here

        if (adGroups != null && j < adGroups.length) {
          adGroup = adGroups[j];
        } else {
          adGroup = new AdGroup();
          adGroup.setName("AdGroup " + (j + 1));
          adGroup.setBids(new ManualCPCAdGroupBids(null, new Bid(new Money("USD",
              generator.nextInt(10) * 50000L + 50000L)), null, null));
          adGroup.setCampaignId(campaign.getId());

          AdGroupReturnValue adGroupReturnValue =
              adGroupService.mutate(new AdGroupOperation[] {new AdGroupOperation(Operator.ADD,
View Full Code Here

TOP

Related Classes of com.google.api.adwords.v200909.cm.AdGroupCriterionServiceInterface

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.