Read from bloom filter for premium pricing checks

This also cleans up the PremiumList API so that it only has one
method for checking premium prices, which is by TLD, rather than two.

I will be refactoring a lot of the static methods currently residing in
the PremiumList class into a separate utils class, but I don't want to
include too many changes in this one CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=148475345
This commit is contained in:
mcilwain 2017-02-24 10:32:23 -08:00 committed by Ben McIlwain
parent 3ac74fa449
commit 3ca9bb6aeb
18 changed files with 328 additions and 282 deletions

View file

@ -75,11 +75,8 @@ abstract class CreateOrUpdatePremiumListCommand extends ConfirmingCommand
protected void init() throws Exception {
name = isNullOrEmpty(name) ? convertFilePathToName(inputFile) : name;
List<String> lines = Files.readAllLines(inputFile, UTF_8);
// Try constructing the premium list locally to check up front for validation errors.
new PremiumList.Builder()
.setName(name)
.setPremiumListMapFromLines(lines)
.build();
// Try constructing and parsing the premium list locally to check up front for validation errors
new PremiumList.Builder().setName(name).build().parse(lines);
inputLineCount = lines.size();
}
@ -108,7 +105,7 @@ abstract class CreateOrUpdatePremiumListCommand extends ConfirmingCommand
getCommandPath(),
params.build(),
MediaType.FORM_DATA,
requestBody.getBytes());
requestBody.getBytes(UTF_8));
return extractServerResponse(response);
}