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

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


   */
  public void testRemoveService() throws com.google.api.adwords.v200909.cm.ApiException,
      RemoteException {
    long oldUnitCount = serviceAccountantManager.getTotalUnitCount();
    serviceAccountantManager.setAutoCreateAccountant(true);
    campaignV200909Service.get(new CampaignSelector(null, null, null, new Paging(0, 100)));
    assertTrue("Service was incorrectly accounted.",
        oldUnitCount < serviceAccountantManager.getTotalUnitCount());

    serviceAccountantManager.removeService(campaignV200909Service);
    assertNull(serviceAccountantManager.getServiceAccountant(campaignV200909Service));

    oldUnitCount = serviceAccountantManager.getTotalUnitCount();
    serviceAccountantManager.setAutoCreateAccountant(false);
    campaignV200909Service.get(new CampaignSelector(null, null, null, new Paging(0, 100)));
    assertEquals("Service was incorrectly accounted.",
        oldUnitCount, serviceAccountantManager.getTotalUnitCount());
  }
View Full Code Here


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

      NegativeCampaignCriterion negativeCampaignCriterion = new NegativeCampaignCriterion();
      negativeCampaignCriterion.setCampaignId(campaign.getId());
      negativeCampaignCriterion.setCriterion(new Placement(null, null, "http://example.com/"));

      CampaignCriterionOperation operation = new CampaignCriterionOperation();
      operation.setOperator(Operator.ADD);
      operation.setOperand(negativeCampaignCriterion);
View Full Code Here

          adGroup = adGroupReturnValue.getValue()[0];
        }

        int numAds = generator.nextInt(10) + 1;
        for (int k = 0; k < numAds; k++) {
          TextAd ad = new TextAd();
          ad.setDescription1("This is the description");
          ad.setDescription2("Second line of the description");
          ad.setHeadline("This is the headline " + generator.nextInt(5000));
          ad.setDisplayUrl("http://google.com/");
          ad.setUrl("http://example.com");

          AdGroupAd adGroupAd = new AdGroupAd();
          adGroupAd.setAd(ad);
          adGroupAd.setAdGroupId(adGroup.getId());

          adGroupAdService.mutate(new AdGroupAdOperation[] {new AdGroupAdOperation(Operator.ADD,
              "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

    geoTargetList.setCampaignId(campaignId);
    geoTargetList.setTargets(new GeoTarget[] {new CountryTarget(null, false, "US"),
        new CountryTarget(null, false, "JP")});

    // Create network targets.
    NetworkTargetList networkTargetList = new NetworkTargetList();
    networkTargetList.setCampaignId(campaignId);
    networkTargetList.setTargets(new NetworkTarget[] {
        // Specifying GOOGLE_SEARCH is necessary if you want to target
        // SEARCH_NETWORK.
        new NetworkTarget(null, NetworkCoverageType.GOOGLE_SEARCH),
        new NetworkTarget(null, NetworkCoverageType.SEARCH_NETWORK)});

    CampaignTargetOperation languageTargetOperation = new CampaignTargetOperation();
    languageTargetOperation.setOperand(languageTargetList);
    languageTargetOperation.setOperator(Operator.SET);

    CampaignTargetOperation geoTargetOperation = new CampaignTargetOperation();
    geoTargetOperation.setOperand(geoTargetList);
    geoTargetOperation.setOperator(Operator.SET);

    CampaignTargetOperation networkTargetOperation = new CampaignTargetOperation();
    networkTargetOperation.setOperand(networkTargetList);
    networkTargetOperation.setOperator(Operator.SET);

    CampaignTargetOperation[] operations = new CampaignTargetOperation[] {languageTargetOperation,
        geoTargetOperation, networkTargetOperation};

    // Set campaign targets.
    CampaignTargetReturnValue result = service.mutate(operations);

    // Exclude generated fields and test objects.
    if (result != null && result.getValue() != null) {
      for (TargetList testList : result.getValue()) {

        if (testList.getTargetListType().equals("LanguageTargetList")) {
          languageTargetList.setTargetListType(testList.getTargetListType());
          for (LanguageTarget languageTarget : languageTargetList.getTargets()) {
            languageTarget.setTargetType(((LanguageTarget) ((LanguageTargetList) testList)
                .getTargets()[0]).getTargetType());
          }
          TestUtils.assertDeepReflectionEquals(languageTargetList, testList);

        } else if (testList.getTargetListType().equals("GeoTargetList")) {
          geoTargetList.setTargetListType(testList.getTargetListType());
          for (GeoTarget geoTarget : geoTargetList.getTargets()){
            geoTarget.setTargetType(((GeoTarget)((GeoTargetList) testList)
                .getTargets()[0]).getTargetType());
          }
          TestUtils.assertDeepReflectionEquals(geoTargetList, testList);

        } else if (testList.getTargetListType().equals("NetworkTargetList")) {
          networkTargetList.setTargetListType(testList.getTargetListType());
          for (NetworkTarget networkTarget : networkTargetList.getTargets()){
            networkTarget.setTargetType(((NetworkTarget)((NetworkTargetList) testList)
                .getTargets()[0]).getTargetType());
          }
          TestUtils.assertDeepReflectionEquals(networkTargetList, testList);
        }
View Full Code Here

TOP

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

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.