@Test public void testCreateCriterionForSetBid_bidNull() { childNode.setBid(null); testCommonAttributes( childNode, ProductPartitionNodeAdapter.createCriterionForSetBiddableUnit( childNode, adGroupId, biddingConfig), false); parentNode.setBid(null); testCommonAttributes( parentNode, ProductPartitionNodeAdapter.createCriterionForSetBiddableUnit( parentNode, adGroupId, biddingConfig), false); }
static AdGroupCriterion createCriterionForSetBiddableUnit( ProductPartitionNode node, long adGroupId, BiddingStrategyConfiguration biddingConfig) { Preconditions.checkNotNull(node, "Null node"); Preconditions.checkNotNull(biddingConfig, "Null bidding configuration"); Preconditions.checkArgument(node.isBiddableUnit(), "Node is not a biddable unit"); BiddableAdGroupCriterion biddableCriterion = new BiddableAdGroupCriterion(); biddableCriterion.setAdGroupId(adGroupId); ProductPartition partition = new ProductPartition(); partition.setId(node.getProductPartitionId()); if (node.getParent() != null) { partition.setParentCriterionId(node.getParent().getProductPartitionId()); } partition.setCaseValue(node.getDimension()); partition.setPartitionType(ProductPartitionType.UNIT); biddableCriterion.setCriterion(partition); if (node.getBid() != null) { Money bidMoney = new Money(); bidMoney.setMicroAmount(node.getBid()); CpcBid cpcBid = new CpcBid(); cpcBid.setBid(bidMoney); biddingConfig.setBids(new Bids[] {cpcBid}); } else { biddingConfig.setBids(new Bids[0]); } biddableCriterion.setBiddingStrategyConfiguration(biddingConfig); if (node.getTrackingUrlTemplate() != null) { biddableCriterion.setTrackingUrlTemplate( node.getTrackingUrlTemplate()); } biddableCriterion.setUrlCustomParameters(createCustomParameters(node)); return biddableCriterion; }
ProductPartitionNodeAdapter { static AdGroupCriterion createCriterionForSetBiddableUnit( ProductPartitionNode node, long adGroupId, BiddingStrategyConfiguration biddingConfig) { Preconditions.checkNotNull(node, "Null node"); Preconditions.checkNotNull(biddingConfig, "Null bidding configuration"); Preconditions.checkArgument(node.isBiddableUnit(), "Node is not a biddable unit"); BiddableAdGroupCriterion biddableCriterion = new BiddableAdGroupCriterion(); biddableCriterion.setAdGroupId(adGroupId); ProductPartition partition = new ProductPartition(); partition.setId(node.getProductPartitionId()); if (node.getParent() != null) { partition.setParentCriterionId(node.getParent().getProductPartitionId()); } partition.setCaseValue(node.getDimension()); partition.setPartitionType(ProductPartitionType.UNIT); biddableCriterion.setCriterion(partition); if (node.getBid() != null) { Money bidMoney = new Money(); bidMoney.setMicroAmount(node.getBid()); CpcBid cpcBid = new CpcBid(); cpcBid.setBid(bidMoney); biddingConfig.setBids(new Bids[] {cpcBid}); } else { biddingConfig.setBids(new Bids[0]); } biddableCriterion.setBiddingStrategyConfiguration(biddingConfig); if (node.getTrackingUrlTemplate() != null) { biddableCriterion.setTrackingUrlTemplate( node.getTrackingUrlTemplate()); } biddableCriterion.setUrlCustomParameters(createCustomParameters(node)); return biddableCriterion; } }
ProductPartitionNodeAdapter { static AdGroupCriterion createCriterionForSetBiddableUnit( ProductPartitionNode node, long adGroupId, BiddingStrategyConfiguration biddingConfig) { Preconditions.checkNotNull(node, "Null node"); Preconditions.checkNotNull(biddingConfig, "Null bidding configuration"); Preconditions.checkArgument(node.isBiddableUnit(), "Node is not a biddable unit"); BiddableAdGroupCriterion biddableCriterion = new BiddableAdGroupCriterion(); biddableCriterion.setAdGroupId(adGroupId); ProductPartition partition = new ProductPartition(); partition.setId(node.getProductPartitionId()); if (node.getParent() != null) { partition.setParentCriterionId(node.getParent().getProductPartitionId()); } partition.setCaseValue(node.getDimension()); partition.setPartitionType(ProductPartitionType.UNIT); biddableCriterion.setCriterion(partition); if (node.getBid() != null) { Money bidMoney = new Money(); bidMoney.setMicroAmount(node.getBid()); CpcBid cpcBid = new CpcBid(); cpcBid.setBid(bidMoney); biddingConfig.setBids(new Bids[] {cpcBid}); } else { biddingConfig.setBids(new Bids[0]); } biddableCriterion.setBiddingStrategyConfiguration(biddingConfig); if (node.getTrackingUrlTemplate() != null) { biddableCriterion.setTrackingUrlTemplate( node.getTrackingUrlTemplate()); } biddableCriterion.setUrlCustomParameters(createCustomParameters(node)); return biddableCriterion; } private  ProductPartitionNodeAdapter(); }
ProductPartitionNodeAdapter { static AdGroupCriterion createCriterionForSetBiddableUnit( ProductPartitionNode node, long adGroupId, BiddingStrategyConfiguration biddingConfig) { Preconditions.checkNotNull(node, "Null node"); Preconditions.checkNotNull(biddingConfig, "Null bidding configuration"); Preconditions.checkArgument(node.isBiddableUnit(), "Node is not a biddable unit"); BiddableAdGroupCriterion biddableCriterion = new BiddableAdGroupCriterion(); biddableCriterion.setAdGroupId(adGroupId); ProductPartition partition = new ProductPartition(); partition.setId(node.getProductPartitionId()); if (node.getParent() != null) { partition.setParentCriterionId(node.getParent().getProductPartitionId()); } partition.setCaseValue(node.getDimension()); partition.setPartitionType(ProductPartitionType.UNIT); biddableCriterion.setCriterion(partition); if (node.getBid() != null) { Money bidMoney = new Money(); bidMoney.setMicroAmount(node.getBid()); CpcBid cpcBid = new CpcBid(); cpcBid.setBid(bidMoney); biddingConfig.setBids(new Bids[] {cpcBid}); } else { biddingConfig.setBids(new Bids[0]); } biddableCriterion.setBiddingStrategyConfiguration(biddingConfig); if (node.getTrackingUrlTemplate() != null) { biddableCriterion.setTrackingUrlTemplate( node.getTrackingUrlTemplate()); } biddableCriterion.setUrlCustomParameters(createCustomParameters(node)); return biddableCriterion; } private  ProductPartitionNodeAdapter();  }
ProductPartitionNodeAdapter { static AdGroupCriterion createCriterionForSetBiddableUnit( ProductPartitionNode node, long adGroupId, BiddingStrategyConfiguration biddingConfig) { Preconditions.checkNotNull(node, "Null node"); Preconditions.checkNotNull(biddingConfig, "Null bidding configuration"); Preconditions.checkArgument(node.isBiddableUnit(), "Node is not a biddable unit"); BiddableAdGroupCriterion biddableCriterion = new BiddableAdGroupCriterion(); biddableCriterion.setAdGroupId(adGroupId); ProductPartition partition = new ProductPartition(); partition.setId(node.getProductPartitionId()); if (node.getParent() != null) { partition.setParentCriterionId(node.getParent().getProductPartitionId()); } partition.setCaseValue(node.getDimension()); partition.setPartitionType(ProductPartitionType.UNIT); biddableCriterion.setCriterion(partition); if (node.getBid() != null) { Money bidMoney = new Money(); bidMoney.setMicroAmount(node.getBid()); CpcBid cpcBid = new CpcBid(); cpcBid.setBid(bidMoney); biddingConfig.setBids(new Bids[] {cpcBid}); } else { biddingConfig.setBids(new Bids[0]); } biddableCriterion.setBiddingStrategyConfiguration(biddingConfig); if (node.getTrackingUrlTemplate() != null) { biddableCriterion.setTrackingUrlTemplate( node.getTrackingUrlTemplate()); } biddableCriterion.setUrlCustomParameters(createCustomParameters(node)); return biddableCriterion; } private  ProductPartitionNodeAdapter();   }