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

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


    // Get the GeoLocationService.
    GeoLocationServiceInterface geoLocationService =
        user.getService(AdWordsService.V201008.GEO_LOCATION_SERVICE);

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

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

TOP

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

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.