diff --git a/java/google/registry/flows/EppController.java b/java/google/registry/flows/EppController.java index cfebbdd0d..26690cec4 100644 --- a/java/google/registry/flows/EppController.java +++ b/java/google/registry/flows/EppController.java @@ -56,7 +56,7 @@ public final class EppController { public byte[] handleEppCommand(SessionMetadata sessionMetadata, byte[] inputXmlBytes) { Trid trid = null; try { - EppInput eppInput = unmarshal(inputXmlBytes); + EppInput eppInput = unmarshal(EppInput.class, inputXmlBytes); trid = Trid.create(eppInput.getCommandWrapper().getClTrid()); ImmutableList targetIds = eppInput.getTargetIds(); metrics.setCommandName(eppInput.getCommandName()); diff --git a/java/google/registry/flows/EppXmlTransformer.java b/java/google/registry/flows/EppXmlTransformer.java index 23866ce33..9e7e27eee 100644 --- a/java/google/registry/flows/EppXmlTransformer.java +++ b/java/google/registry/flows/EppXmlTransformer.java @@ -76,9 +76,15 @@ public class EppXmlTransformer { OUTPUT_TRANSFORMER.validate(xml); } - public static T unmarshal(byte[] bytes) throws EppException { + /** + * Unmarshal bytes into Epp classes. + * + * @param clazz type to return, specified as a param to enforce typesafe generics + * @see "http://errorprone.info/bugpattern/TypeParameterUnusedInFormals" + */ + public static T unmarshal(Class clazz, byte[] bytes) throws EppException { try { - return INPUT_TRANSFORMER.unmarshal(new ByteArrayInputStream(bytes)); + return INPUT_TRANSFORMER.unmarshal(clazz, new ByteArrayInputStream(bytes)); } catch (XmlException e) { // If this XmlException is wrapping a known type find it. If not, it's a syntax error. FluentIterable causalChain = FluentIterable.from(Throwables.getCausalChain(e)); diff --git a/java/google/registry/flows/domain/DomainApplicationInfoFlow.java b/java/google/registry/flows/domain/DomainApplicationInfoFlow.java index b87a357b3..e2f7c326e 100644 --- a/java/google/registry/flows/domain/DomainApplicationInfoFlow.java +++ b/java/google/registry/flows/domain/DomainApplicationInfoFlow.java @@ -87,7 +87,7 @@ public class DomainApplicationInfoFlow extends BaseDomainInfoFlowunmarshal( - application.getEncodedSignedMarks().get(0).getBytes()).getId(), + ? null + : unmarshal( + SignedMark.class, + application.getEncodedSignedMarks().get(0).getBytes()).getId(), "applicationRoid", application.getRepoId(), "applicationTime", application.getCreationTime().toString(), "launchNotice", launchNotice == null ? null : ImmutableMap.of( diff --git a/java/google/registry/tools/GenerateApplicationsReportCommand.java b/java/google/registry/tools/GenerateApplicationsReportCommand.java index d494f1b9c..c3756684a 100644 --- a/java/google/registry/tools/GenerateApplicationsReportCommand.java +++ b/java/google/registry/tools/GenerateApplicationsReportCommand.java @@ -138,7 +138,7 @@ final class GenerateApplicationsReportCommand implements RemoteApiCommand, Gtech SignedMark signedMark; try { - signedMark = unmarshal(signedMarkData); + signedMark = unmarshal(SignedMark.class, signedMarkData); } catch (EppException e) { return Optional.of(makeLine(domainApplication, "Unparseable SMD")); } diff --git a/java/google/registry/tools/ValidateEscrowDepositCommand.java b/java/google/registry/tools/ValidateEscrowDepositCommand.java index a796b5f22..86fc3b4aa 100644 --- a/java/google/registry/tools/ValidateEscrowDepositCommand.java +++ b/java/google/registry/tools/ValidateEscrowDepositCommand.java @@ -86,7 +86,7 @@ final class ValidateEscrowDepositCommand implements Command { } private static void validateXmlStream(InputStream inputStream) throws XmlException { - XjcRdeDeposit deposit = XjcXmlTransformer.unmarshal(inputStream); + XjcRdeDeposit deposit = XjcXmlTransformer.unmarshal(XjcRdeDeposit.class, inputStream); System.out.printf("ID: %s\n", deposit.getId()); System.out.printf("Previous ID: %s\n", deposit.getPrevId()); System.out.printf("Type: %s\n", deposit.getType()); diff --git a/java/google/registry/tools/ValidateLoginCredentialsCommand.java b/java/google/registry/tools/ValidateLoginCredentialsCommand.java index b06ee826b..194d30201 100644 --- a/java/google/registry/tools/ValidateLoginCredentialsCommand.java +++ b/java/google/registry/tools/ValidateLoginCredentialsCommand.java @@ -17,6 +17,7 @@ package google.registry.tools; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Strings.isNullOrEmpty; import static com.google.common.io.Resources.getResource; +import static google.registry.flows.EppXmlTransformer.unmarshal; import static google.registry.tools.CommandUtilities.runFlow; import static google.registry.util.X509Utils.getCertificateHash; import static google.registry.util.X509Utils.loadCertificate; @@ -30,7 +31,6 @@ import com.google.template.soy.data.SoyMapData; import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; -import google.registry.flows.EppXmlTransformer; import google.registry.flows.FlowRunner; import google.registry.flows.FlowRunner.CommitMode; import google.registry.flows.FlowRunner.UserPrivileges; @@ -104,7 +104,7 @@ final class ValidateLoginCredentialsCommand implements RemoteApiCommand, GtechCo System.out.println(runFlow( new FlowRunner( LoginFlow.class, - EppXmlTransformer.unmarshal(inputXmlBytes), + unmarshal(EppInput.class, inputXmlBytes), Trid.create(null), new HttpSessionMetadata( new TlsCredentials( diff --git a/java/google/registry/tools/server/VerifyOteAction.java b/java/google/registry/tools/server/VerifyOteAction.java index 665416128..60f69fb43 100644 --- a/java/google/registry/tools/server/VerifyOteAction.java +++ b/java/google/registry/tools/server/VerifyOteAction.java @@ -297,7 +297,7 @@ public class VerifyOteAction implements Runnable, JsonAction { if (xmlBytes == null) { return; } - final EppInput eppInput = unmarshal(xmlBytes); + final EppInput eppInput = unmarshal(EppInput.class, xmlBytes); if (!statCounts.addAll( FluentIterable.from(EnumSet.allOf(StatType.class)) .filter( diff --git a/java/google/registry/ui/server/api/CheckApiAction.java b/java/google/registry/ui/server/api/CheckApiAction.java index 5911c3c16..737b17301 100644 --- a/java/google/registry/ui/server/api/CheckApiAction.java +++ b/java/google/registry/ui/server/api/CheckApiAction.java @@ -17,6 +17,7 @@ package google.registry.ui.server.api; import static com.google.common.base.MoreObjects.firstNonNull; import static com.google.common.base.Strings.nullToEmpty; import static com.google.common.net.HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN; +import static google.registry.flows.EppXmlTransformer.unmarshal; import static google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension.FEE_0_6; import static google.registry.model.registry.Registries.findTldForNameOrThrow; import static google.registry.ui.server.SoyTemplateUtils.createTofuSupplier; @@ -36,7 +37,6 @@ import dagger.Provides; import google.registry.config.RegistryEnvironment; import google.registry.flows.EppException; -import google.registry.flows.EppXmlTransformer; import google.registry.flows.FlowRunner; import google.registry.flows.FlowRunner.CommitMode; import google.registry.flows.FlowRunner.UserPrivileges; @@ -118,7 +118,7 @@ public class CheckApiAction implements Runnable { .getBytes(UTF_8); EppResponse response = new FlowRunner( DomainCheckFlow.class, - EppXmlTransformer.unmarshal(inputXmlBytes), + unmarshal(EppInput.class, inputXmlBytes), Trid.create(getClass().getSimpleName()), sessionMetadata, inputXmlBytes, diff --git a/java/google/registry/xjc/XjcXmlTransformer.java b/java/google/registry/xjc/XjcXmlTransformer.java index 20159cd88..5bfa224e6 100644 --- a/java/google/registry/xjc/XjcXmlTransformer.java +++ b/java/google/registry/xjc/XjcXmlTransformer.java @@ -64,8 +64,8 @@ public class XjcXmlTransformer { return INSTANCE; } - public static T unmarshal(InputStream stream) throws XmlException { - return INSTANCE.unmarshal(stream); + public static T unmarshal(Class clazz, InputStream stream) throws XmlException { + return INSTANCE.unmarshal(clazz, stream); } public static void marshalLenient(Object root, Writer writer) throws XmlException { diff --git a/java/google/registry/xml/XmlTransformer.java b/java/google/registry/xml/XmlTransformer.java index 7d8c27a0c..059e00687 100644 --- a/java/google/registry/xml/XmlTransformer.java +++ b/java/google/registry/xml/XmlTransformer.java @@ -136,21 +136,19 @@ public class XmlTransformer { } /** - * Turns XML text into an object, validating against {@link #schema}. - * - *

You must specify the XML class you expect to receive as the root element. Validation is - * performed in accordance with the hard-coded XML schemas. + * Turns XML text into an object, validating against hard-coded xml {@link #schema}s. * + * @param clazz the XML class you expect to receive as the root element * @throws XmlException if failed to read from {@code bytes}, XML input is invalid, or root * element doesn't match {@code expect}. * @see com.google.common.io.Files#asByteSource * @see com.google.common.io.Resources#asByteSource + * @see "http://errorprone.info/bugpattern/TypeParameterUnusedInFormals" */ - @SuppressWarnings("unchecked") - public T unmarshal(InputStream stream) throws XmlException { + public T unmarshal(Class clazz, InputStream stream) throws XmlException { try (InputStream autoClosingStream = stream) { - return (T) getUnmarshaller().unmarshal( - XML_INPUT_FACTORY.createXMLStreamReader(new StreamSource(autoClosingStream, SYSTEM_ID))); + return clazz.cast(getUnmarshaller().unmarshal( + XML_INPUT_FACTORY.createXMLStreamReader(new StreamSource(autoClosingStream, SYSTEM_ID)))); } catch (UnmarshalException e) { // Plain old parsing exceptions have a SAXParseException with no further cause. if (e.getLinkedException() instanceof SAXParseException diff --git a/javatests/google/registry/flows/EppToolActionTest.java b/javatests/google/registry/flows/EppToolActionTest.java index 347042af3..e81377304 100644 --- a/javatests/google/registry/flows/EppToolActionTest.java +++ b/javatests/google/registry/flows/EppToolActionTest.java @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. - package google.registry.flows; import static com.google.common.truth.Truth.assertThat; diff --git a/javatests/google/registry/flows/EppXmlTransformerTest.java b/javatests/google/registry/flows/EppXmlTransformerTest.java new file mode 100644 index 000000000..4baf08080 --- /dev/null +++ b/javatests/google/registry/flows/EppXmlTransformerTest.java @@ -0,0 +1,52 @@ +// Copyright 2016 The Domain Registry Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +package google.registry.flows; + +import static com.google.common.truth.Truth.assertThat; +import static google.registry.flows.EppXmlTransformer.unmarshal; +import static google.registry.util.ResourceUtils.readResourceBytes; + +import google.registry.model.eppinput.EppInput; +import google.registry.model.eppoutput.EppOutput; +import google.registry.testing.ExceptionRule; +import google.registry.testing.ShardableTestCase; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Tests for {@link EppXmlTransformer}. */ +@RunWith(JUnit4.class) +public class EppXmlTransformerTest extends ShardableTestCase { + + @Rule + public final ExceptionRule thrown = new ExceptionRule(); + + @Test + public void testUnmarshalingEppInput() throws Exception { + EppInput input = unmarshal( + EppInput.class, readResourceBytes(getClass(), "testdata/contact_info.xml").read()); + assertThat(input.getCommandName()).isEqualTo("Info"); + } + + @Test + public void testUnmarshalingWrongClassThrows() throws Exception { + thrown.expect(ClassCastException.class); + EppXmlTransformer.unmarshal( + EppOutput.class, readResourceBytes(getClass(), "testdata/contact_info.xml").read()); + } +} diff --git a/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java index 694e75f32..f5f648fce 100644 --- a/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java @@ -1140,6 +1140,7 @@ public class DomainApplicationCreateFlowTest .setCreateBillingCost(Money.of(EUR, 13)) .setRestoreBillingCost(Money.of(EUR, 11)) .setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(EUR, 7))) + .setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(EUR))) .setServerStatusChangeBillingCost(Money.of(EUR, 19)) .build()); persistContactsAndHosts(); diff --git a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java index 00d07f3c3..173bbece0 100644 --- a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java @@ -560,6 +560,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase { action.run(); executeTasksUntilEmpty("mapreduce", clock); - XjcRdeDeposit deposit = - unmarshal(Ghostryde.decode(readGcsFile(gcsService, XML_FILE), decryptKey).getData()); + XjcRdeDeposit deposit = unmarshal( + XjcRdeDeposit.class, + Ghostryde.decode(readGcsFile(gcsService, XML_FILE), decryptKey).getData()); XjcRdeHeader header = extractAndRemoveContentWithType(XjcRdeHeader.class, deposit); assertThat(header.getTld()).isEqualTo("lol"); @@ -230,8 +231,9 @@ public class RdeStagingActionTest extends MapreduceTestCase { action.run(); executeTasksUntilEmpty("mapreduce", clock); - XjcRdeDeposit deposit = - unmarshal(Ghostryde.decode(readGcsFile(gcsService, XML_FILE), decryptKey).getData()); + XjcRdeDeposit deposit = unmarshal( + XjcRdeDeposit.class, + Ghostryde.decode(readGcsFile(gcsService, XML_FILE), decryptKey).getData()); assertThat(deposit.getType()).isEqualTo(XjcRdeDepositTypeType.FULL); assertThat(deposit.getId()).isEqualTo(RdeUtil.timestampToId(DateTime.parse("2000-01-01TZ"))); assertThat(deposit.getWatermark()).isEqualTo(DateTime.parse("2000-01-01TZ")); @@ -271,8 +273,9 @@ public class RdeStagingActionTest extends MapreduceTestCase { action.run(); executeTasksUntilEmpty("mapreduce", clock); - XjcRdeDeposit deposit = - unmarshal(Ghostryde.decode(readGcsFile(gcsService, XML_FILE), decryptKey).getData()); + XjcRdeDeposit deposit = unmarshal( + XjcRdeDeposit.class, + Ghostryde.decode(readGcsFile(gcsService, XML_FILE), decryptKey).getData()); XjcRdeRegistrar registrar1 = extractAndRemoveContentWithType(XjcRdeRegistrar.class, deposit); XjcRdeRegistrar registrar2 = extractAndRemoveContentWithType(XjcRdeRegistrar.class, deposit); XjcRdeHeader header = extractAndRemoveContentWithType(XjcRdeHeader.class, deposit); @@ -349,8 +352,9 @@ public class RdeStagingActionTest extends MapreduceTestCase { for (GcsFilename filename : asList( new GcsFilename("rde-bucket", "fop_1971-01-01_full_S1_R0.xml.ghostryde"), new GcsFilename("rde-bucket", "fop_1971-01-05_thin_S1_R0.xml.ghostryde"))) { - XjcRdeDeposit deposit = - unmarshal(Ghostryde.decode(readGcsFile(gcsService, filename), decryptKey).getData()); + XjcRdeDeposit deposit = unmarshal( + XjcRdeDeposit.class, + Ghostryde.decode(readGcsFile(gcsService, filename), decryptKey).getData()); XjcRdeRegistrar registrar1 = extractAndRemoveContentWithType(XjcRdeRegistrar.class, deposit); XjcRdeRegistrar registrar2 = extractAndRemoveContentWithType(XjcRdeRegistrar.class, deposit); XjcRdeHeader header = extractAndRemoveContentWithType(XjcRdeHeader.class, deposit); @@ -377,8 +381,9 @@ public class RdeStagingActionTest extends MapreduceTestCase { executeTasksUntilEmpty("mapreduce", clock); GcsFilename filename = new GcsFilename("rde-bucket", "fop_2000-01-01_full_S1_R0.xml.ghostryde"); - XjcRdeDeposit deposit = - unmarshal(Ghostryde.decode(readGcsFile(gcsService, filename), decryptKey).getData()); + XjcRdeDeposit deposit = unmarshal( + XjcRdeDeposit.class, + Ghostryde.decode(readGcsFile(gcsService, filename), decryptKey).getData()); XjcRdeDomain domain = extractAndRemoveContentWithType(XjcRdeDomain.class, deposit); XjcRdeIdn firstIdn = extractAndRemoveContentWithType(XjcRdeIdn.class, deposit); XjcRdeHeader header = extractAndRemoveContentWithType(XjcRdeHeader.class, deposit); @@ -494,16 +499,17 @@ public class RdeStagingActionTest extends MapreduceTestCase { action.run(); executeTasksUntilEmpty("mapreduce", clock); - XjcRdeDeposit deposit = - unmarshal(readXml("fop_2000-01-01_full_S1_R0.xml.ghostryde").getBytes(UTF_8)); + XjcRdeDeposit deposit = unmarshal( + XjcRdeDeposit.class, + readXml("fop_2000-01-01_full_S1_R0.xml.ghostryde").getBytes(UTF_8)); assertThat(deposit.getResend()).isEqualTo(0); setCursor(Registry.get("fop"), RDE_STAGING, DateTime.parse("2000-01-01TZ")); action.response = new FakeResponse(); action.run(); executeTasksUntilEmpty("mapreduce", clock); - - deposit = unmarshal(readXml("fop_2000-01-01_full_S1_R1.xml.ghostryde").getBytes(UTF_8)); + deposit = unmarshal( + XjcRdeDeposit.class, readXml("fop_2000-01-01_full_S1_R1.xml.ghostryde").getBytes(UTF_8)); assertThat(deposit.getResend()).isEqualTo(1); } @@ -621,7 +627,7 @@ public class RdeStagingActionTest extends MapreduceTestCase { }}); } - public static T unmarshal(byte[] xml) throws XmlException { - return XjcXmlTransformer.unmarshal(new ByteArrayInputStream(xml)); + public static T unmarshal(Class clazz, byte[] xml) throws XmlException { + return XjcXmlTransformer.unmarshal(clazz, new ByteArrayInputStream(xml)); } } diff --git a/javatests/google/registry/testing/DatastoreHelper.java b/javatests/google/registry/testing/DatastoreHelper.java index fc3b037af..dfe6fdf86 100644 --- a/javatests/google/registry/testing/DatastoreHelper.java +++ b/javatests/google/registry/testing/DatastoreHelper.java @@ -230,6 +230,7 @@ public class DatastoreHelper { .setTldStateTransitions(tldStates) // Set billing costs to distinct small primes to avoid masking bugs in tests. .setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 11))) + .setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(USD))) .setCreateBillingCost(Money.of(USD, 13)) .setRestoreBillingCost(Money.of(USD, 17)) .setServerStatusChangeBillingCost(Money.of(USD, 19)) diff --git a/javatests/google/registry/testing/EppLoader.java b/javatests/google/registry/testing/EppLoader.java index a7f95ea93..e24c1681a 100644 --- a/javatests/google/registry/testing/EppLoader.java +++ b/javatests/google/registry/testing/EppLoader.java @@ -14,12 +14,12 @@ package google.registry.testing; +import static google.registry.flows.EppXmlTransformer.unmarshal; import static google.registry.testing.TestDataHelper.loadFileWithSubstitutions; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.common.collect.ImmutableMap; -import google.registry.flows.EppXmlTransformer; import google.registry.model.eppinput.EppInput; import java.util.Map; @@ -38,7 +38,7 @@ public class EppLoader { } public EppInput getEpp() throws Exception { - return EppXmlTransformer.unmarshal(eppXml.getBytes(UTF_8)); + return unmarshal(EppInput.class, eppXml.getBytes(UTF_8)); } public String getEppXml() { diff --git a/javatests/google/registry/tools/AllocateDomainCommandTest.java b/javatests/google/registry/tools/AllocateDomainCommandTest.java index 49cf1b75b..fde90e34c 100644 --- a/javatests/google/registry/tools/AllocateDomainCommandTest.java +++ b/javatests/google/registry/tools/AllocateDomainCommandTest.java @@ -18,6 +18,7 @@ import static com.google.common.io.BaseEncoding.base16; import static com.google.common.io.Resources.getResource; import static com.google.common.io.Resources.toByteArray; import static com.google.common.truth.Truth.assertThat; +import static google.registry.flows.EppXmlTransformer.unmarshal; import static google.registry.flows.picker.FlowPicker.getFlowClass; import static google.registry.model.domain.DesignatedContact.Type.ADMIN; import static google.registry.model.domain.DesignatedContact.Type.BILLING; @@ -37,7 +38,6 @@ import com.google.common.collect.ImmutableSet; import com.beust.jcommander.ParameterException; import com.googlecode.objectify.Ref; -import google.registry.flows.EppXmlTransformer; import google.registry.flows.domain.DomainAllocateFlow; import google.registry.model.domain.DesignatedContact; import google.registry.model.domain.DomainApplication; @@ -157,9 +157,8 @@ public class AllocateDomainCommandTest extends CommandTestCaseunmarshal( - readResourceBytes(getClass(), "testdata/allocate_domain.xml").read()))) - .isEqualTo(DomainAllocateFlow.class); + byte[] xmlBytes = readResourceBytes(getClass(), "testdata/allocate_domain.xml").read(); + assertThat(getFlowClass(unmarshal(EppInput.class, xmlBytes))) + .isEqualTo(DomainAllocateFlow.class); } } diff --git a/javatests/google/registry/tools/GenerateEscrowDepositCommandTest.java b/javatests/google/registry/tools/GenerateEscrowDepositCommandTest.java index 6c8625ffb..bbdc526c7 100644 --- a/javatests/google/registry/tools/GenerateEscrowDepositCommandTest.java +++ b/javatests/google/registry/tools/GenerateEscrowDepositCommandTest.java @@ -216,7 +216,7 @@ public class GenerateEscrowDepositCommandTest } public static Object unmarshal(byte[] xml) throws XmlException { - return XjcXmlTransformer.unmarshal(new ByteArrayInputStream(xml)); + return XjcXmlTransformer.unmarshal(Object.class, new ByteArrayInputStream(xml)); } private static ImmutableMap mapifyCounts(XjcRdeHeader header) { diff --git a/javatests/google/registry/tools/UpdateTldCommandTest.java b/javatests/google/registry/tools/UpdateTldCommandTest.java index ef00b99e8..42518d476 100644 --- a/javatests/google/registry/tools/UpdateTldCommandTest.java +++ b/javatests/google/registry/tools/UpdateTldCommandTest.java @@ -199,6 +199,7 @@ public class UpdateTldCommandTest extends CommandTestCase { .setRestoreBillingCost(Money.ofMajor(JPY, 1)) .setRenewBillingCostTransitions( ImmutableSortedMap.of(START_OF_TIME, Money.ofMajor(JPY, 1))) + .setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(JPY))) .setServerStatusChangeBillingCost(Money.ofMajor(JPY, 1)) .build()); runCommandForced( diff --git a/javatests/google/registry/xjc/XjcObjectTest.java b/javatests/google/registry/xjc/XjcObjectTest.java index d67d15fe0..0419fcc55 100644 --- a/javatests/google/registry/xjc/XjcObjectTest.java +++ b/javatests/google/registry/xjc/XjcObjectTest.java @@ -86,7 +86,7 @@ public class XjcObjectTest { @Test public void testUnmarshalUTF16() throws Exception { - XjcRdeDeposit deposit = unmarshal(new ByteArrayInputStream( + XjcRdeDeposit deposit = unmarshal(XjcRdeDeposit.class, new ByteArrayInputStream( RDE_DEPOSIT_FULL.replaceFirst("UTF-8", "UTF-16").getBytes(UTF_16))); assertThat(deposit).isNotNull(); assertThat(deposit.getType()).isEqualTo(XjcRdeDepositTypeType.FULL); @@ -96,7 +96,7 @@ public class XjcObjectTest { @Test public void testUnmarshalValidation() throws Exception { thrown.expect(Throwable.class, "pattern '\\w{1,13}' for type 'depositIdType'"); - unmarshal(new ByteArrayInputStream( + unmarshal(XjcRdeDeposit.class, new ByteArrayInputStream( RDE_DEPOSIT_FULL.replaceFirst("id=\"[^\"]+\"", "id=\"\"").getBytes(UTF_8))); } @@ -115,7 +115,7 @@ public class XjcObjectTest { @Test public void testNamespaceEpp() throws Exception { - String xml = unmarshal(new ByteArrayInputStream(readResourceUtf8( + String xml = unmarshal(XjcObject.class, new ByteArrayInputStream(readResourceUtf8( XjcObjectTest.class, "testdata/greeting.xml").getBytes(UTF_8))).toString(); assertWithMessage(xml).that(xml).startsWith("