mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Break domain flow TMCH helper methods into separate injected class
This is a necessary prerequisite to subsequently injecting the configuration dependencies. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143567753
This commit is contained in:
parent
c35c3a678b
commit
8252e97dfb
8 changed files with 285 additions and 239 deletions
|
@ -15,7 +15,6 @@
|
|||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.verifyEncodedSignedMark;
|
||||
import static google.registry.model.EppResourceUtils.loadDomainApplication;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.tmch.TmchData.readEncodedSignedMark;
|
||||
|
@ -27,6 +26,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.net.InternetDomainName;
|
||||
import com.googlecode.objectify.VoidWork;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.domain.DomainFlowTmchUtils;
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.smd.EncodedSignedMark;
|
||||
|
@ -34,12 +34,16 @@ import google.registry.tools.Command.RemoteApiCommand;
|
|||
import google.registry.tools.params.PathParameter;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Command to update the SMD on a domain application. */
|
||||
@Parameters(separators = " =", commandDescription = "Update the SMD on an application.")
|
||||
final class UpdateSmdCommand implements RemoteApiCommand {
|
||||
|
||||
@Inject DomainFlowTmchUtils tmchUtils;
|
||||
@Inject UpdateSmdCommand() {}
|
||||
|
||||
@Parameter(
|
||||
names = "--id",
|
||||
description = "Application ID to update.",
|
||||
|
@ -74,7 +78,7 @@ final class UpdateSmdCommand implements RemoteApiCommand {
|
|||
}});
|
||||
}
|
||||
|
||||
private static void updateSmd(
|
||||
private void updateSmd(
|
||||
String applicationId, EncodedSignedMark encodedSignedMark, String reason)
|
||||
throws EppException {
|
||||
ofy().assertInTransaction();
|
||||
|
@ -91,7 +95,7 @@ final class UpdateSmdCommand implements RemoteApiCommand {
|
|||
// Verify the new SMD.
|
||||
String domainLabel = InternetDomainName.from(domainApplication.getFullyQualifiedDomainName())
|
||||
.parts().get(0);
|
||||
verifyEncodedSignedMark(encodedSignedMark, domainLabel, now);
|
||||
tmchUtils.verifyEncodedSignedMark(encodedSignedMark, domainLabel, now);
|
||||
|
||||
DomainApplication updatedApplication = domainApplication.asBuilder()
|
||||
.setEncodedSignedMarks(ImmutableList.of(encodedSignedMark))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue