Repository navigation
Conversation
|
I figured this approach was better than trying to make the shell scripts have to parse the text output of the create command determine if they needed to call the update command. |
Add --upsert (-u) flag to UpdatePremiumListCommand and UpdateReservedListCommand so that missing premium and reserved lists are created automatically when --upsert is specified, while still failing when --upsert is omitted and the list does not exist. Allow CurrencyUnit to be nullable in PremiumListUtils.parseToPremiumList() so that PremiumList.createFromLine() infers the currency unit from the input lines when currency is unset, and use this in UpdatePremiumListCommand when creating a new list via --upsert. Also fix the mixed-currency example in config/files/premium/example.txt. Also propagate exceptions from CreateOrUpdatePremiumListCommand.execute() and CreateOrUpdateReservedListCommand.execute() instead of catching and swallowing Throwable, and validate non-empty and parseable input data in CreatePremiumListCommand.prompt(). Add comprehensive unit tests across PremiumListUtilsTest and the create/update list command test suites. BUG=http://b/569977604
d4756db to
c3aea0f
Compare
gbrodman
left a comment
There was a problem hiding this comment.
@gbrodman reviewed 13 files and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on CydeWeys).
core/src/main/java/google/registry/tools/CreatePremiumListCommand.java line 60 at r1 (raw file):
} inputData = Files.readAllLines(inputFile, UTF_8); checkArgument(!inputData.isEmpty(), "New premium list data cannot be empty");
instead of checking here, as long as we're parsing the list anyway, we should parse the list then check to make sure there are at least some lines -- this would falsely succeed on a file with only a comment
core/src/main/java/google/registry/tools/UpdateReservedListCommand.java line 52 at r1 (raw file):
List<String> allLines = Files.readAllLines(input, UTF_8); if (existingReservedList.isEmpty()) { newChange = true;
i think we also need to make sure the name is valid (though we cannot guarantee the TLD exists yet)
Add
--upsert(-u) flag toUpdatePremiumListCommandandUpdateReservedListCommandso that missing premium and reserved lists are created automatically when--upsertis specified, while still failing when--upsertis omitted and the list does not exist.Allow
CurrencyUnitto be nullable inPremiumListUtils.parseToPremiumList()so thatPremiumList.createFromLine()infers the currency unit from the input lines when currency is unset, and use this inUpdatePremiumListCommandwhen creating a new list via--upsert. Also fix the mixed-currency example inconfig/files/premium/example.txt.Also propagate exceptions from
CreateOrUpdatePremiumListCommand.execute()andCreateOrUpdateReservedListCommand.execute()instead of catching and swallowingThrowable, and validate non-empty and parseable input data inCreatePremiumListCommand.prompt(). Add comprehensive unit tests acrossPremiumListUtilsTestand the create/update list command test suites.BUG=http://b/569977604
This change is