Automatically create mailing lists for registrars

This improves one of our gTech processes so they no longer have to remember to create Google Groups for a registrar after creating that registrar.

The ConfirmingCommand.verify() method is renamed to be more general purpose, so that it can do anything that follows naturally after a successful execution, such as creating Google Groups groups.

Minor refactoring is done around RegistryToolEnvironment handling for tests to make it more bullet-proof and general case.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117494277
This commit is contained in:
mcilwain 2016-03-17 15:50:11 -07:00 committed by Justine Tunney
parent 5174c1c63f
commit 2293be4079
6 changed files with 135 additions and 5 deletions

View file

@ -34,7 +34,7 @@ public abstract class ConfirmingCommand implements Command {
printLineIfNotEmpty(prompt());
if (force || promptForYes("Perform this command?")) {
System.out.println(execute());
printLineIfNotEmpty(verify());
printLineIfNotEmpty(postExecute());
} else {
System.out.println("Command aborted.");
}
@ -57,8 +57,11 @@ public abstract class ConfirmingCommand implements Command {
/** Perform the command and return a result description. */
protected abstract String execute() throws Exception;
/** Verify result and/or perform any post-execution steps, and return optional description. */
protected String verify() throws Exception {
/**
* Perform any post-execution steps (e.g. verifying the result), and return a description String
* to be printed if non-empty.
*/
protected String postExecute() throws Exception {
return "";
}
}