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

@ -14,12 +14,12 @@
package google.registry.tools.server;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.ByteSource;
import com.google.common.io.Resources;
import java.io.IOException;
import google.registry.testing.TestDataHelper;
import java.net.URL;
import java.util.Map;
/** Utility class providing easy access to contents of the {@code testdata/} directory. */
public final class ToolsTestData {
@ -30,12 +30,17 @@ public final class ToolsTestData {
}
/**
* Loads data from file in {@code tools/server/testdata/} as a String (assuming file is UTF-8).
*
* @throws IOException if the file couldn't be loaded from the jar.
* Loads data from file in {@code tools/server/testdata/} as a UTF-8 String.
*/
public static String loadUtf8(String filename) throws IOException {
return Resources.asCharSource(getUrl(filename), UTF_8).read();
public static String loadUtf8(String filename) {
return loadUtf8(filename, ImmutableMap.of());
}
/**
* Loads data from file in {@code tools/server/testdata/} as a UTF-8 String, with substitutions.
*/
public static String loadUtf8(String filename, Map<String, String> substitutions) {
return TestDataHelper.loadFileWithSubstitutions(ToolsTestData.class, filename, substitutions);
}
private static URL getUrl(String filename) {