diff --git a/java/google/registry/module/backend/BackendRequestComponent.java b/java/google/registry/module/backend/BackendRequestComponent.java
index e51cd961d..e5cea3837 100644
--- a/java/google/registry/module/backend/BackendRequestComponent.java
+++ b/java/google/registry/module/backend/BackendRequestComponent.java
@@ -50,6 +50,7 @@ import google.registry.monitoring.whitebox.MetricsExportAction;
import google.registry.monitoring.whitebox.VerifyEntityIntegrityAction;
import google.registry.monitoring.whitebox.WhiteboxModule;
import google.registry.rde.BrdaCopyAction;
+import google.registry.rde.RdeContactImportAction;
import google.registry.rde.RdeModule;
import google.registry.rde.RdeReportAction;
import google.registry.rde.RdeReporter;
@@ -105,6 +106,7 @@ interface BackendRequestComponent {
NordnVerifyAction nordnVerifyAction();
PublishDnsUpdatesAction publishDnsUpdatesAction();
ReadDnsQueueAction readDnsQueueAction();
+ RdeContactImportAction rdeContactImportAction();
RdeReportAction rdeReportAction();
RdeStagingAction rdeStagingAction();
RdeUploadAction rdeUploadAction();
diff --git a/java/google/registry/rde/BUILD b/java/google/registry/rde/BUILD
index 8d0d1274a..b36f27e8e 100644
--- a/java/google/registry/rde/BUILD
+++ b/java/google/registry/rde/BUILD
@@ -14,6 +14,7 @@ java_library(
"//java/com/google/common/collect",
"//java/com/google/common/html",
"//java/com/google/common/io",
+ "//java/com/google/common/math",
"//java/com/google/common/net",
"//third_party/java/appengine:appengine-api",
"//third_party/java/appengine_gcs_client",
diff --git a/java/google/registry/rde/RdeContactImportAction.java b/java/google/registry/rde/RdeContactImportAction.java
new file mode 100644
index 000000000..632d3e302
--- /dev/null
+++ b/java/google/registry/rde/RdeContactImportAction.java
@@ -0,0 +1,135 @@
+// 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.rde;
+
+import static google.registry.mapreduce.MapreduceRunner.PARAM_MAP_SHARDS;
+import static google.registry.model.ofy.ObjectifyService.ofy;
+import static google.registry.rde.RdeModule.PATH;
+import static google.registry.util.PipelineUtils.createJobPath;
+
+import com.google.appengine.tools.cloudstorage.GcsService;
+import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
+import com.google.appengine.tools.cloudstorage.RetryParams;
+import com.google.appengine.tools.mapreduce.Mapper;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
+import google.registry.config.ConfigModule;
+import google.registry.config.ConfigModule.Config;
+import google.registry.gcs.GcsUtils;
+import google.registry.mapreduce.MapreduceRunner;
+import google.registry.model.contact.ContactResource;
+import google.registry.request.Action;
+import google.registry.request.Parameter;
+import google.registry.request.Response;
+import google.registry.util.SystemClock;
+import javax.inject.Inject;
+
+/**
+ * A mapreduce that imports contacts from an escrow file.
+ *
+ * Specify the escrow file to import with the "path" parameter.
+ */
+@Action(path = "/_dr/task/importRdeContacts")
+public class RdeContactImportAction implements Runnable {
+
+ private static final GcsService GCS_SERVICE =
+ GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());
+
+ protected final MapreduceRunner mrRunner;
+ protected final Response response;
+ protected final String importBucketName;
+ protected final String importFileName;
+ protected final Optional mapShards;
+
+ @Inject
+ public RdeContactImportAction(
+ MapreduceRunner mrRunner,
+ Response response,
+ @Config("rdeImportBucket") String importBucketName,
+ @Parameter(PATH) String importFileName,
+ @Parameter(PARAM_MAP_SHARDS) Optional mapShards) {
+ this.mrRunner = mrRunner;
+ this.response = response;
+ this.importBucketName = importBucketName;
+ this.importFileName = importFileName;
+ this.mapShards = mapShards;
+ }
+
+ @Override
+ public void run() {
+ response.sendJavaScriptRedirect(createJobPath(mrRunner
+ .setJobName("Import contacts from escrow file")
+ .setModuleName("backend")
+ .runMapOnly(
+ createMapper(),
+ ImmutableList.of(createInput()))));
+ }
+
+ /**
+ * Creates a new {@link RdeContactInput}
+ *
+ * Should be overridden in a subclass for the purposes of unit testing.
+ */
+ @VisibleForTesting
+ RdeContactInput createInput() {
+ return new RdeContactInput(mapShards, importBucketName, importFileName);
+ }
+
+ /**
+ * Creates a new {@link RdeContactImportMapper}
+ *
+ *
Should be overridden in a subclass for the purposes of unit testing.
+ */
+ @VisibleForTesting
+ RdeContactImportMapper createMapper() {
+ return new RdeContactImportMapper(importBucketName);
+ }
+
+ /** Mapper to import contacts from an escrow file. */
+ public static class RdeContactImportMapper extends Mapper {
+
+ private static final long serialVersionUID = -7645091075256589374L;
+ private final String importBucketName;
+ private transient RdeImportUtils importUtils;
+
+ public RdeContactImportMapper(String importBucketName) {
+ this.importBucketName = importBucketName;
+ }
+
+ private RdeImportUtils getImportUtils() {
+ if (importUtils == null) {
+ importUtils = createRdeImportUtils();
+ }
+ return importUtils;
+ }
+
+ /**
+ * Creates a new instance of RdeImportUtils.
+ */
+ private RdeImportUtils createRdeImportUtils() {
+ return new RdeImportUtils(
+ ofy(),
+ new SystemClock(),
+ importBucketName,
+ new GcsUtils(GCS_SERVICE, ConfigModule.provideGcsBufferSize()));
+ }
+
+ @Override
+ public void map(ContactResource contact) {
+ getImportUtils().importContact(contact);
+ }
+ }
+}
diff --git a/java/google/registry/rde/RdeContactInput.java b/java/google/registry/rde/RdeContactInput.java
new file mode 100644
index 000000000..e370ffab4
--- /dev/null
+++ b/java/google/registry/rde/RdeContactInput.java
@@ -0,0 +1,134 @@
+// 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.rde;
+
+import static com.google.common.math.IntMath.divide;
+import static java.math.RoundingMode.CEILING;
+import static java.math.RoundingMode.FLOOR;
+
+import com.google.appengine.tools.cloudstorage.GcsFilename;
+import com.google.appengine.tools.cloudstorage.GcsService;
+import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
+import com.google.appengine.tools.cloudstorage.RetryParams;
+import com.google.appengine.tools.mapreduce.Input;
+import com.google.appengine.tools.mapreduce.InputReader;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
+import google.registry.config.ConfigModule;
+import google.registry.gcs.GcsUtils;
+import google.registry.model.contact.ContactResource;
+import google.registry.rde.RdeParser.RdeHeader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+/**
+ * A MapReduce {@link Input} that imports {@link ContactResource} objects from an escrow file.
+ *
+ * If a mapShards parameter has been specified, up to that many readers will be created
+ * so that each map shard has one reader. If a mapShards parameter has not been specified, a
+ * default number of readers will be created.
+ */
+public class RdeContactInput extends Input {
+
+ private static final long serialVersionUID = -366966393494008712L;
+ private static final GcsService GCS_SERVICE =
+ GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());
+
+ /**
+ * Default number of readers if map shards are not specified.
+ */
+ private static final int DEFAULT_READERS = 50;
+
+ /**
+ * Minimum number of records per reader.
+ */
+ private static final int MINIMUM_RECORDS_PER_READER = 100;
+
+ /**
+ * Optional argument to explicitly specify the number of readers.
+ */
+ private final int numReaders;
+ private final String importBucketName;
+ private final String importFileName;
+
+ /**
+ * Creates a new {@link RdeContactInput}
+ *
+ * @param mapShards Number of readers that should be created
+ * @param importBucketName Name of GCS bucket for escrow file imports
+ * @param importFileName Name of escrow file in GCS
+ */
+ public RdeContactInput(Optional mapShards, String importBucketName,
+ String importFileName) {
+ this.numReaders = mapShards.or(DEFAULT_READERS);
+ this.importBucketName = importBucketName;
+ this.importFileName = importFileName;
+ }
+
+ @Override
+ public List extends InputReader> createReaders() throws IOException {
+ int numReaders = this.numReaders;
+ RdeHeader header = newParser().getHeader();
+ int numberOfContacts = header.getContactCount().intValue();
+ if (numberOfContacts / numReaders < MINIMUM_RECORDS_PER_READER) {
+ numReaders = divide(numberOfContacts, MINIMUM_RECORDS_PER_READER, FLOOR);
+ // use at least one reader
+ numReaders = Math.max(numReaders, 1);
+ }
+ ImmutableList.Builder builder = new ImmutableList.Builder<>();
+ int contactsPerReader =
+ Math.max(MINIMUM_RECORDS_PER_READER, divide(numberOfContacts, numReaders, CEILING));
+ int offset = 0;
+ for (int i = 0; i < numReaders; i++) {
+ builder = builder.add(newReader(offset, contactsPerReader));
+ offset += contactsPerReader;
+ }
+ return builder.build();
+ }
+
+ /**
+ * Creates a new instance of {@link RdeContactReader}
+ *
+ * This method can be overridden by a subclass for the purposes of unit testing.
+ */
+ protected RdeContactReader newReader(int offset, int maxResults) {
+ return new RdeContactReader(importBucketName, importFileName, offset, maxResults);
+ }
+
+ /**
+ * Creates a new instance of {@link RdeParser}
+ */
+ private RdeParser newParser() {
+ GcsUtils utils = new GcsUtils(GCS_SERVICE, ConfigModule.provideGcsBufferSize());
+ GcsFilename filename = new GcsFilename(importBucketName, importFileName);
+ try (InputStream xmlInput = utils.openInputStream(filename)) {
+ return new RdeParser(xmlInput);
+ } catch (Exception e) {
+ throw new InitializationException(
+ String.format("Error opening rde file %s/%s", importBucketName, importFileName), e);
+ }
+ }
+
+ /**
+ * Thrown when the input cannot initialize properly.
+ */
+ private static class InitializationException extends RuntimeException {
+
+ public InitializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ }
+}
diff --git a/java/google/registry/rde/RdeContactReader.java b/java/google/registry/rde/RdeContactReader.java
new file mode 100644
index 000000000..dd35fb467
--- /dev/null
+++ b/java/google/registry/rde/RdeContactReader.java
@@ -0,0 +1,107 @@
+// 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.rde;
+
+import com.google.appengine.tools.cloudstorage.GcsFilename;
+import com.google.appengine.tools.cloudstorage.GcsService;
+import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
+import com.google.appengine.tools.cloudstorage.RetryParams;
+import com.google.appengine.tools.mapreduce.InputReader;
+import google.registry.config.ConfigModule;
+import google.registry.gcs.GcsUtils;
+import google.registry.model.contact.ContactResource;
+import google.registry.util.FormattingLogger;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.util.NoSuchElementException;
+import javax.annotation.concurrent.NotThreadSafe;
+
+/** Mapreduce {@link InputReader} for reading contacts from escrow files */
+@NotThreadSafe
+public class RdeContactReader extends InputReader implements Serializable {
+
+ private static final long serialVersionUID = -3688793834175577691L;
+
+ private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
+ private static final GcsService GCS_SERVICE =
+ GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());
+
+ final String importBucketName;
+ final String importFileName;
+ final int offset;
+ final int maxResults;
+
+ private int count = 0;
+
+ transient RdeParser parser;
+
+ /**
+ * Creates a new instance of {@link RdeParser}
+ */
+ private RdeParser newParser() {
+ GcsUtils utils = new GcsUtils(GCS_SERVICE, ConfigModule.provideGcsBufferSize());
+ GcsFilename filename = new GcsFilename(importBucketName, importFileName);
+ InputStream xmlInput = utils.openInputStream(filename);
+ try {
+ RdeParser parser = new RdeParser(xmlInput);
+ // skip the file offset and count
+ // if count is greater than 0, the reader has been rehydrated after doing some work.
+ // skip any already processed records.
+ parser.skipContacts(offset + count);
+ return parser;
+ } catch (Exception e) {
+ logger.severefmt(e, "Error opening rde file %s/%s", importBucketName, importFileName);
+ throw new RuntimeException(e);
+ }
+ }
+
+ public RdeContactReader(
+ String importBucketName,
+ String importFileName,
+ int offset,
+ int maxResults) {
+ this.importBucketName = importBucketName;
+ this.importFileName = importFileName;
+ this.offset = offset;
+ this.maxResults = maxResults;
+ }
+
+ @Override
+ public ContactResource next() throws IOException {
+ if (count < maxResults) {
+ if (parser == null) {
+ parser = newParser();
+ if (parser.isAtContact()) {
+ count++;
+ return XjcToContactResourceConverter.convertContact(parser.getContact());
+ }
+ }
+ if (parser.nextContact()) {
+ count++;
+ return XjcToContactResourceConverter.convertContact(parser.getContact());
+ }
+ }
+ throw new NoSuchElementException();
+ }
+
+ @Override
+ public void endSlice() throws IOException {
+ super.endSlice();
+ if (parser != null) {
+ parser.close();
+ }
+ }
+}
diff --git a/java/google/registry/rde/RdeImportUtils.java b/java/google/registry/rde/RdeImportUtils.java
index 4253909d0..9bfdd4e6c 100644
--- a/java/google/registry/rde/RdeImportUtils.java
+++ b/java/google/registry/rde/RdeImportUtils.java
@@ -36,11 +36,14 @@ import google.registry.xjc.rderegistrar.XjcRdeRegistrar;
import java.io.IOException;
import java.io.InputStream;
import javax.inject.Inject;
+import javax.xml.bind.JAXBException;
import javax.xml.stream.XMLStreamException;
import org.joda.time.DateTime;
-/** Utility functions for escrow file import. */
-public final class RdeImportUtils {
+/**
+ * Utility functions for escrow file import.
+ */
+public class RdeImportUtils {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
@@ -147,7 +150,7 @@ public final class RdeImportUtils {
String.format("Registrar '%s' not found in the registry", registrar.getId()));
}
}
- } catch (XMLStreamException e) {
+ } catch (XMLStreamException | JAXBException e) {
throw new IllegalArgumentException(
String.format("Invalid XML file: '%s'", escrowFilePath), e);
}
diff --git a/java/google/registry/rde/RdeModule.java b/java/google/registry/rde/RdeModule.java
index 6b31be4cd..67ed43e2e 100644
--- a/java/google/registry/rde/RdeModule.java
+++ b/java/google/registry/rde/RdeModule.java
@@ -34,6 +34,7 @@ import org.joda.time.DateTime;
public final class RdeModule {
static final String PARAM_WATERMARK = "watermark";
+ static final String PATH = "path";
@Provides
@Parameter(PARAM_WATERMARK)
@@ -52,4 +53,10 @@ public final class RdeModule {
static Queue provideQueueRdeReport() {
return getQueue("rde-report");
}
+
+ @Provides
+ @Parameter(PATH)
+ static String providePath(HttpServletRequest req) {
+ return RequestParameters.extractRequiredParameter(req, PATH);
+ }
}
diff --git a/java/google/registry/rde/RdeParser.java b/java/google/registry/rde/RdeParser.java
index 2a873d311..eebd1755d 100644
--- a/java/google/registry/rde/RdeParser.java
+++ b/java/google/registry/rde/RdeParser.java
@@ -17,9 +17,9 @@ package google.registry.rde;
import static com.google.common.base.Preconditions.checkArgument;
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
+import com.google.common.base.Joiner;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
-import google.registry.xjc.XjcXmlTransformer;
import google.registry.xjc.rdecontact.XjcRdeContact;
import google.registry.xjc.rdecontact.XjcRdeContactElement;
import google.registry.xjc.rdedomain.XjcRdeDomain;
@@ -37,17 +37,17 @@ import google.registry.xjc.rdenndn.XjcRdeNndn;
import google.registry.xjc.rdenndn.XjcRdeNndnElement;
import google.registry.xjc.rderegistrar.XjcRdeRegistrar;
import google.registry.xjc.rderegistrar.XjcRdeRegistrarElement;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
+import java.io.Closeable;
+import java.io.IOException;
import java.io.InputStream;
+import java.util.Arrays;
import javax.annotation.concurrent.NotThreadSafe;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stax.StAXSource;
-import javax.xml.transform.stream.StreamResult;
/**
* RDE escrow deposit file parser
@@ -75,7 +75,7 @@ import javax.xml.transform.stream.StreamResult;
* parser.
*/
@NotThreadSafe
-public class RdeParser {
+public class RdeParser implements Closeable {
private static final String RDE_DOMAIN_URI = "urn:ietf:params:xml:ns:rdeDomain-1.0";
private static final String RDE_HOST_URI = "urn:ietf:params:xml:ns:rdeHost-1.0";
@@ -86,6 +86,23 @@ public class RdeParser {
private static final String RDE_EPP_PARAMS_URI = "urn:ietf:params:xml:ns:rdeEppParams-1.0";
private static final String RDE_HEADER_URI = "urn:ietf:params:xml:ns:rdeHeader-1.0";
+ /** List of packages to initialize JAXBContext. **/
+ private static final String JAXB_CONTEXT_PACKAGES = Joiner.on(":")
+ .join(Arrays.asList(
+ "google.registry.xjc.contact",
+ "google.registry.xjc.domain",
+ "google.registry.xjc.host",
+ "google.registry.xjc.mark",
+ "google.registry.xjc.rde",
+ "google.registry.xjc.rdecontact",
+ "google.registry.xjc.rdedomain",
+ "google.registry.xjc.rdeeppparams",
+ "google.registry.xjc.rdeheader",
+ "google.registry.xjc.rdeidn",
+ "google.registry.xjc.rdenndn",
+ "google.registry.xjc.rderegistrar",
+ "google.registry.xjc.smd"));
+
/**
* Convenient immutable java representation of an RDE header
*/
@@ -136,18 +153,23 @@ public class RdeParser {
}
}
+ private final InputStream xmlInput;
private final XMLStreamReader reader;
+ private final Unmarshaller unmarshaller;
+
private RdeHeader header;
/**
* Creates a new instance of {@link RdeParser}
*
* @param xmlInput Contents of the escrow deposit file
+ * @throws JAXBException
*/
- public RdeParser(InputStream xmlInput) throws XMLStreamException {
- XMLInputFactory factory = XMLInputFactory.newInstance();
- reader = factory.createXMLStreamReader(xmlInput);
- header = new RdeHeader(readHeader());
+ public RdeParser(InputStream xmlInput) throws XMLStreamException, JAXBException {
+ this.xmlInput = xmlInput;
+ this.unmarshaller = JAXBContext.newInstance(JAXB_CONTEXT_PACKAGES).createUnmarshaller();
+ this.reader = XMLInputFactory.newInstance().createXMLStreamReader(xmlInput);
+ this.header = new RdeHeader(readHeader());
}
/**
@@ -176,12 +198,7 @@ public class RdeParser {
checkArgumentNotNull(uri, "uri cannot be null");
try {
if (isAtElement(uri, name)) {
- TransformerFactory tf = TransformerFactory.newInstance();
- Transformer t = tf.newTransformer();
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- t.transform(new StAXSource(reader), new StreamResult(bout));
- ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
- Object element = XjcXmlTransformer.unmarshal(Object.class, bin);
+ Object element = unmarshaller.unmarshal(reader);
return element;
} else {
throw new IllegalStateException(String.format("Not at element %s:%s", uri, name));
@@ -562,4 +579,14 @@ public class RdeParser {
(XjcRdeEppParamsElement) unmarshalElement(RDE_EPP_PARAMS_URI, "eppParams");
return element.getValue();
}
+
+ /**
+ * Closes the underlying InputStream
+ *
+ * @throws IOException if the underlying stream throws {@link IOException} on close.
+ */
+ @Override
+ public void close() throws IOException {
+ xmlInput.close();
+ }
}
diff --git a/javatests/google/registry/rde/RdeContactImportActionTest.java b/javatests/google/registry/rde/RdeContactImportActionTest.java
new file mode 100644
index 000000000..d6577247d
--- /dev/null
+++ b/javatests/google/registry/rde/RdeContactImportActionTest.java
@@ -0,0 +1,98 @@
+// 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.rde;
+
+import static com.google.common.truth.Truth.assertThat;
+import static google.registry.model.ofy.ObjectifyService.ofy;
+
+import com.google.appengine.tools.cloudstorage.GcsFilename;
+import com.google.appengine.tools.cloudstorage.GcsService;
+import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
+import com.google.appengine.tools.cloudstorage.RetryParams;
+import com.google.common.base.Optional;
+import com.google.common.io.ByteSource;
+import com.google.common.io.ByteStreams;
+import google.registry.config.ConfigModule;
+import google.registry.gcs.GcsUtils;
+import google.registry.mapreduce.MapreduceRunner;
+import google.registry.model.contact.ContactResource;
+import google.registry.request.Response;
+import google.registry.testing.FakeResponse;
+import google.registry.testing.mapreduce.MapreduceTestCase;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+/** Unit tests for {@link RdeContactImportAction}. */
+@RunWith(MockitoJUnitRunner.class)
+public class RdeContactImportActionTest extends MapreduceTestCase {
+
+ private static final ByteSource DEPOSIT_1_CONTACT = RdeTestData.get("deposit_1_contact.xml");
+ private static final String IMPORT_BUCKET_NAME = "import-bucket";
+ private static final String IMPORT_FILE_NAME = "escrow-file.xml";
+
+ private static final GcsService GCS_SERVICE =
+ GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());
+
+ private MapreduceRunner mrRunner;
+
+ private Response response;
+
+ @Before
+ public void before() throws Exception {
+ response = new FakeResponse();
+ mrRunner = new MapreduceRunner(Optional.absent(), Optional.absent());
+ action = new RdeContactImportAction(
+ mrRunner,
+ response,
+ IMPORT_BUCKET_NAME,
+ IMPORT_FILE_NAME,
+ Optional.of(3));
+ }
+
+ @Test
+ public void test_mapreduceSuccessfullyImportsContact() throws Exception {
+ pushToGcs(DEPOSIT_1_CONTACT);
+ runMapreduce();
+ List contacts = ofy().load().type(ContactResource.class).list();
+ assertThat(contacts).hasSize(1);
+ checkContact(contacts.get(0));
+ }
+
+ /** Verifies that contact id and ROID match expected values */
+ private void checkContact(ContactResource contact) {
+ assertThat(contact.getContactId()).isEqualTo("contact1");
+ assertThat(contact.getRepoId()).isEqualTo("contact1-TEST");
+ }
+
+ private void runMapreduce() throws Exception {
+ action.run();
+ executeTasksUntilEmpty("mapreduce");
+ }
+
+ private void pushToGcs(ByteSource source) throws IOException {
+ try (OutputStream outStream =
+ new GcsUtils(GCS_SERVICE, ConfigModule.provideGcsBufferSize())
+ .openOutputStream(new GcsFilename(IMPORT_BUCKET_NAME, IMPORT_FILE_NAME));
+ InputStream inStream = source.openStream()) {
+ ByteStreams.copy(inStream, outStream);
+ }
+ }
+}
diff --git a/javatests/google/registry/rde/RdeContactInputTest.java b/javatests/google/registry/rde/RdeContactInputTest.java
new file mode 100644
index 000000000..42f467468
--- /dev/null
+++ b/javatests/google/registry/rde/RdeContactInputTest.java
@@ -0,0 +1,262 @@
+// 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.rde;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import com.google.appengine.tools.cloudstorage.GcsFilename;
+import com.google.appengine.tools.cloudstorage.GcsService;
+import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
+import com.google.appengine.tools.cloudstorage.RetryParams;
+import com.google.common.base.Optional;
+import com.google.common.io.ByteSource;
+import com.google.common.io.ByteStreams;
+import google.registry.config.ConfigModule;
+import google.registry.gcs.GcsUtils;
+import google.registry.testing.AppEngineRule;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+/** Unit tests for {@link RdeContactInput} */
+@RunWith(MockitoJUnitRunner.class)
+public class RdeContactInputTest {
+
+ private static final ByteSource DEPOSIT_0_CONTACT =
+ RdeTestData.get("deposit_0_contact_header.xml");
+ private static final ByteSource DEPOSIT_1_CONTACT =
+ RdeTestData.get("deposit_1_contact.xml");
+ private static final ByteSource DEPOSIT_199_CONTACT =
+ RdeTestData.get("deposit_199_contact_header.xml");
+ private static final ByteSource DEPOSIT_200_CONTACT =
+ RdeTestData.get("deposit_200_contact_header.xml");
+ private static final ByteSource DEPOSIT_1000_CONTACT =
+ RdeTestData.get("deposit_1000_contact_header.xml");
+ private static final ByteSource DEPOSIT_10000_CONTACT =
+ RdeTestData.get("deposit_10000_contact_header.xml");
+ private static final String IMPORT_BUCKET_NAME = "import-bucket";
+ private static final String IMPORT_FILE_NAME = "escrow-file.xml";
+
+ private static final GcsService GCS_SERVICE =
+ GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());
+
+ @Rule
+ public final AppEngineRule appEngine = AppEngineRule.builder()
+ .withDatastore()
+ .build();
+
+ /** Escrow file with zero contacts results in one reader */
+ @Test
+ public void testZeroContactsDefaultShards_returnsOneReader() throws Exception {
+ pushToGcs(DEPOSIT_0_CONTACT);
+ assertNumberOfReaders(Optional.absent(), 1);
+ }
+
+ /** Escrow file with zero contacts results in expected reader configuration */
+ @Test
+ public void testZeroContactsDefaultShardsReaderConfigurations() throws Exception {
+ pushToGcs(DEPOSIT_0_CONTACT);
+ assertReaderConfigurations(Optional.absent(), 0, 0, 100);
+ }
+
+ /** Escrow file with zero contacts and 75 shards results in one reader */
+ @Test
+ public void testZeroContacts75Shards_returnsOneReader() throws Exception {
+ pushToGcs(DEPOSIT_0_CONTACT);
+ assertNumberOfReaders(Optional.of(75), 1);
+ }
+
+ /** Escrow file with one contact results in one reader */
+ @Test
+ public void testOneContactDefaultShards_returnsOneReader() throws Exception {
+ pushToGcs(DEPOSIT_1_CONTACT);
+ assertNumberOfReaders(Optional.absent(), 1);
+ }
+
+ /** Escrow file with one contact results in expected reader configuration */
+ @Test
+ public void testOneContactDefaultShardsReaderConfigurations() throws Exception {
+ pushToGcs(DEPOSIT_1_CONTACT);
+ assertReaderConfigurations(Optional.absent(), 0, 0, 100);
+ }
+
+ /** Escrow file with one contact and 75 shards results in one reader */
+ @Test
+ public void testOneContact75Shards_returnsOneReader() throws Exception {
+ pushToGcs(DEPOSIT_1_CONTACT);
+ assertNumberOfReaders(Optional.of(75), 1);
+ }
+
+ /** Escrow file with 199 contacts results in one reader */
+ @Test
+ public void test199ContactsDefaultShards_returnsOneReader() throws Exception {
+ pushToGcs(DEPOSIT_199_CONTACT);
+ assertNumberOfReaders(Optional.absent(), 1);
+ }
+
+ /** Escrow file with 199 contacts results in expected reader configuration */
+ @Test
+ public void test199ContactsDefaultShardsReaderConfigurations() throws Exception {
+ pushToGcs(DEPOSIT_199_CONTACT);
+ assertReaderConfigurations(Optional.absent(), 0, 0, 199);
+ }
+
+ /** Escrow file with 199 contacts and 75 shards results in one reader */
+ @Test
+ public void test199Contacts75Shards_returnsOneReader() throws Exception {
+ pushToGcs(DEPOSIT_199_CONTACT);
+ assertNumberOfReaders(Optional.of(75), 1);
+ }
+
+ /** Escrow file with 200 contacts results in two readers */
+ @Test
+ public void test200ContactsDefaultShards_returnsTwoReaders() throws Exception {
+ pushToGcs(DEPOSIT_200_CONTACT);
+ assertNumberOfReaders(Optional.absent(), 2);
+ }
+
+ /** Escrow file with 200 contacts results in expected reader configurations */
+ @Test
+ public void test200ContactsDefaultShardsReaderConfigurations() throws Exception {
+ pushToGcs(DEPOSIT_200_CONTACT);
+ assertReaderConfigurations(Optional.absent(), 0, 0, 100);
+ assertReaderConfigurations(Optional.absent(), 1, 100, 100);
+ }
+
+ /** Escrow file with 200 contacts and 75 shards results in two readers */
+ @Test
+ public void test200Contacts75Shards_returnsOneReader() throws Exception {
+ pushToGcs(DEPOSIT_200_CONTACT);
+ assertNumberOfReaders(Optional.of(75), 2);
+ }
+
+ /** Escrow file with 1000 contacts results in ten readers */
+ @Test
+ public void test1000ContactsDefaultShards_returns10Readers() throws Exception {
+ pushToGcs(DEPOSIT_1000_CONTACT);
+ assertNumberOfReaders(Optional.absent(), 10);
+ }
+
+ /** Escrow file with 1000 contacts results in expected reader configurations */
+ @Test
+ public void test1000ContactsDefaultShardsReaderConfigurations() throws Exception {
+ pushToGcs(DEPOSIT_1000_CONTACT);
+ for (int i = 0; i < 10; i++) {
+ assertReaderConfigurations(Optional.absent(), i, i * 100, 100);
+ }
+ }
+
+ /** Escrow file with 1000 contacts and 75 shards results in ten readers */
+ @Test
+ public void test1000Contacts75Shards_returns10Readers() throws Exception {
+ pushToGcs(DEPOSIT_1000_CONTACT);
+ assertNumberOfReaders(Optional.of(75), 10);
+ }
+
+ /** Escrow file with 10000 contacts results in 50 readers */
+ @Test
+ public void test10000ContactsDefaultShards_returns50Readers() throws Exception {
+ pushToGcs(DEPOSIT_10000_CONTACT);
+ assertNumberOfReaders(Optional.absent(), 50);
+ }
+
+ /** Escrow file with 10000 contacts results in expected reader configurations */
+ @Test
+ public void test10000ContactsDefaultShardsReaderConfigurations() throws Exception {
+ pushToGcs(DEPOSIT_10000_CONTACT);
+ for (int i = 0; i < 50; i++) {
+ assertReaderConfigurations(Optional.absent(), i, i * 200, 200);
+ }
+ }
+
+ /** Escrow file with 10000 contacts and 75 shards results in 75 readers */
+ @Test
+ public void test10000Contacts75Shards_returns75Readers() throws Exception {
+ pushToGcs(DEPOSIT_10000_CONTACT);
+ assertNumberOfReaders(Optional.of(75), 75);
+ }
+
+ /** Escrow file with 10000 contacts and 150 shards results in 100 readers */
+ @Test
+ public void test10000Contacts150Shards_returns100Readers() throws Exception {
+ pushToGcs(DEPOSIT_10000_CONTACT);
+ assertNumberOfReaders(Optional.of(150), 100);
+ }
+
+ /**
+ * Verify bucket, filename, offset and max results for a specific reader
+ *
+ * @param numberOfShards Number of desired shards ({@code Optional.absent()} uses default of 50)
+ * @param whichReader Index of the reader in the list that is produced by the
+ * {@link RdeContactInput}
+ * @param expectedOffset Expected offset of the reader
+ * @param expectedMaxResults Expected maxResults of the reader
+ */
+ private void assertReaderConfigurations(
+ Optional numberOfShards,
+ int whichReader,
+ int expectedOffset,
+ int expectedMaxResults) throws Exception {
+ RdeContactInput input = getInput(numberOfShards);
+ List> readers = input.createReaders();
+ RdeContactReader reader = (RdeContactReader) readers.get(whichReader);
+ assertImportBucketAndFilename(reader);
+ assertThat(reader.offset).isEqualTo(expectedOffset);
+ assertThat(reader.maxResults).isEqualTo(expectedMaxResults);
+ }
+
+ private void pushToGcs(ByteSource source) throws IOException {
+ try (OutputStream outStream =
+ new GcsUtils(GCS_SERVICE, ConfigModule.provideGcsBufferSize())
+ .openOutputStream(new GcsFilename(IMPORT_BUCKET_NAME, IMPORT_FILE_NAME));
+ InputStream inStream = source.openStream()) {
+ ByteStreams.copy(inStream, outStream);
+ }
+ }
+
+ /**
+ * Verify the number of readers produced by the {@link RdeContactInput}
+ *
+ * @param numberOfShards Number of desired shards ({@code Optional.absent()} uses default of 50)
+ * @param expectedNumberOfReaders Expected size of the list returned
+ */
+ private void assertNumberOfReaders(Optional numberOfShards,
+ int expectedNumberOfReaders) throws Exception {
+ RdeContactInput input = getInput(numberOfShards);
+ List> readers = input.createReaders();
+ assertThat(readers).hasSize(expectedNumberOfReaders);
+ }
+
+ /**
+ * Creates a new testable instance of {@link RdeContactInput}
+ * @param mapShards Number of desired shards ({@code Optional.absent()} uses default of 50)
+ */
+ private RdeContactInput getInput(Optional mapShards) {
+ return new RdeContactInput(mapShards, IMPORT_BUCKET_NAME, IMPORT_FILE_NAME);
+ }
+
+ /**
+ * Verifies the configured import bucket and file names.
+ */
+ private void assertImportBucketAndFilename(RdeContactReader reader) {
+ assertThat(reader.importBucketName).isEqualTo("import-bucket");
+ assertThat(reader.importFileName).isEqualTo("escrow-file.xml");
+ }
+}
diff --git a/javatests/google/registry/rde/RdeContactReaderTest.java b/javatests/google/registry/rde/RdeContactReaderTest.java
new file mode 100644
index 000000000..ad49186ee
--- /dev/null
+++ b/javatests/google/registry/rde/RdeContactReaderTest.java
@@ -0,0 +1,214 @@
+// 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.rde;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import com.google.appengine.tools.cloudstorage.GcsFilename;
+import com.google.appengine.tools.cloudstorage.GcsService;
+import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
+import com.google.appengine.tools.cloudstorage.RetryParams;
+import com.google.common.io.ByteSource;
+import com.google.common.io.ByteStreams;
+import google.registry.config.ConfigModule;
+import google.registry.gcs.GcsUtils;
+import google.registry.model.contact.ContactResource;
+import google.registry.testing.AppEngineRule;
+import google.registry.testing.ExceptionRule;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.util.NoSuchElementException;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+/** Unit tests for {@link RdeContactReader} */
+@RunWith(MockitoJUnitRunner.class)
+public class RdeContactReaderTest {
+
+ private static final ByteSource DEPOSIT_1_CONTACT = RdeTestData.get("deposit_1_contact.xml");
+ private static final ByteSource DEPOSIT_3_CONTACT = RdeTestData.get("deposit_3_contact.xml");
+ private static final ByteSource DEPOSIT_4_CONTACT = RdeTestData.get("deposit_4_contact.xml");
+ private static final ByteSource DEPOSIT_10_CONTACT = RdeTestData.get("deposit_10_contact.xml");
+ private static final String IMPORT_BUCKET_NAME = "rde-import";
+ private static final String IMPORT_FILE_NAME = "escrow-file.xml";
+
+ private static final GcsService GCS_SERVICE =
+ GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());
+
+ @Rule
+ public final AppEngineRule appEngine = AppEngineRule.builder()
+ .withDatastore()
+ .build();
+
+ @Rule
+ public final ExceptionRule thrown = new ExceptionRule();
+
+ /** Reads at least one result at 0 offset 1 maxResults */
+ @Test
+ public void testZeroOffsetOneResult_readsOne() throws Exception {
+ pushToGcs(DEPOSIT_1_CONTACT);
+ RdeContactReader reader = getReader(0, 1);
+ ContactResource contact1 = reader.next();
+ checkContact(contact1, "contact1", "contact1-TEST");
+ }
+
+ /** Reads at most one at 0 offset 1 maxResults */
+ @Test
+ public void testZeroOffsetOneResult_stopsAfterOne() throws Exception {
+ pushToGcs(DEPOSIT_3_CONTACT);
+ RdeContactReader reader = getReader(0, 1);
+ reader.next();
+ thrown.expect(NoSuchElementException.class);
+ reader.next();
+ }
+
+ /** Skips already-processed records after rehydration */
+ @Test
+ public void testZeroOffsetOneResult_skipsOneAfterRehydration() throws Exception {
+ pushToGcs(DEPOSIT_3_CONTACT);
+ RdeContactReader reader = getReader(0, 1);
+ reader.next();
+ reader.endSlice();
+
+ reader = cloneReader(reader);
+ reader.beginSlice();
+ // reader will not advance any further
+ thrown.expect(NoSuchElementException.class);
+ reader.next();
+ }
+
+ /** Reads three contacts */
+ @Test
+ public void testZeroOffsetThreeResult_readsThree() throws Exception {
+ pushToGcs(DEPOSIT_3_CONTACT);
+ RdeContactReader reader = getReader(0, 3);
+ checkContact(reader.next(), "contact1", "contact1-TEST");
+ checkContact(reader.next(), "contact2", "contact2-TEST");
+ checkContact(reader.next(), "contact3", "contact3-TEST");
+ }
+
+ /** Stops reading at 3 maxResults */
+ @Test
+ public void testZeroOffsetThreeResult_stopsAtThree() throws Exception {
+ pushToGcs(DEPOSIT_4_CONTACT);
+ RdeContactReader reader = getReader(0, 3);
+ for (int i = 0; i < 3; i++) {
+ reader.next();
+ }
+ thrown.expect(NoSuchElementException.class);
+ reader.next();
+ }
+
+ /** Reads one contact from file then stops at end of file */
+ @Test
+ public void testZeroOffsetThreeResult_endOfFile() throws Exception {
+ pushToGcs(DEPOSIT_1_CONTACT);
+ RdeContactReader reader = getReader(0, 3);
+ reader.next();
+ thrown.expect(NoSuchElementException.class);
+ reader.next();
+ }
+
+ /** Skips three contacts with offset of three */
+ @Test
+ public void testThreeOffsetOneResult_skipsThree() throws Exception {
+ pushToGcs(DEPOSIT_4_CONTACT);
+ RdeContactReader reader = getReader(3, 1);
+ checkContact(reader.next(), "contact4", "contact4-TEST");
+ }
+
+ /** Skips four contacts after advancing once at three offset, then rehydrating */
+ @Test
+ public void testThreeOffsetTwoResult_skipsFourAfterRehydration() throws Exception {
+ pushToGcs(DEPOSIT_10_CONTACT);
+ RdeContactReader reader = getReader(3, 2);
+ reader.next();
+ reader.endSlice();
+ reader = cloneReader(reader);
+ reader.beginSlice();
+ checkContact(reader.next(), "contact5", "contact5-TEST");
+ }
+
+ /** Reads three at zero offset three results with rehydration in the middle */
+ @Test
+ public void testZeroOffsetThreeResult_readsThreeWithRehydration() throws Exception {
+ pushToGcs(DEPOSIT_4_CONTACT);
+ RdeContactReader reader = getReader(0, 3);
+ checkContact(reader.next(), "contact1", "contact1-TEST");
+ reader.endSlice();
+ reader = cloneReader(reader);
+ reader.beginSlice();
+ checkContact(reader.next(), "contact2", "contact2-TEST");
+ checkContact(reader.next(), "contact3", "contact3-TEST");
+ }
+
+ /** Stops reading at three with zero offset three results with rehydration in the middle */
+ @Test
+ public void testZeroOffsetThreeResult_stopsAtThreeWithRehydration() throws Exception {
+ pushToGcs(DEPOSIT_4_CONTACT);
+ RdeContactReader reader = getReader(0, 3);
+ reader.next();
+ reader.endSlice();
+ reader = cloneReader(reader);
+ reader.beginSlice();
+ reader.next();
+ reader.next();
+ thrown.expect(NoSuchElementException.class);
+ reader.next();
+ }
+
+ private void pushToGcs(ByteSource source) throws IOException {
+ try (OutputStream outStream =
+ new GcsUtils(GCS_SERVICE, ConfigModule.provideGcsBufferSize())
+ .openOutputStream(new GcsFilename(IMPORT_BUCKET_NAME, IMPORT_FILE_NAME));
+ InputStream inStream = source.openStream()) {
+ ByteStreams.copy(inStream, outStream);
+ }
+ }
+
+ /** Creates a deep copy of the {@link RdeContactReader} */
+ private RdeContactReader cloneReader(
+ RdeContactReader reader) throws Exception {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ ObjectOutputStream oout = new ObjectOutputStream(bout);
+ oout.writeObject(reader);
+ ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
+ ObjectInputStream oin = new ObjectInputStream(bin);
+ RdeContactReader result = (RdeContactReader) oin.readObject();
+ return result;
+ }
+
+ /** Verifies that contact id and ROID match expected values */
+ private void checkContact(ContactResource contact, String contactId, String repoId) {
+ assertThat(contact).isNotNull();
+ assertThat(contact.getContactId()).isEqualTo(contactId);
+ assertThat(contact.getRepoId()).isEqualTo(repoId);
+ }
+
+ /** Gets a new {@link RdeContactReader} with specified offset and maxResults */
+ private RdeContactReader getReader(int offset, int maxResults) throws Exception {
+ RdeContactReader reader =
+ new RdeContactReader(IMPORT_BUCKET_NAME, IMPORT_FILE_NAME, offset, maxResults);
+ reader.beginSlice();
+ return reader;
+ }
+}
diff --git a/javatests/google/registry/rde/testdata/deposit_0_contact_header.xml b/javatests/google/registry/rde/testdata/deposit_0_contact_header.xml
new file mode 100644
index 000000000..7951dee38
--- /dev/null
+++ b/javatests/google/registry/rde/testdata/deposit_0_contact_header.xml
@@ -0,0 +1,259 @@
+
+
+
+ 2010-10-17T00:00:00Z
+
+ 1.0
+ urn:ietf:params:xml:ns:rdeHeader-1.0
+ urn:ietf:params:xml:ns:rdeContact-1.0
+ urn:ietf:params:xml:ns:rdeHost-1.0
+ urn:ietf:params:xml:ns:rdeDomain-1.0
+ urn:ietf:params:xml:ns:rdeRegistrar-1.0
+ urn:ietf:params:xml:ns:rdeIDN-1.0
+ urn:ietf:params:xml:ns:rdeNNDN-1.0
+ urn:ietf:params:xml:ns:rdeEppParams-1.0
+
+
+
+
+
+
+ test
+ 2
+
+ 1
+
+ 0
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+
+
+
+
+ example1.test
+ Dexample1-TEST
+
+ jd1234
+ sh8013
+ sh8013
+
+ ns1.example.com
+ ns1.example1.test
+
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ example2.test
+ Dexample2-TEST
+
+
+ jd1234
+ sh8013
+ sh8013
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ ns1.example.com
+ Hns1_example_com-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ ns1.example1.test
+ Hns1_example1_test-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ contact1
+ contact1-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+
+ RegistrarX
+ Registrar X
+ 123
+ ok
+
+
+ 123 Example Dr.
+
+ Suite 100
+
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ http://www.example.test
+
+
+ whois.example.test
+
+ http://whois.example.test
+
+
+ 2005-04-23T11:49:00.0Z
+ 2009-02-17T17:51:00.0Z
+
+
+
+
+
+http://www.iana.org/domains/idn-tables/tables/br_pt-br_1.0.html
+
+
+ http://registro.br/dominio/regras.html
+
+
+
+
+
+ xn--exampl-gva.test
+ pt-BR
+ example1.test
+ withheld
+ 2005-04-23T11:49:00.0Z
+
+
+
+
+ 1.0
+ en
+
+ urn:ietf:params:xml:ns:domain-1.0
+
+
+ urn:ietf:params:xml:ns:contact-1.0
+
+
+ urn:ietf:params:xml:ns:host-1.0
+
+
+ urn:ietf:params:xml:ns:rgp-1.0
+
+ urn:ietf:params:xml:ns:secDNS-1.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javatests/google/registry/rde/testdata/deposit_10000_contact_header.xml b/javatests/google/registry/rde/testdata/deposit_10000_contact_header.xml
new file mode 100644
index 000000000..bfa76283c
--- /dev/null
+++ b/javatests/google/registry/rde/testdata/deposit_10000_contact_header.xml
@@ -0,0 +1,259 @@
+
+
+
+ 2010-10-17T00:00:00Z
+
+ 1.0
+ urn:ietf:params:xml:ns:rdeHeader-1.0
+ urn:ietf:params:xml:ns:rdeContact-1.0
+ urn:ietf:params:xml:ns:rdeHost-1.0
+ urn:ietf:params:xml:ns:rdeDomain-1.0
+ urn:ietf:params:xml:ns:rdeRegistrar-1.0
+ urn:ietf:params:xml:ns:rdeIDN-1.0
+ urn:ietf:params:xml:ns:rdeNNDN-1.0
+ urn:ietf:params:xml:ns:rdeEppParams-1.0
+
+
+
+
+
+
+ test
+ 2
+
+ 1
+
+ 10000
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+
+
+
+
+ example1.test
+ Dexample1-TEST
+
+ jd1234
+ sh8013
+ sh8013
+
+ ns1.example.com
+ ns1.example1.test
+
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ example2.test
+ Dexample2-TEST
+
+
+ jd1234
+ sh8013
+ sh8013
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ ns1.example.com
+ Hns1_example_com-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ ns1.example1.test
+ Hns1_example1_test-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ contact1
+ contact1-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+
+ RegistrarX
+ Registrar X
+ 123
+ ok
+
+
+ 123 Example Dr.
+
+ Suite 100
+
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ http://www.example.test
+
+
+ whois.example.test
+
+ http://whois.example.test
+
+
+ 2005-04-23T11:49:00.0Z
+ 2009-02-17T17:51:00.0Z
+
+
+
+
+
+http://www.iana.org/domains/idn-tables/tables/br_pt-br_1.0.html
+
+
+ http://registro.br/dominio/regras.html
+
+
+
+
+
+ xn--exampl-gva.test
+ pt-BR
+ example1.test
+ withheld
+ 2005-04-23T11:49:00.0Z
+
+
+
+
+ 1.0
+ en
+
+ urn:ietf:params:xml:ns:domain-1.0
+
+
+ urn:ietf:params:xml:ns:contact-1.0
+
+
+ urn:ietf:params:xml:ns:host-1.0
+
+
+ urn:ietf:params:xml:ns:rgp-1.0
+
+ urn:ietf:params:xml:ns:secDNS-1.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javatests/google/registry/rde/testdata/deposit_1000_contact_header.xml b/javatests/google/registry/rde/testdata/deposit_1000_contact_header.xml
new file mode 100644
index 000000000..f8dd81604
--- /dev/null
+++ b/javatests/google/registry/rde/testdata/deposit_1000_contact_header.xml
@@ -0,0 +1,259 @@
+
+
+
+ 2010-10-17T00:00:00Z
+
+ 1.0
+ urn:ietf:params:xml:ns:rdeHeader-1.0
+ urn:ietf:params:xml:ns:rdeContact-1.0
+ urn:ietf:params:xml:ns:rdeHost-1.0
+ urn:ietf:params:xml:ns:rdeDomain-1.0
+ urn:ietf:params:xml:ns:rdeRegistrar-1.0
+ urn:ietf:params:xml:ns:rdeIDN-1.0
+ urn:ietf:params:xml:ns:rdeNNDN-1.0
+ urn:ietf:params:xml:ns:rdeEppParams-1.0
+
+
+
+
+
+
+ test
+ 2
+
+ 1
+
+ 1000
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+
+
+
+
+ example1.test
+ Dexample1-TEST
+
+ jd1234
+ sh8013
+ sh8013
+
+ ns1.example.com
+ ns1.example1.test
+
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ example2.test
+ Dexample2-TEST
+
+
+ jd1234
+ sh8013
+ sh8013
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ ns1.example.com
+ Hns1_example_com-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ ns1.example1.test
+ Hns1_example1_test-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ contact1
+ contact1-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+
+ RegistrarX
+ Registrar X
+ 123
+ ok
+
+
+ 123 Example Dr.
+
+ Suite 100
+
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ http://www.example.test
+
+
+ whois.example.test
+
+ http://whois.example.test
+
+
+ 2005-04-23T11:49:00.0Z
+ 2009-02-17T17:51:00.0Z
+
+
+
+
+
+http://www.iana.org/domains/idn-tables/tables/br_pt-br_1.0.html
+
+
+ http://registro.br/dominio/regras.html
+
+
+
+
+
+ xn--exampl-gva.test
+ pt-BR
+ example1.test
+ withheld
+ 2005-04-23T11:49:00.0Z
+
+
+
+
+ 1.0
+ en
+
+ urn:ietf:params:xml:ns:domain-1.0
+
+
+ urn:ietf:params:xml:ns:contact-1.0
+
+
+ urn:ietf:params:xml:ns:host-1.0
+
+
+ urn:ietf:params:xml:ns:rgp-1.0
+
+ urn:ietf:params:xml:ns:secDNS-1.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javatests/google/registry/rde/testdata/deposit_10_contact.xml b/javatests/google/registry/rde/testdata/deposit_10_contact.xml
new file mode 100644
index 000000000..3f16cdcb1
--- /dev/null
+++ b/javatests/google/registry/rde/testdata/deposit_10_contact.xml
@@ -0,0 +1,592 @@
+
+
+
+ 2010-10-17T00:00:00Z
+
+ 1.0
+ urn:ietf:params:xml:ns:rdeHeader-1.0
+ urn:ietf:params:xml:ns:rdeContact-1.0
+ urn:ietf:params:xml:ns:rdeHost-1.0
+ urn:ietf:params:xml:ns:rdeDomain-1.0
+ urn:ietf:params:xml:ns:rdeRegistrar-1.0
+ urn:ietf:params:xml:ns:rdeIDN-1.0
+ urn:ietf:params:xml:ns:rdeNNDN-1.0
+ urn:ietf:params:xml:ns:rdeEppParams-1.0
+
+
+
+
+
+
+ test
+ 2
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+
+
+
+
+ example1.test
+ Dexample1-TEST
+
+ jd1234
+ sh8013
+ sh8013
+
+ ns1.example.com
+ ns1.example1.test
+
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ example2.test
+ Dexample2-TEST
+
+
+ jd1234
+ sh8013
+ sh8013
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ ns1.example.com
+ Hns1_example_com-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ ns1.example1.test
+ Hns1_example1_test-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ contact1
+ contact1-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact2
+ contact2-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact3
+ contact3-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact4
+ contact4-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact5
+ contact5-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact6
+ contact6-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact7
+ contact7-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact8
+ contact8-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact9
+ contact9-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact10
+ contact10-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+
+ RegistrarX
+ Registrar X
+ 123
+ ok
+
+
+ 123 Example Dr.
+
+ Suite 100
+
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ http://www.example.test
+
+
+ whois.example.test
+
+ http://whois.example.test
+
+
+ 2005-04-23T11:49:00.0Z
+ 2009-02-17T17:51:00.0Z
+
+
+
+
+
+http://www.iana.org/domains/idn-tables/tables/br_pt-br_1.0.html
+
+
+ http://registro.br/dominio/regras.html
+
+
+
+
+
+ xn--exampl-gva.test
+ pt-BR
+ example1.test
+ withheld
+ 2005-04-23T11:49:00.0Z
+
+
+
+
+ 1.0
+ en
+
+ urn:ietf:params:xml:ns:domain-1.0
+
+
+ urn:ietf:params:xml:ns:contact-1.0
+
+
+ urn:ietf:params:xml:ns:host-1.0
+
+
+ urn:ietf:params:xml:ns:rgp-1.0
+
+ urn:ietf:params:xml:ns:secDNS-1.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javatests/google/registry/rde/testdata/deposit_199_contact_header.xml b/javatests/google/registry/rde/testdata/deposit_199_contact_header.xml
new file mode 100644
index 000000000..266450a5c
--- /dev/null
+++ b/javatests/google/registry/rde/testdata/deposit_199_contact_header.xml
@@ -0,0 +1,259 @@
+
+
+
+ 2010-10-17T00:00:00Z
+
+ 1.0
+ urn:ietf:params:xml:ns:rdeHeader-1.0
+ urn:ietf:params:xml:ns:rdeContact-1.0
+ urn:ietf:params:xml:ns:rdeHost-1.0
+ urn:ietf:params:xml:ns:rdeDomain-1.0
+ urn:ietf:params:xml:ns:rdeRegistrar-1.0
+ urn:ietf:params:xml:ns:rdeIDN-1.0
+ urn:ietf:params:xml:ns:rdeNNDN-1.0
+ urn:ietf:params:xml:ns:rdeEppParams-1.0
+
+
+
+
+
+
+ test
+ 2
+
+ 1
+
+ 199
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+
+
+
+
+ example1.test
+ Dexample1-TEST
+
+ jd1234
+ sh8013
+ sh8013
+
+ ns1.example.com
+ ns1.example1.test
+
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ example2.test
+ Dexample2-TEST
+
+
+ jd1234
+ sh8013
+ sh8013
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ ns1.example.com
+ Hns1_example_com-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ ns1.example1.test
+ Hns1_example1_test-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ contact1
+ contact1-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+
+ RegistrarX
+ Registrar X
+ 123
+ ok
+
+
+ 123 Example Dr.
+
+ Suite 100
+
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ http://www.example.test
+
+
+ whois.example.test
+
+ http://whois.example.test
+
+
+ 2005-04-23T11:49:00.0Z
+ 2009-02-17T17:51:00.0Z
+
+
+
+
+
+http://www.iana.org/domains/idn-tables/tables/br_pt-br_1.0.html
+
+
+ http://registro.br/dominio/regras.html
+
+
+
+
+
+ xn--exampl-gva.test
+ pt-BR
+ example1.test
+ withheld
+ 2005-04-23T11:49:00.0Z
+
+
+
+
+ 1.0
+ en
+
+ urn:ietf:params:xml:ns:domain-1.0
+
+
+ urn:ietf:params:xml:ns:contact-1.0
+
+
+ urn:ietf:params:xml:ns:host-1.0
+
+
+ urn:ietf:params:xml:ns:rgp-1.0
+
+ urn:ietf:params:xml:ns:secDNS-1.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javatests/google/registry/rde/testdata/deposit_1_contact.xml b/javatests/google/registry/rde/testdata/deposit_1_contact.xml
new file mode 100644
index 000000000..412004326
--- /dev/null
+++ b/javatests/google/registry/rde/testdata/deposit_1_contact.xml
@@ -0,0 +1,259 @@
+
+
+
+ 2010-10-17T00:00:00Z
+
+ 1.0
+ urn:ietf:params:xml:ns:rdeHeader-1.0
+ urn:ietf:params:xml:ns:rdeContact-1.0
+ urn:ietf:params:xml:ns:rdeHost-1.0
+ urn:ietf:params:xml:ns:rdeDomain-1.0
+ urn:ietf:params:xml:ns:rdeRegistrar-1.0
+ urn:ietf:params:xml:ns:rdeIDN-1.0
+ urn:ietf:params:xml:ns:rdeNNDN-1.0
+ urn:ietf:params:xml:ns:rdeEppParams-1.0
+
+
+
+
+
+
+ test
+ 2
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+
+
+
+
+ example1.test
+ Dexample1-TEST
+
+ jd1234
+ sh8013
+ sh8013
+
+ ns1.example.com
+ ns1.example1.test
+
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ example2.test
+ Dexample2-TEST
+
+
+ jd1234
+ sh8013
+ sh8013
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ ns1.example.com
+ Hns1_example_com-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ ns1.example1.test
+ Hns1_example1_test-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ contact1
+ contact1-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+
+ RegistrarX
+ Registrar X
+ 123
+ ok
+
+
+ 123 Example Dr.
+
+ Suite 100
+
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ http://www.example.test
+
+
+ whois.example.test
+
+ http://whois.example.test
+
+
+ 2005-04-23T11:49:00.0Z
+ 2009-02-17T17:51:00.0Z
+
+
+
+
+
+http://www.iana.org/domains/idn-tables/tables/br_pt-br_1.0.html
+
+
+ http://registro.br/dominio/regras.html
+
+
+
+
+
+ xn--exampl-gva.test
+ pt-BR
+ example1.test
+ withheld
+ 2005-04-23T11:49:00.0Z
+
+
+
+
+ 1.0
+ en
+
+ urn:ietf:params:xml:ns:domain-1.0
+
+
+ urn:ietf:params:xml:ns:contact-1.0
+
+
+ urn:ietf:params:xml:ns:host-1.0
+
+
+ urn:ietf:params:xml:ns:rgp-1.0
+
+ urn:ietf:params:xml:ns:secDNS-1.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javatests/google/registry/rde/testdata/deposit_200_contact_header.xml b/javatests/google/registry/rde/testdata/deposit_200_contact_header.xml
new file mode 100644
index 000000000..253498e6c
--- /dev/null
+++ b/javatests/google/registry/rde/testdata/deposit_200_contact_header.xml
@@ -0,0 +1,259 @@
+
+
+
+ 2010-10-17T00:00:00Z
+
+ 1.0
+ urn:ietf:params:xml:ns:rdeHeader-1.0
+ urn:ietf:params:xml:ns:rdeContact-1.0
+ urn:ietf:params:xml:ns:rdeHost-1.0
+ urn:ietf:params:xml:ns:rdeDomain-1.0
+ urn:ietf:params:xml:ns:rdeRegistrar-1.0
+ urn:ietf:params:xml:ns:rdeIDN-1.0
+ urn:ietf:params:xml:ns:rdeNNDN-1.0
+ urn:ietf:params:xml:ns:rdeEppParams-1.0
+
+
+
+
+
+
+ test
+ 2
+
+ 1
+
+ 200
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+
+
+
+
+ example1.test
+ Dexample1-TEST
+
+ jd1234
+ sh8013
+ sh8013
+
+ ns1.example.com
+ ns1.example1.test
+
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ example2.test
+ Dexample2-TEST
+
+
+ jd1234
+ sh8013
+ sh8013
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ ns1.example.com
+ Hns1_example_com-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ ns1.example1.test
+ Hns1_example1_test-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ contact1
+ contact1-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+
+ RegistrarX
+ Registrar X
+ 123
+ ok
+
+
+ 123 Example Dr.
+
+ Suite 100
+
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ http://www.example.test
+
+
+ whois.example.test
+
+ http://whois.example.test
+
+
+ 2005-04-23T11:49:00.0Z
+ 2009-02-17T17:51:00.0Z
+
+
+
+
+
+http://www.iana.org/domains/idn-tables/tables/br_pt-br_1.0.html
+
+
+ http://registro.br/dominio/regras.html
+
+
+
+
+
+ xn--exampl-gva.test
+ pt-BR
+ example1.test
+ withheld
+ 2005-04-23T11:49:00.0Z
+
+
+
+
+ 1.0
+ en
+
+ urn:ietf:params:xml:ns:domain-1.0
+
+
+ urn:ietf:params:xml:ns:contact-1.0
+
+
+ urn:ietf:params:xml:ns:host-1.0
+
+
+ urn:ietf:params:xml:ns:rgp-1.0
+
+ urn:ietf:params:xml:ns:secDNS-1.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javatests/google/registry/rde/testdata/deposit_3_contact.xml b/javatests/google/registry/rde/testdata/deposit_3_contact.xml
new file mode 100644
index 000000000..be311d374
--- /dev/null
+++ b/javatests/google/registry/rde/testdata/deposit_3_contact.xml
@@ -0,0 +1,333 @@
+
+
+
+ 2010-10-17T00:00:00Z
+
+ 1.0
+ urn:ietf:params:xml:ns:rdeHeader-1.0
+ urn:ietf:params:xml:ns:rdeContact-1.0
+ urn:ietf:params:xml:ns:rdeHost-1.0
+ urn:ietf:params:xml:ns:rdeDomain-1.0
+ urn:ietf:params:xml:ns:rdeRegistrar-1.0
+ urn:ietf:params:xml:ns:rdeIDN-1.0
+ urn:ietf:params:xml:ns:rdeNNDN-1.0
+ urn:ietf:params:xml:ns:rdeEppParams-1.0
+
+
+
+
+
+
+ test
+ 2
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+
+
+
+
+ example1.test
+ Dexample1-TEST
+
+ jd1234
+ sh8013
+ sh8013
+
+ ns1.example.com
+ ns1.example1.test
+
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ example2.test
+ Dexample2-TEST
+
+
+ jd1234
+ sh8013
+ sh8013
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ ns1.example.com
+ Hns1_example_com-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ ns1.example1.test
+ Hns1_example1_test-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ contact1
+ contact1-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact2
+ contact2-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact3
+ contact3-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+
+ RegistrarX
+ Registrar X
+ 123
+ ok
+
+
+ 123 Example Dr.
+
+ Suite 100
+
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ http://www.example.test
+
+
+ whois.example.test
+
+ http://whois.example.test
+
+
+ 2005-04-23T11:49:00.0Z
+ 2009-02-17T17:51:00.0Z
+
+
+
+
+
+http://www.iana.org/domains/idn-tables/tables/br_pt-br_1.0.html
+
+
+ http://registro.br/dominio/regras.html
+
+
+
+
+
+ xn--exampl-gva.test
+ pt-BR
+ example1.test
+ withheld
+ 2005-04-23T11:49:00.0Z
+
+
+
+
+ 1.0
+ en
+
+ urn:ietf:params:xml:ns:domain-1.0
+
+
+ urn:ietf:params:xml:ns:contact-1.0
+
+
+ urn:ietf:params:xml:ns:host-1.0
+
+
+ urn:ietf:params:xml:ns:rgp-1.0
+
+ urn:ietf:params:xml:ns:secDNS-1.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javatests/google/registry/rde/testdata/deposit_4_contact.xml b/javatests/google/registry/rde/testdata/deposit_4_contact.xml
new file mode 100644
index 000000000..ddac4dca7
--- /dev/null
+++ b/javatests/google/registry/rde/testdata/deposit_4_contact.xml
@@ -0,0 +1,370 @@
+
+
+
+ 2010-10-17T00:00:00Z
+
+ 1.0
+ urn:ietf:params:xml:ns:rdeHeader-1.0
+ urn:ietf:params:xml:ns:rdeContact-1.0
+ urn:ietf:params:xml:ns:rdeHost-1.0
+ urn:ietf:params:xml:ns:rdeDomain-1.0
+ urn:ietf:params:xml:ns:rdeRegistrar-1.0
+ urn:ietf:params:xml:ns:rdeIDN-1.0
+ urn:ietf:params:xml:ns:rdeNNDN-1.0
+ urn:ietf:params:xml:ns:rdeEppParams-1.0
+
+
+
+
+
+
+ test
+ 2
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+ 1
+
+
+
+
+
+ example1.test
+ Dexample1-TEST
+
+ jd1234
+ sh8013
+ sh8013
+
+ ns1.example.com
+ ns1.example1.test
+
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ example2.test
+ Dexample2-TEST
+
+
+ jd1234
+ sh8013
+ sh8013
+ RegistrarX
+ RegistrarX
+ 1999-04-03T22:00:00.0Z
+ 2015-04-03T22:00:00.0Z
+
+
+
+
+ ns1.example.com
+ Hns1_example_com-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ ns1.example1.test
+ Hns1_example1_test-TEST
+
+
+ 192.0.2.2
+ 192.0.2.29
+ 1080:0:0:0:8:800:200C:417A
+
+ RegistrarX
+ RegistrarX
+ 1999-05-08T12:10:00.0Z
+ RegistrarX
+ 2009-10-03T09:34:00.0Z
+
+
+
+
+ contact1
+ contact1-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact2
+ contact2-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact3
+ contact3-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+ contact4
+ contact4-TEST
+
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ RegistrarX
+ RegistrarX
+
+ 2009-09-13T08:01:00.0Z
+ RegistrarX
+
+ 2009-11-26T09:10:00.0Z
+ 2009-12-03T09:05:00.0Z
+
+
+
+
+
+
+
+
+ RegistrarX
+ Registrar X
+ 123
+ ok
+
+
+ 123 Example Dr.
+
+ Suite 100
+
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+
+ +1.7035555556
+
+ jdoe@example.test
+
+ http://www.example.test
+
+
+ whois.example.test
+
+ http://whois.example.test
+
+
+ 2005-04-23T11:49:00.0Z
+ 2009-02-17T17:51:00.0Z
+
+
+
+
+
+http://www.iana.org/domains/idn-tables/tables/br_pt-br_1.0.html
+
+
+ http://registro.br/dominio/regras.html
+
+
+
+
+
+ xn--exampl-gva.test
+ pt-BR
+ example1.test
+ withheld
+ 2005-04-23T11:49:00.0Z
+
+
+
+
+ 1.0
+ en
+
+ urn:ietf:params:xml:ns:domain-1.0
+
+
+ urn:ietf:params:xml:ns:contact-1.0
+
+
+ urn:ietf:params:xml:ns:host-1.0
+
+
+ urn:ietf:params:xml:ns:rgp-1.0
+
+ urn:ietf:params:xml:ns:secDNS-1.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+