Add domain_lock nomulus command

This command is used by registry operators to apply registry locks to
domain names.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176549874
This commit is contained in:
mcilwain 2017-11-21 13:05:32 -08:00 committed by jianglai
parent 8cd3979385
commit f041b1bac0
18 changed files with 453 additions and 35 deletions

View file

@ -20,9 +20,7 @@ import static google.registry.util.ResourceUtils.readResourceUtf8;
import java.util.Map;
import java.util.Map.Entry;
/**
* Contains helper methods for dealing with test data.
*/
/** Contains helper methods for dealing with test data. */
public final class TestDataHelper {
/**
@ -31,7 +29,11 @@ public final class TestDataHelper {
*/
public static String loadFileWithSubstitutions(
Class<?> context, String filename, Map<String, String> substitutions) {
String fileContents = readResourceUtf8(context, "testdata/" + filename);
return applySubstitutions(readResourceUtf8(context, "testdata/" + filename), substitutions);
}
/** Applies the given substitutions to the given string and returns the result. */
public static String applySubstitutions(String fileContents, Map<String, String> substitutions) {
for (Entry<String, String> entry : nullToEmpty(substitutions).entrySet()) {
fileContents = fileContents.replaceAll("%" + entry.getKey() + "%", entry.getValue());
}