mirror of
https://github.com/google/nomulus.git
synced 2025-05-28 16:30:12 +02:00
Refactor EppXmlTransformer to be in the model/ package
This will allow us to perform the OT&E history verification in the model/ package as well so that it can be used both by both the UI and the command line tool. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=225007167
This commit is contained in:
parent
f58211402a
commit
0a44ef0dca
27 changed files with 257 additions and 240 deletions
|
@ -21,7 +21,7 @@ import static com.google.common.base.Strings.emptyToNull;
|
|||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
import static com.google.common.io.BaseEncoding.base16;
|
||||
import static google.registry.flows.EppXmlTransformer.unmarshal;
|
||||
import static google.registry.model.eppcommon.EppXmlTransformer.unmarshal;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.tools.CommandUtilities.addHeader;
|
||||
import static java.util.stream.Collectors.joining;
|
||||
|
@ -34,7 +34,6 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.template.soy.data.SoyMapData;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.model.domain.DesignatedContact;
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
import google.registry.model.domain.DomainCommand;
|
||||
|
@ -46,6 +45,7 @@ import google.registry.model.eppinput.EppInput.ResourceCommandWrapper;
|
|||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.smd.SignedMark;
|
||||
import google.registry.tools.soy.DomainAllocateSoyInfo;
|
||||
import google.registry.xml.XmlException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
@ -88,7 +88,7 @@ final class AllocateDomainCommand extends MutatingEppToolCommand {
|
|||
}
|
||||
|
||||
/** Extract the registration period from the XML used to create the domain application. */
|
||||
private static Period extractPeriodFromXml(byte[] xmlBytes) throws EppException {
|
||||
private static Period extractPeriodFromXml(byte[] xmlBytes) throws XmlException {
|
||||
EppInput eppInput = unmarshal(EppInput.class, xmlBytes);
|
||||
return ((DomainCommand.Create)
|
||||
((ResourceCommandWrapper) eppInput.getCommandWrapper().getCommand())
|
||||
|
@ -182,7 +182,7 @@ final class AllocateDomainCommand extends MutatingEppToolCommand {
|
|||
"dsRecords", dsRecords,
|
||||
"clTrid", clientTransactionId));
|
||||
applicationKeys.add(Key.create(application));
|
||||
} catch (EppException e) {
|
||||
} catch (XmlException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
import static google.registry.flows.EppXmlTransformer.unmarshal;
|
||||
import static google.registry.model.eppcommon.EppXmlTransformer.unmarshal;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.model.registry.Registries.assertTldExists;
|
||||
import static google.registry.util.DateTimeUtils.isBeforeOrAt;
|
||||
|
@ -29,7 +29,6 @@ import com.google.common.base.Joiner;
|
|||
import com.google.common.net.InternetDomainName;
|
||||
import com.googlecode.objectify.cmd.LoadType;
|
||||
import com.googlecode.objectify.cmd.Query;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
import google.registry.model.smd.EncodedSignedMark;
|
||||
import google.registry.model.smd.SignedMark;
|
||||
|
@ -39,6 +38,7 @@ import google.registry.tmch.TmchXmlSignature;
|
|||
import google.registry.tools.params.PathParameter;
|
||||
import google.registry.util.Clock;
|
||||
import google.registry.util.Idn;
|
||||
import google.registry.xml.XmlException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
@ -132,7 +132,7 @@ final class GenerateApplicationsReportCommand implements CommandWithRemoteApi {
|
|||
SignedMark signedMark;
|
||||
try {
|
||||
signedMark = unmarshal(SignedMark.class, signedMarkData);
|
||||
} catch (EppException e) {
|
||||
} catch (XmlException e) {
|
||||
return Optional.of(makeLine(domainApplication, "Unparseable SMD"));
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ java_library(
|
|||
"//java/google/registry/config",
|
||||
"//java/google/registry/dns",
|
||||
"//java/google/registry/export",
|
||||
"//java/google/registry/flows",
|
||||
"//java/google/registry/gcs",
|
||||
"//java/google/registry/groups",
|
||||
"//java/google/registry/mapreduce",
|
||||
|
@ -20,6 +19,7 @@ java_library(
|
|||
"//java/google/registry/request",
|
||||
"//java/google/registry/request/auth",
|
||||
"//java/google/registry/util",
|
||||
"//java/google/registry/xml",
|
||||
"//third_party/objectify:objectify-v4_1",
|
||||
"@com_google_appengine_api_1_0_sdk",
|
||||
"@com_google_appengine_tools_appengine_gcs_client",
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.tools.server;
|
|||
import static com.google.common.base.Predicates.equalTo;
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static com.google.common.collect.Maps.toMap;
|
||||
import static google.registry.flows.EppXmlTransformer.unmarshal;
|
||||
import static google.registry.model.eppcommon.EppXmlTransformer.unmarshal;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.util.CollectionUtils.isNullOrEmpty;
|
||||
import static google.registry.util.DomainNameUtils.ACE_PREFIX;
|
||||
|
@ -30,7 +30,6 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.Multiset;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.cmd.Query;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.model.domain.DomainCommand;
|
||||
import google.registry.model.domain.fee.FeeCreateCommandExtension;
|
||||
import google.registry.model.domain.launch.LaunchCreateExtension;
|
||||
|
@ -45,6 +44,7 @@ import google.registry.request.Action;
|
|||
import google.registry.request.JsonActionRunner;
|
||||
import google.registry.request.JsonActionRunner.JsonAction;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.xml.XmlException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
|
@ -264,7 +264,7 @@ public class VerifyOteAction implements Runnable, JsonAction {
|
|||
for (HistoryEntry historyEntry : query) {
|
||||
try {
|
||||
record(historyEntry);
|
||||
} catch (EppException e) {
|
||||
} catch (XmlException e) {
|
||||
throw new RuntimeException("Couldn't parse history entry " + Key.create(historyEntry), e);
|
||||
}
|
||||
// Break out early if all tests were passed.
|
||||
|
@ -276,7 +276,7 @@ public class VerifyOteAction implements Runnable, JsonAction {
|
|||
}
|
||||
|
||||
/** Interprets the data in the provided HistoryEntry and increments counters. */
|
||||
void record(final HistoryEntry historyEntry) throws EppException {
|
||||
void record(final HistoryEntry historyEntry) throws XmlException {
|
||||
byte[] xmlBytes = historyEntry.getXmlBytes();
|
||||
// xmlBytes can be null on contact create and update for safe-harbor compliance.
|
||||
final Optional<EppInput> eppInput =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue