Add command for creating LRP tokens

Command allows for both one-off creation and bulk import of assignees via file (the latter will be used for the initial import from Play Store).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133048360
This commit is contained in:
ctingue 2016-09-13 14:32:03 -07:00 committed by Ben McIlwain
parent 1a050554fe
commit 75203918a9
7 changed files with 404 additions and 5 deletions

View file

@ -17,6 +17,10 @@ package google.registry.tools;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Strings.isNullOrEmpty;
import com.google.common.collect.ImmutableList;
import java.util.Collection;
/** String generator. */
abstract class StringGenerator {
@ -41,4 +45,13 @@ abstract class StringGenerator {
/** Generates a string of a specified length. */
abstract String createString(int length);
/** Batch-generates an {@link ImmutableList} of strings of a specified length. */
public Collection<String> createStrings(int length, int count) {
ImmutableList.Builder<String> listBuilder = new ImmutableList.Builder<>();
for (int i = 0; i < count; i++) {
listBuilder.add(createString(length));
}
return listBuilder.build();
}
}