diff --git a/javatests/google/registry/rde/imports/BUILD b/javatests/google/registry/rde/imports/BUILD new file mode 100644 index 000000000..52debc87f --- /dev/null +++ b/javatests/google/registry/rde/imports/BUILD @@ -0,0 +1,49 @@ +package( + default_testonly = 1, + default_visibility = ["//java/google/registry:registry_project"], +) + +licenses(["notice"]) # Apache 2.0 + +load("//java/com/google/testing/builddefs:GenTestRules.bzl", "GenTestRules") + +java_library( + name = "imports", + srcs = glob(["*.java"]), + resources = glob(["testdata/*"]), + deps = [ + "//java/com/google/common/base", + "//java/com/google/common/collect", + "//java/com/google/common/io", + "//java/com/google/common/net", + "//java/google/registry/config", + "//java/google/registry/gcs", + "//java/google/registry/mapreduce", + "//java/google/registry/model", + "//java/google/registry/rde/imports", + "//java/google/registry/request", + "//java/google/registry/util", + "//java/google/registry/xjc", + "//javatests/google/registry/testing", + "//javatests/google/registry/testing/mapreduce", + "//javatests/google/registry/xml", + "//third_party/java/appengine:appengine-api-testonly", + "//third_party/java/appengine_gcs_client", + "//third_party/java/dagger", + "//third_party/java/joda_time", + "//third_party/java/jsr305_annotations", + "//third_party/java/jsr330_inject", + "//third_party/java/junit", + "//third_party/java/mockito", + "//third_party/java/objectify:objectify-v4_1", + "//third_party/java/truth", + ], +) + +GenTestRules( + name = "GeneratedTestRules", + default_test_size = "medium", + shard_count = 4, + test_files = glob(["*Test.java"]), + deps = [":imports"], +) diff --git a/javatests/google/registry/rde/imports/RdeContactImportActionTest.java b/javatests/google/registry/rde/imports/RdeContactImportActionTest.java new file mode 100644 index 000000000..761df5b45 --- /dev/null +++ b/javatests/google/registry/rde/imports/RdeContactImportActionTest.java @@ -0,0 +1,99 @@ +// Copyright 2016 The Nomulus 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.imports; + +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 = + RdeImportsTestData.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 = makeDefaultRunner(); + 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/imports/RdeContactInputTest.java b/javatests/google/registry/rde/imports/RdeContactInputTest.java new file mode 100644 index 000000000..7856959e6 --- /dev/null +++ b/javatests/google/registry/rde/imports/RdeContactInputTest.java @@ -0,0 +1,262 @@ +// Copyright 2016 The Nomulus 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.imports; + +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 = + RdeImportsTestData.get("deposit_0_contact_header.xml"); + private static final ByteSource DEPOSIT_1_CONTACT = + RdeImportsTestData.get("deposit_1_contact.xml"); + private static final ByteSource DEPOSIT_199_CONTACT = + RdeImportsTestData.get("deposit_199_contact_header.xml"); + private static final ByteSource DEPOSIT_200_CONTACT = + RdeImportsTestData.get("deposit_200_contact_header.xml"); + private static final ByteSource DEPOSIT_1000_CONTACT = + RdeImportsTestData.get("deposit_1000_contact_header.xml"); + private static final ByteSource DEPOSIT_10000_CONTACT = + RdeImportsTestData.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/imports/RdeContactReaderTest.java b/javatests/google/registry/rde/imports/RdeContactReaderTest.java new file mode 100644 index 000000000..0966f54aa --- /dev/null +++ b/javatests/google/registry/rde/imports/RdeContactReaderTest.java @@ -0,0 +1,218 @@ +// Copyright 2016 The Nomulus 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.imports; + +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 = + RdeImportsTestData.get("deposit_1_contact.xml"); + private static final ByteSource DEPOSIT_3_CONTACT = + RdeImportsTestData.get("deposit_3_contact.xml"); + private static final ByteSource DEPOSIT_4_CONTACT = + RdeImportsTestData.get("deposit_4_contact.xml"); + private static final ByteSource DEPOSIT_10_CONTACT = + RdeImportsTestData.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/imports/RdeHostImportActionTest.java b/javatests/google/registry/rde/imports/RdeHostImportActionTest.java new file mode 100644 index 000000000..092ad94b2 --- /dev/null +++ b/javatests/google/registry/rde/imports/RdeHostImportActionTest.java @@ -0,0 +1,100 @@ +// Copyright 2016 The Nomulus 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.imports; + +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.host.HostResource; +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 RdeHostImportAction}. */ +@RunWith(MockitoJUnitRunner.class) +public class RdeHostImportActionTest extends MapreduceTestCase { + + private static final ByteSource DEPOSIT_1_HOST = RdeImportsTestData.get("deposit_1_host.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; + + private final Optional mapShards = Optional.absent(); + + @Before + public void before() throws Exception { + response = new FakeResponse(); + mrRunner = new MapreduceRunner(Optional.absent(), Optional.absent()); + action = new RdeHostImportAction( + mrRunner, + response, + IMPORT_BUCKET_NAME, + IMPORT_FILE_NAME, + mapShards); + } + + @Test + public void test_mapreduceSuccessfullyImportsHost() throws Exception { + pushToGcs(DEPOSIT_1_HOST); + runMapreduce(); + List hosts = ofy().load().type(HostResource.class).list(); + assertThat(hosts).hasSize(1); + checkHost(hosts.get(0)); + } + + /** Verifies that host id and ROID match expected values */ + private void checkHost(HostResource host) { + assertThat(host.getFullyQualifiedHostName()).isEqualTo("ns1.example1.test"); + assertThat(host.getRepoId()).isEqualTo("Hns1_example1_test-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/imports/RdeHostInputTest.java b/javatests/google/registry/rde/imports/RdeHostInputTest.java new file mode 100644 index 000000000..d2975d94c --- /dev/null +++ b/javatests/google/registry/rde/imports/RdeHostInputTest.java @@ -0,0 +1,276 @@ +// Copyright 2016 The Nomulus 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.imports; + +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 google.registry.testing.ExceptionRule; +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.junit.runners.JUnit4; + +/** Unit tests for {@link RdeHostInput} */ +@RunWith(JUnit4.class) +public class RdeHostInputTest { + + private static final ByteSource DEPOSIT_0_HOST = + RdeImportsTestData.get("deposit_0_host_header.xml"); + private static final ByteSource DEPOSIT_1_HOST = RdeImportsTestData.get("deposit_1_host.xml"); + private static final ByteSource DEPOSIT_199_HOST = + RdeImportsTestData.get("deposit_199_host_header.xml"); + private static final ByteSource DEPOSIT_200_HOST = + RdeImportsTestData.get("deposit_200_host_header.xml"); + private static final ByteSource DEPOSIT_1000_HOST = + RdeImportsTestData.get("deposit_1000_host_header.xml"); + private static final ByteSource DEPOSIT_10000_HOST = + RdeImportsTestData.get("deposit_10000_host_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(); + + @Rule + public final ExceptionRule thrown = new ExceptionRule(); + + /** Number of shards cannot be negative */ + @Test + public void testNegativeShards_throwsIllegalArgumentException() throws Exception { + thrown.expect(IllegalArgumentException.class, "Number of shards must be greater than zero"); + getInput(Optional.of(-1)); + } + + /** Number of shards cannot be zero */ + @Test + public void testZeroShards_throwsIllegalArgumentException() throws Exception { + thrown.expect(IllegalArgumentException.class, "Number of shards must be greater than zero"); + getInput(Optional.of(0)); + } + + /** Escrow file with zero hosts results in one reader */ + @Test + public void testZeroHostsDefaultShards_returnsOneReader() throws Exception { + pushToGcs(DEPOSIT_0_HOST); + assertNumberOfReaders(Optional.absent(), 1); + } + + /** Escrow file with zero hosts results in expected reader configuration */ + @Test + public void testZeroHostsDefaultShardsReaderConfigurations() throws Exception { + pushToGcs(DEPOSIT_0_HOST); + assertReaderConfigurations(Optional.absent(), 0, 0, 100); + } + + /** Escrow file with zero hosts and 75 shards results in one reader */ + @Test + public void testZeroHosts75Shards_returnsOneReader() throws Exception { + pushToGcs(DEPOSIT_0_HOST); + assertNumberOfReaders(Optional.of(75), 1); + } + + /** Escrow file with one host results in one reader */ + @Test + public void testOneHostDefaultShards_returnsOneReader() throws Exception { + pushToGcs(DEPOSIT_1_HOST); + assertNumberOfReaders(Optional.absent(), 1); + } + + /** Escrow file with one host results in expected reader configuration */ + @Test + public void testOneHostDefaultShardsReaderConfigurations() throws Exception { + pushToGcs(DEPOSIT_1_HOST); + assertReaderConfigurations(Optional.absent(), 0, 0, 100); + } + + /** Escrow file with one host and 75 shards results in one reader */ + @Test + public void testOneHost75Shards_returnsOneReader() throws Exception { + pushToGcs(DEPOSIT_1_HOST); + assertNumberOfReaders(Optional.of(75), 1); + } + + /** Escrow file with 199 hosts results in one reader */ + @Test + public void test199HostsDefaultShards_returnsOneReader() throws Exception { + pushToGcs(DEPOSIT_199_HOST); + assertNumberOfReaders(Optional.absent(), 1); + } + + /** Escrow file with 199 hosts results in expected reader configuration */ + @Test + public void test199HostsDefaultShardsReaderConfigurations() throws Exception { + pushToGcs(DEPOSIT_199_HOST); + assertReaderConfigurations(Optional.absent(), 0, 0, 199); + } + + /** Escrow file with 199 hosts and 75 shards results in one reader */ + @Test + public void test199Hosts75Shards_returnsOneReader() throws Exception { + pushToGcs(DEPOSIT_199_HOST); + assertNumberOfReaders(Optional.of(75), 1); + } + + /** Escrow file with 200 hosts results in two readers */ + @Test + public void test200HostsDefaultShards_returnsTwoReaders() throws Exception { + pushToGcs(DEPOSIT_200_HOST); + assertNumberOfReaders(Optional.absent(), 2); + } + + /** Escrow file with 200 hosts results in expected reader configurations */ + @Test + public void test200HostsDefaultShardsReaderConfigurations() throws Exception { + pushToGcs(DEPOSIT_200_HOST); + assertReaderConfigurations(Optional.absent(), 0, 0, 100); + assertReaderConfigurations(Optional.absent(), 1, 100, 100); + } + + /** Escrow file with 200 hosts and 75 shards results in two readers */ + @Test + public void test200Hosts75Shards_returnsOneReader() throws Exception { + pushToGcs(DEPOSIT_200_HOST); + assertNumberOfReaders(Optional.of(75), 2); + } + + /** Escrow file with 1000 hosts results in ten readers */ + @Test + public void test1000HostsDefaultShards_returns10Readers() throws Exception { + pushToGcs(DEPOSIT_1000_HOST); + assertNumberOfReaders(Optional.absent(), 10); + } + + /** Escrow file with 1000 hosts results in expected reader configurations */ + @Test + public void test1000HostsDefaultShardsReaderConfigurations() throws Exception { + pushToGcs(DEPOSIT_1000_HOST); + for (int i = 0; i < 10; i++) { + assertReaderConfigurations(Optional.absent(), i, i * 100, 100); + } + } + + /** Escrow file with 1000 hosts and 75 shards results in ten readers */ + @Test + public void test1000Hosts75Shards_returns10Readers() throws Exception { + pushToGcs(DEPOSIT_1000_HOST); + assertNumberOfReaders(Optional.of(75), 10); + } + + /** Escrow file with 10000 hosts results in 50 readers */ + @Test + public void test10000HostsDefaultShards_returns50Readers() throws Exception { + pushToGcs(DEPOSIT_10000_HOST); + assertNumberOfReaders(Optional.absent(), 50); + } + + /** Escrow file with 10000 hosts results in expected reader configurations */ + @Test + public void test10000HostsDefaultShardsReaderConfigurations() throws Exception { + pushToGcs(DEPOSIT_10000_HOST); + for (int i = 0; i < 50; i++) { + assertReaderConfigurations(Optional.absent(), i, i * 200, 200); + } + } + + /** Escrow file with 10000 hosts and 75 shards results in 75 readers */ + @Test + public void test10000Hosts75Shards_returns75Readers() throws Exception { + pushToGcs(DEPOSIT_10000_HOST); + assertNumberOfReaders(Optional.of(75), 75); + } + + /** Escrow file with 10000 hosts and 150 shards results in 100 readers */ + @Test + public void test10000Hosts150Shards_returns100Readers() throws Exception { + pushToGcs(DEPOSIT_10000_HOST); + assertNumberOfReaders(Optional.of(150), 100); + } + + /** + * Verify bucket, filename, offset and max results for a specific reader + * + * @param numberOfShards Number of desired shards ({@link Optional#absent} uses default of 50) + * @param whichReader Index of the reader in the list that is produced by the {@link RdeHostInput} + * @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 { + RdeHostInput input = getInput(numberOfShards); + List readers = input.createReaders(); + RdeHostReader reader = (RdeHostReader) 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 RdeHostInput} + * + * @param numberOfShards Number of desired shards ({@link Optional#absent} uses default of 50) + * @param expectedNumberOfReaders Expected size of the list returned + */ + private void assertNumberOfReaders(Optional numberOfShards, int expectedNumberOfReaders) + throws Exception { + RdeHostInput input = getInput(numberOfShards); + List readers = input.createReaders(); + assertThat(readers).hasSize(expectedNumberOfReaders); + } + + /** + * Creates a new testable instance of {@link RdeHostInput} + * @param mapShards Number of desired shards ({@link Optional#absent} uses default of 50) + */ + private RdeHostInput getInput(Optional mapShards) { + return new RdeHostInput(mapShards, IMPORT_BUCKET_NAME, IMPORT_FILE_NAME); + } + + /** + * Verifies the configured import bucket and file names. + */ + private void assertImportBucketAndFilename(RdeHostReader reader) { + assertThat(reader.importBucketName).isEqualTo("import-bucket"); + assertThat(reader.importFileName).isEqualTo("escrow-file.xml"); + } +} diff --git a/javatests/google/registry/rde/imports/RdeHostReaderTest.java b/javatests/google/registry/rde/imports/RdeHostReaderTest.java new file mode 100644 index 000000000..d23b25dc0 --- /dev/null +++ b/javatests/google/registry/rde/imports/RdeHostReaderTest.java @@ -0,0 +1,214 @@ +// Copyright 2016 The Nomulus 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.imports; + +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.host.HostResource; +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 RdeHostReader} */ +@RunWith(MockitoJUnitRunner.class) +public class RdeHostReaderTest { + + private static final ByteSource DEPOSIT_1_HOST = RdeImportsTestData.get("deposit_1_host.xml"); + private static final ByteSource DEPOSIT_3_HOST = RdeImportsTestData.get("deposit_3_host.xml"); + private static final ByteSource DEPOSIT_4_HOST = RdeImportsTestData.get("deposit_4_host.xml"); + private static final ByteSource DEPOSIT_10_HOST = RdeImportsTestData.get("deposit_10_host.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_HOST); + RdeHostReader reader = getReader(0, 1); + HostResource host1 = reader.next(); + checkHost(host1, "ns1.example1.test", "Hns1_example1_test-TEST"); + } + + /** Reads at most one at 0 offset 1 maxResults */ + @Test + public void testZeroOffsetOneResult_stopsAfterOne() throws Exception { + pushToGcs(DEPOSIT_3_HOST); + RdeHostReader 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_HOST); + RdeHostReader 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 hosts */ + @Test + public void testZeroOffsetThreeResult_readsThree() throws Exception { + pushToGcs(DEPOSIT_3_HOST); + RdeHostReader reader = getReader(0, 3); + checkHost(reader.next(), "ns1.example1.test", "Hns1_example1_test-TEST"); + checkHost(reader.next(), "ns1.example2.test", "Hns1_example2_test-TEST"); + checkHost(reader.next(), "ns1.example3.test", "Hns1_example3_test-TEST"); + } + + /** Stops reading at 3 maxResults */ + @Test + public void testZeroOffsetThreeResult_stopsAtThree() throws Exception { + pushToGcs(DEPOSIT_4_HOST); + RdeHostReader reader = getReader(0, 3); + for (int i = 0; i < 3; i++) { + reader.next(); + } + thrown.expect(NoSuchElementException.class); + reader.next(); + } + + /** Reads one host from file then stops at end of file */ + @Test + public void testZeroOffsetThreeResult_endOfFile() throws Exception { + pushToGcs(DEPOSIT_1_HOST); + RdeHostReader reader = getReader(0, 3); + reader.next(); + thrown.expect(NoSuchElementException.class); + reader.next(); + } + + /** Skips three hosts with offset of three */ + @Test + public void testThreeOffsetOneResult_skipsThree() throws Exception { + pushToGcs(DEPOSIT_4_HOST); + RdeHostReader reader = getReader(3, 1); + checkHost(reader.next(), "ns1.example4.test", "Hns1_example4_test-TEST"); + } + + /** Skips four hosts after advancing once at three offset, then rehydrating */ + @Test + public void testThreeOffsetTwoResult_skipsFourAfterRehydration() throws Exception { + pushToGcs(DEPOSIT_10_HOST); + RdeHostReader reader = getReader(3, 2); + reader.next(); + reader.endSlice(); + reader = cloneReader(reader); + reader.beginSlice(); + checkHost(reader.next(), "ns1.example5.test", "Hns1_example5_test-TEST"); + } + + /** Reads three at zero offset three results with rehydration in the middle */ + @Test + public void testZeroOffsetThreeResult_readsThreeWithRehydration() throws Exception { + pushToGcs(DEPOSIT_4_HOST); + RdeHostReader reader = getReader(0, 3); + checkHost(reader.next(), "ns1.example1.test", "Hns1_example1_test-TEST"); + reader.endSlice(); + reader = cloneReader(reader); + reader.beginSlice(); + checkHost(reader.next(), "ns1.example2.test", "Hns1_example2_test-TEST"); + checkHost(reader.next(), "ns1.example3.test", "Hns1_example3_test-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_HOST); + RdeHostReader 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 RdeHostReader} */ + private RdeHostReader cloneReader( + RdeHostReader 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); + RdeHostReader result = (RdeHostReader) oin.readObject(); + return result; + } + + /** Verifies that domain name and ROID match expected values */ + private void checkHost(HostResource host, String domainName, String repoId) { + assertThat(host).isNotNull(); + assertThat(host.getFullyQualifiedHostName()).isEqualTo(domainName); + assertThat(host.getRepoId()).isEqualTo(repoId); + } + + /** Gets a new {@link RdeHostReader} with specified offset and maxResults */ + private RdeHostReader getReader(int offset, int maxResults) throws Exception { + RdeHostReader reader = + new RdeHostReader(IMPORT_BUCKET_NAME, IMPORT_FILE_NAME, offset, maxResults); + reader.beginSlice(); + return reader; + } +} diff --git a/javatests/google/registry/rde/imports/RdeImportUtilsTest.java b/javatests/google/registry/rde/imports/RdeImportUtilsTest.java new file mode 100644 index 000000000..2fcf24e94 --- /dev/null +++ b/javatests/google/registry/rde/imports/RdeImportUtilsTest.java @@ -0,0 +1,284 @@ +// Copyright 2016 The Nomulus 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.imports; + +import static com.google.common.truth.Truth.assertThat; +import static google.registry.model.ofy.ObjectifyService.ofy; +import static google.registry.testing.DatastoreHelper.createTld; +import static google.registry.testing.DatastoreHelper.persistNewRegistrar; +import static google.registry.testing.DatastoreHelper.persistResource; +import static org.joda.time.DateTimeZone.UTC; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import com.google.appengine.tools.cloudstorage.GcsFilename; +import com.google.common.base.Predicate; +import com.google.common.collect.FluentIterable; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.common.io.ByteSource; +import com.googlecode.objectify.Key; +import com.googlecode.objectify.Work; +import google.registry.gcs.GcsUtils; +import google.registry.model.EppResource; +import google.registry.model.contact.ContactResource; +import google.registry.model.host.HostResource; +import google.registry.model.index.EppResourceIndex; +import google.registry.model.index.EppResourceIndexBucket; +import google.registry.model.index.ForeignKeyIndex; +import google.registry.model.registry.Registry.TldState; +import google.registry.testing.AppEngineRule; +import google.registry.testing.ExceptionRule; +import google.registry.testing.FakeClock; +import google.registry.testing.ShardableTestCase; +import java.io.IOException; +import java.io.InputStream; +import java.net.InetAddress; +import java.net.UnknownHostException; +import org.joda.time.DateTime; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; + +/** Unit tests for {@link RdeImportUtils} */ +@RunWith(MockitoJUnitRunner.class) +public class RdeImportUtilsTest extends ShardableTestCase { + + private static final ByteSource DEPOSIT_XML = RdeImportsTestData.get("deposit_full.xml"); + private static final ByteSource DEPOSIT_BADTLD_XML = + RdeImportsTestData.get("deposit_full_badtld.xml"); + private static final ByteSource DEPOSIT_GETLD_XML = + RdeImportsTestData.get("deposit_full_getld.xml"); + private static final ByteSource DEPOSIT_BADREGISTRAR_XML = + RdeImportsTestData.get("deposit_full_badregistrar.xml"); + + private InputStream xmlInput; + + @Rule + public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); + + @Rule + public final ExceptionRule thrown = new ExceptionRule(); + + @Mock + private GcsUtils gcsUtils; + + private RdeImportUtils rdeImportUtils; + private FakeClock clock; + + @Before + public void before() { + clock = new FakeClock(); + clock.setTo(DateTime.now(UTC)); + rdeImportUtils = new RdeImportUtils(ofy(), clock, "import-bucket", gcsUtils); + createTld("test", TldState.PREDELEGATION); + createTld("getld", TldState.GENERAL_AVAILABILITY); + persistNewRegistrar("RegistrarX", 1L); + } + + @After + public void after() throws IOException { + if (xmlInput != null) { + xmlInput.close(); + } + } + + /** Verifies import of a contact that has not been previously imported */ + @Test + public void testImportNewContact() { + ContactResource newContact = buildNewContact(); + assertThat(rdeImportUtils.importContact(newContact)).isTrue(); + assertEppResourceIndexEntityFor(newContact); + assertForeignKeyIndexFor(newContact); + + // verify the new contact was saved + ContactResource saved = getContact("TEST-123"); + assertThat(saved).isNotNull(); + assertThat(saved.getContactId()).isEqualTo(newContact.getContactId()); + assertThat(saved.getEmailAddress()).isEqualTo(newContact.getEmailAddress()); + assertThat(saved.getLastEppUpdateTime()).isEqualTo(newContact.getLastEppUpdateTime()); + } + + /** Verifies that a contact will not be imported more than once */ + @Test + public void testImportExistingContact() { + ContactResource newContact = buildNewContact(); + persistResource(newContact); + ContactResource updatedContact = + newContact + .asBuilder() + .setLastEppUpdateTime(newContact.getLastEppUpdateTime().plusSeconds(1)) + .build(); + assertThat(rdeImportUtils.importContact(updatedContact)).isFalse(); + + // verify the updated contact was saved + ContactResource saved = getContact("TEST-123"); + assertThat(saved).isNotNull(); + assertThat(saved.getContactId()).isEqualTo(newContact.getContactId()); + assertThat(saved.getEmailAddress()).isEqualTo(newContact.getEmailAddress()); + assertThat(saved.getLastEppUpdateTime()).isEqualTo(newContact.getLastEppUpdateTime()); + } + + /** Verifies import of a host that has not been previously imported */ + @Test + public void testImportNewHost() throws UnknownHostException { + HostResource newHost = buildNewHost(); + assertThat(rdeImportUtils.importHost(newHost)).isTrue(); + assertEppResourceIndexEntityFor(newHost); + assertForeignKeyIndexFor(newHost); + + // verify the new contact was saved + HostResource saved = getHost("FOO_ROID"); + assertThat(saved).isNotNull(); + assertThat(saved.getFullyQualifiedHostName()).isEqualTo( + newHost.getFullyQualifiedHostName()); + assertThat(saved.getInetAddresses()).isEqualTo( + newHost.getInetAddresses()); + assertThat(saved.getLastEppUpdateTime()).isEqualTo(newHost.getLastEppUpdateTime()); + } + + /** Verifies that a host will not be imported more than once */ + @Test + public void testImportExistingHost() throws UnknownHostException { + HostResource newHost = buildNewHost(); + persistResource(newHost); + HostResource updatedHost = + newHost + .asBuilder() + .setLastEppUpdateTime(newHost.getLastEppUpdateTime().plusSeconds(1)) + .build(); + assertThat(rdeImportUtils.importHost(updatedHost)).isFalse(); + + // verify the new contact was saved + HostResource saved = getHost("FOO_ROID"); + assertThat(saved).isNotNull(); + assertThat(saved.getFullyQualifiedHostName()).isEqualTo( + newHost.getFullyQualifiedHostName()); + assertThat(saved.getInetAddresses()).isEqualTo( + newHost.getInetAddresses()); + assertThat(saved.getLastEppUpdateTime()).isEqualTo(newHost.getLastEppUpdateTime()); + } + + private static ContactResource buildNewContact() { + return new ContactResource.Builder() + .setContactId("sh8013") + .setEmailAddress("jdoe@example.com") + .setLastEppUpdateTime(DateTime.parse("2010-10-10T00:00:00.000Z")) + .setRepoId("TEST-123") + .build(); + } + + private static HostResource buildNewHost() throws UnknownHostException { + return new HostResource.Builder() + .setFullyQualifiedHostName("foo.bar.example") + .setInetAddresses(ImmutableSet.of( + InetAddress.getByName("192.0.2.2"), + InetAddress.getByName("192.0.2.29"), + InetAddress.getByName("1080:0:0:0:8:800:200C:417A") + )) + .setLastEppUpdateTime(DateTime.parse("2010-10-10T00:00:00.000Z")) + .setRepoId("FOO_ROID") + .build(); + } + + /** Verifies that no errors are thrown when a valid escrow file is validated */ + @Test + @SuppressWarnings("CheckReturnValue") + public void testValidateEscrowFile_valid() throws Exception { + xmlInput = DEPOSIT_XML.openBufferedStream(); + when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput); + rdeImportUtils.validateEscrowFileForImport("valid-deposit-file.xml"); + verify(gcsUtils).openInputStream(new GcsFilename("import-bucket", "valid-deposit-file.xml")); + } + + /** Verifies thrown error when tld in escrow file is not in the registry */ + @Test + public void testValidateEscrowFile_tldNotFound() throws Exception { + xmlInput = DEPOSIT_BADTLD_XML.openBufferedStream(); + when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput); + thrown.expect(IllegalArgumentException.class, "Tld 'badtld' not found in the registry"); + rdeImportUtils.validateEscrowFileForImport("invalid-deposit-badtld.xml"); + } + + /** Verifies thrown errer when tld in escrow file is not in PREDELEGATION state */ + @Test + public void testValidateEscrowFile_tldWrongState() throws Exception { + xmlInput = DEPOSIT_GETLD_XML.openBufferedStream(); + when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput); + thrown.expect( + IllegalArgumentException.class, + "Tld 'getld' is in state GENERAL_AVAILABILITY and cannot be imported"); + rdeImportUtils.validateEscrowFileForImport("invalid-deposit-getld.xml"); + } + + /** Verifies thrown error when registrar in escrow file is not in the registry */ + @Test + public void testValidateEscrowFile_badRegistrar() throws Exception { + xmlInput = DEPOSIT_BADREGISTRAR_XML.openBufferedStream(); + when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput); + thrown.expect( + IllegalArgumentException.class, "Registrar 'RegistrarY' not found in the registry"); + rdeImportUtils.validateEscrowFileForImport("invalid-deposit-badregistrar.xml"); + } + + /** Gets the contact with the specified ROID */ + private static ContactResource getContact(String repoId) { + final Key key = Key.create(ContactResource.class, repoId); + return ofy().transact(new Work() { + @Override + public ContactResource run() { + return ofy().load().key(key).now(); + }}); + } + + /** Gets the contact with the specified ROID */ + private static HostResource getHost(String repoId) { + final Key key = Key.create(HostResource.class, repoId); + return ofy().transact(new Work() { + @Override + public HostResource run() { + return ofy().load().key(key).now(); + } + }); + } + + /** Confirms that a ForeignKeyIndex exists in the datastore for a given resource. */ + private void assertForeignKeyIndexFor(final T resource) { + assertThat(ForeignKeyIndex.load(resource.getClass(), resource.getForeignKey(), clock.nowUtc())) + .isNotNull(); + } + + /** Confirms that an EppResourceIndex entity exists in datastore for a given resource. */ + private static void assertEppResourceIndexEntityFor(final T resource) { + ImmutableList indices = FluentIterable + .from(ofy().load() + .type(EppResourceIndex.class) + .filter("kind", Key.getKind(resource.getClass()))) + .filter(new Predicate() { + @Override + public boolean apply(EppResourceIndex index) { + return ofy().load().key(index.getKey()).now().equals(resource); + }}) + .toList(); + assertThat(indices).hasSize(1); + assertThat(indices.get(0).getBucket()) + .isEqualTo(EppResourceIndexBucket.getBucketKey(Key.create(resource))); + } +} diff --git a/javatests/google/registry/rde/imports/RdeImportsTestData.java b/javatests/google/registry/rde/imports/RdeImportsTestData.java new file mode 100644 index 000000000..34bc5b5cf --- /dev/null +++ b/javatests/google/registry/rde/imports/RdeImportsTestData.java @@ -0,0 +1,44 @@ +// Copyright 2016 The Nomulus 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.imports; + +import static java.nio.charset.StandardCharsets.UTF_8; + +import com.google.common.io.ByteSource; +import com.google.common.io.Resources; +import java.io.IOException; +import java.net.URL; + +/** Utility class providing easy access to contents of the {@code testdata/} directory. */ +public final class RdeImportsTestData { + + /** Returns {@link ByteSource} for file in {@code rde/imports/testdata/} directory. */ + public static ByteSource get(String filename) { + return Resources.asByteSource(getUrl(filename)); + } + + /** + * Loads data from file in {@code rde/imports/testdata/} as a String (assuming file is UTF-8). + * + * @throws IOException if the file couldn't be loaded from the jar. + */ + public static String loadUtf8(String filename) throws IOException { + return Resources.asCharSource(getUrl(filename), UTF_8).read(); + } + + private static URL getUrl(String filename) { + return Resources.getResource(RdeImportsTestData.class, "testdata/" + filename); + } +} diff --git a/javatests/google/registry/rde/imports/RdeParserTest.java b/javatests/google/registry/rde/imports/RdeParserTest.java new file mode 100644 index 000000000..37c369056 --- /dev/null +++ b/javatests/google/registry/rde/imports/RdeParserTest.java @@ -0,0 +1,530 @@ +// Copyright 2016 The Nomulus 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.imports; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.io.ByteSource; +import google.registry.rde.imports.RdeParser.RdeHeader; +import google.registry.testing.ExceptionRule; +import google.registry.xjc.rdecontact.XjcRdeContact; +import google.registry.xjc.rdedomain.XjcRdeDomain; +import google.registry.xjc.rdeeppparams.XjcRdeEppParams; +import google.registry.xjc.rdehost.XjcRdeHost; +import google.registry.xjc.rdeidn.XjcRdeIdn; +import google.registry.xjc.rdenndn.XjcRdeNndn; +import google.registry.xjc.rderegistrar.XjcRdeRegistrar; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Unit tests for {@link RdeParser}. */ +@RunWith(JUnit4.class) +public class RdeParserTest { + + private static final ByteSource DEPOSIT_XML = RdeImportsTestData.get("deposit_full_parser.xml"); + + private InputStream xml; + + @Rule public final ExceptionRule thrown = new ExceptionRule(); + + private void checkHeader(RdeHeader header) { + assertThat(header.getTld()).isEqualTo("test"); + assertThat(header.getContactCount()).isEqualTo(1L); + assertThat(header.getDomainCount()).isEqualTo(2L); + assertThat(header.getEppParamsCount()).isEqualTo(1L); + assertThat(header.getHostCount()).isEqualTo(1L); + assertThat(header.getIdnCount()).isEqualTo(1L); + assertThat(header.getNndnCount()).isEqualTo(1L); + assertThat(header.getRegistrarCount()).isEqualTo(1L); + } + + @Before + public void before() throws IOException { + xml = new ByteArrayInputStream(DEPOSIT_XML.read()); + } + + @After + public void after() throws IOException { + xml.close(); + } + + @Test + public void testGetHeader_returnsHeader() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + checkHeader(parser.getHeader()); + } + } + + @Test + public void testGetContactNotAtElement_throwsIllegalStateException() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + thrown.expect( + IllegalStateException.class, + "Not at element urn:ietf:params:xml:ns:rdeContact-1.0:contact"); + parser.getContact(); + } + } + + @Test + public void testGetContactAtElement_returnsContact() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextContact(); + XjcRdeContact contact = parser.getContact(); + assertThat(contact.getId()).isEqualTo("sh8013"); + assertThat(contact.getClID()).isEqualTo("RegistrarX"); + } + } + + @Test + public void testNextContact_advancesParser() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.isAtContact()).isFalse(); + // there is only one contact in the escrow file + assertThat(parser.nextContact()).isTrue(); + assertThat(parser.isAtContact()).isTrue(); + assertThat(parser.nextContact()).isFalse(); + assertThat(parser.isAtContact()).isFalse(); + } + } + + @Test + public void testSkipZeroContacts_skipsZero() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.skipContacts(0)).isEqualTo(0); + assertThat(parser.nextContact()).isTrue(); + } + } + + @Test + public void testSkipOneContactFromBeginning_skipsOne() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.skipContacts(1)).isEqualTo(1); + assertThat(parser.isAtContact()).isFalse(); + } + } + + @Test + public void testSkipOneContactFromFirstContact_skipsOne() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextContact(); + assertThat(parser.skipContacts(1)).isEqualTo(1); + assertThat(parser.isAtContact()).isFalse(); + } + } + + @Test + public void testSkip9999Contacts_skipsOne() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.skipContacts(9999)).isEqualTo(1); + assertThat(parser.isAtContact()).isFalse(); + } + } + + @Test + public void testSkipContactsFromEnd_skipsZero() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextContact(); + parser.nextContact(); + assertThat(parser.skipContacts(1)).isEqualTo(0); + assertThat(parser.isAtContact()).isFalse(); + } + } + + @Test + public void testGetHeaderAfterNextContact_returnsHeader() throws Exception { + // verify that the header is still available after advancing to next contact + try (RdeParser parser = new RdeParser(xml)) { + parser.nextContact(); + checkHeader(parser.getHeader()); + } + } + + @Test + public void testGetDomainNotAtElement_throwsIllegalStateException() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + thrown.expect( + IllegalStateException.class, + "Not at element urn:ietf:params:xml:ns:rdeDomain-1.0:domain"); + parser.getDomain(); + } + } + + @Test + public void testGetDomainAtElement_returnsDomain() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextDomain(); + XjcRdeDomain domain = parser.getDomain(); + assertThat(domain.getName()).isEqualTo("example1.test"); + } + } + + @Test + public void testNextDomain_advancesParser() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + // there are 2 domains in the escrow file + assertThat(parser.isAtDomain()).isFalse(); + assertThat(parser.nextDomain()).isTrue(); + assertThat(parser.isAtDomain()).isTrue(); + assertThat(parser.nextDomain()).isTrue(); + assertThat(parser.isAtDomain()).isTrue(); + assertThat(parser.nextDomain()).isFalse(); + assertThat(parser.isAtDomain()).isFalse(); + } + } + + @Test + public void testSkipZeroDomains_skipsZero() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.skipDomains(0)).isEqualTo(0); + assertThat(parser.nextDomain()).isTrue(); + } + } + + @Test + public void testSkipOneDomainFromBeginning_skipsOne() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.skipDomains(1)).isEqualTo(1); + // there are two domains + assertThat(parser.isAtDomain()).isTrue(); + // prove that the parser advanced to the second domain + assertThat(parser.nextDomain()).isFalse(); + assertThat(parser.isAtDomain()).isFalse(); + } + } + + @Test + public void testSkipTwoDomainsFromBeginning_skipsTwo() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.skipDomains(2)).isEqualTo(2); + // there are two domains + assertThat(parser.isAtDomain()).isFalse(); + } + } + + @Test + public void testSkipOneDomainFromFirstDomain_skipsOne() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextDomain(); + assertThat(parser.skipDomains(1)).isEqualTo(1); + // there are two domains + assertThat(parser.isAtDomain()).isTrue(); + // prove that the parser advanced to the second domain + assertThat(parser.nextDomain()).isFalse(); + assertThat(parser.isAtDomain()).isFalse(); + } + } + + @Test + public void testSkipTwoDomainsFromFirstDomain_skipsTwo() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextDomain(); + assertThat(parser.skipDomains(2)).isEqualTo(2); + // there are two domains + assertThat(parser.isAtDomain()).isFalse(); + } + } + + @Test + public void testSkip9999Domains_skipsTwo() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.skipDomains(9999)).isEqualTo(2); + assertThat(parser.isAtDomain()).isFalse(); + } + } + + @Test + public void testSkipDomainsFromEnd_skipsZero() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextDomain(); + parser.nextDomain(); + parser.nextDomain(); + assertThat(parser.skipDomains(1)).isEqualTo(0); + } + } + + @Test + public void testGetHeaderAfterNextDomain_returnsHeader() throws Exception { + // verify that the header is still available after advancing to next domain + try (RdeParser parser = new RdeParser(xml)) { + parser.nextDomain(); + checkHeader(parser.getHeader()); + } + } + + @Test + public void testGetHostNotAtElement_throwsIllegalStateException() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + thrown.expect( + IllegalStateException.class, "Not at element urn:ietf:params:xml:ns:rdeHost-1.0:host"); + parser.getHost(); + } + } + + @Test + public void testGetHostAtElement_returnsHost() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextHost(); + XjcRdeHost host = parser.getHost(); + assertThat(host.getName()).isEqualTo("ns1.example.com"); + } + } + + @Test + public void testNextHost_advancesParser() throws Exception { + // the header lies, there are 2 hosts in the file + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.isAtHost()).isFalse(); + assertThat(parser.nextHost()).isTrue(); + assertThat(parser.isAtHost()).isTrue(); + assertThat(parser.nextHost()).isTrue(); + assertThat(parser.isAtHost()).isTrue(); + assertThat(parser.nextHost()).isFalse(); + assertThat(parser.isAtHost()).isFalse(); + } + } + + @Test + public void testSkipZeroHosts_skipsZero() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.skipHosts(0)).isEqualTo(0); + assertThat(parser.nextHost()).isTrue(); + } + } + + @Test + public void testSkipOneHostFromBeginning_skipsOne() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.skipHosts(1)).isEqualTo(1); + // there are two hosts + assertThat(parser.isAtHost()).isTrue(); + // prove that the parser advanced to the second host + assertThat(parser.nextHost()).isFalse(); + assertThat(parser.isAtHost()).isFalse(); + } + } + + @Test + public void testSkipTwoHostsFromBeginning_skipsTwo() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.skipHosts(2)).isEqualTo(2); + // there are two hosts + assertThat(parser.isAtHost()).isFalse(); + } + } + + @Test + public void testSkipOneHostFromFirstHost_skipsOne() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextHost(); + assertThat(parser.skipHosts(1)).isEqualTo(1); + // there are two hosts + assertThat(parser.isAtHost()).isTrue(); + // prove that the parser advanced to the second host + assertThat(parser.nextHost()).isFalse(); + assertThat(parser.isAtHost()).isFalse(); + } + } + + @Test + public void testSkipTwoHostsFromFirstHost_skipsTwo() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextHost(); + assertThat(parser.skipHosts(2)).isEqualTo(2); + // there are two hosts + assertThat(parser.isAtHost()).isFalse(); + } + } + + @Test + public void testSkip9999Hosts_skipsTwo() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.skipHosts(9999)).isEqualTo(2); + // there are two hosts + assertThat(parser.isAtHost()).isFalse(); + } + } + + @Test + public void testSkipHostFromEnd_skipsZero() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextHost(); + parser.nextHost(); + parser.nextHost(); + assertThat(parser.skipHosts(1)).isEqualTo(0); + } + } + + @Test + public void testGetHeaderAfterNextHost_returnsHeader() throws Exception { + // verify that the header is still available after advancing to next host + try (RdeParser parser = new RdeParser(xml)) { + parser.nextHost(); + checkHeader(parser.getHeader()); + } + } + + @Test + public void testGetRegistrarNotAtElement_throwsIllegalStateException() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + thrown.expect( + IllegalStateException.class, + "Not at element urn:ietf:params:xml:ns:rdeRegistrar-1.0:registrar"); + parser.getRegistrar(); + } + } + + @Test + public void testGetRegistrarAtElement_returnsRegistrar() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextRegistrar(); + XjcRdeRegistrar registrar = parser.getRegistrar(); + assertThat(registrar.getId()).isEqualTo("RegistrarX"); + assertThat(registrar.getName()).isEqualTo("Registrar X"); + } + } + + @Test + public void testNextRegistrar_advancesParser() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.isAtRegistrar()).isFalse(); + assertThat(parser.nextRegistrar()).isTrue(); + assertThat(parser.isAtRegistrar()).isTrue(); + assertThat(parser.nextRegistrar()).isFalse(); + assertThat(parser.isAtRegistrar()).isFalse(); + } + } + + @Test + public void testGetHeaderAfterNextRegistrar_returnsHeader() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextRegistrar(); + checkHeader(parser.getHeader()); + } + } + + @Test + public void testGetNndnNotAtElement_throwsIllegalStateException() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + thrown.expect( + IllegalStateException.class, "Not at element urn:ietf:params:xml:ns:rdeNNDN-1.0:NNDN"); + parser.getNndn(); + } + } + + @Test + public void testGetNndnAtElement_returnsNndn() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextNndn(); + XjcRdeNndn nndn = parser.getNndn(); + assertThat(nndn.getAName()).isEqualTo("xn--exampl-gva.test"); + } + } + + @Test + public void testNextNndn_advancesParser() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.isAtNndn()).isFalse(); + assertThat(parser.nextNndn()).isTrue(); + assertThat(parser.isAtNndn()).isTrue(); + assertThat(parser.nextNndn()).isFalse(); + assertThat(parser.isAtNndn()).isFalse(); + } + } + + @Test + public void testGetHeaderAfterNextNndn_returnsHeader() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextNndn(); + checkHeader(parser.getHeader()); + } + } + + @Test + public void testGetIdnNotAtElement_throwsIllegalStateException() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + thrown.expect( + IllegalStateException.class, + "Not at element urn:ietf:params:xml:ns:rdeIDN-1.0:idnTableRef"); + parser.getIdn(); + } + } + + @Test + public void testGetIdnAtElement_returnsIdn() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextIdn(); + XjcRdeIdn idn = parser.getIdn(); + // url contains whitespace + assertThat(idn.getUrl().trim()) + .isEqualTo("http://www.iana.org/domains/idn-tables/tables/br_pt-br_1.0.html"); + } + } + + @Test + public void testNextIdn_advancesParser() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.isAtIdn()).isFalse(); + assertThat(parser.nextIdn()).isTrue(); + assertThat(parser.isAtIdn()).isTrue(); + assertThat(parser.nextIdn()).isFalse(); + assertThat(parser.isAtIdn()).isFalse(); + } + } + + @Test + public void testGetHeaderAfterNextIdn_returnsHeader() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextIdn(); + checkHeader(parser.getHeader()); + } + } + + @Test + public void testGetEppParamsNotAtElement_throwsIllegalStateException() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + thrown.expect( + IllegalStateException.class, + "Not at element urn:ietf:params:xml:ns:rdeEppParams-1.0:eppParams"); + parser.getEppParams(); + } + } + + @Test + public void testGetEppParamsAtElement_returnsEppParams() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + parser.nextEppParams(); + XjcRdeEppParams eppParams = parser.getEppParams(); + assertThat(eppParams.getVersions()).containsExactly("1.0"); + } + } + + @Test + public void testNextEppParamsAdvancesParser() throws Exception { + try (RdeParser parser = new RdeParser(xml)) { + assertThat(parser.isAtEppParams()).isFalse(); + assertThat(parser.nextEppParams()).isTrue(); + assertThat(parser.isAtEppParams()).isTrue(); + assertThat(parser.nextEppParams()).isFalse(); + assertThat(parser.isAtEppParams()).isFalse(); + } + } +} diff --git a/javatests/google/registry/rde/imports/XjcToContactResourceConverterTest.java b/javatests/google/registry/rde/imports/XjcToContactResourceConverterTest.java new file mode 100644 index 000000000..4b346cafd --- /dev/null +++ b/javatests/google/registry/rde/imports/XjcToContactResourceConverterTest.java @@ -0,0 +1,169 @@ +// Copyright 2016 The Nomulus 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.imports; + +import static com.google.common.truth.Truth.assertThat; +import static google.registry.testing.DatastoreHelper.createTld; + +import com.google.common.io.ByteSource; +import google.registry.model.contact.ContactResource; +import google.registry.model.contact.PostalInfo; +import google.registry.model.eppcommon.StatusValue; +import google.registry.model.transfer.TransferData; +import google.registry.model.transfer.TransferStatus; +import google.registry.testing.AppEngineRule; +import google.registry.xjc.XjcXmlTransformer; +import google.registry.xjc.rdecontact.XjcRdeContact; +import google.registry.xjc.rdecontact.XjcRdeContactElement; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import javax.xml.stream.XMLInputFactory; +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; +import org.joda.time.DateTime; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class XjcToContactResourceConverterTest { + + private static final ByteSource CONTACT_XML = RdeImportsTestData.get("contact_fragment.xml"); + + @Rule + public final AppEngineRule appEngine = AppEngineRule.builder() + .withDatastore() + .build(); + + @Before + public void before() throws Exception { + createTld("xn--q9jyb4c"); + } + + @Test + public void testConvertContact() throws Exception { + XjcRdeContact contact = getContact(); + ContactResource resource = XjcToContactResourceConverter.convertContact(contact); + assertThat(resource.getContactId()).isEqualTo("love-id"); + assertThat(resource.getRepoId()).isEqualTo("2-ROID"); + assertThat(resource.getStatusValues()) + .containsExactly( + StatusValue.CLIENT_DELETE_PROHIBITED, + StatusValue.SERVER_UPDATE_PROHIBITED); + + assertThat(resource.getInternationalizedPostalInfo()).isNotNull(); + PostalInfo postalInfo = resource.getInternationalizedPostalInfo(); + assertThat(postalInfo.getName()).isEqualTo("Dipsy Doodle"); + assertThat(postalInfo.getOrg()).isEqualTo("Charleston Road Registry Incorporated"); + assertThat(postalInfo.getAddress().getStreet()).hasSize(2); + assertThat(postalInfo.getAddress().getStreet().get(0)).isEqualTo("123 Charleston Road"); + assertThat(postalInfo.getAddress().getStreet().get(1)).isEqualTo("Suite 123"); + assertThat(postalInfo.getAddress().getState()).isEqualTo("CA"); + assertThat(postalInfo.getAddress().getZip()).isEqualTo("31337"); + assertThat(postalInfo.getAddress().getCountryCode()).isEqualTo("US"); + + assertThat(resource.getLocalizedPostalInfo()).isNull(); + + assertThat(resource.getVoiceNumber()).isNotNull(); + assertThat(resource.getVoiceNumber().getPhoneNumber()).isEqualTo("+1.2126660000"); + assertThat(resource.getVoiceNumber().getExtension()).isEqualTo("123"); + + assertThat(resource.getFaxNumber()).isNotNull(); + assertThat(resource.getFaxNumber().getPhoneNumber()).isEqualTo("+1.2126660001"); + assertThat(resource.getFaxNumber().getExtension()).isNull(); + + assertThat(resource.getEmailAddress()).isEqualTo("justine@crr.com"); + assertThat(resource.getCurrentSponsorClientId()).isEqualTo("TheRegistrar"); + assertThat(resource.getCreationClientId()).isEqualTo("NewRegistrar"); + assertThat(resource.getCreationTime()).isEqualTo(DateTime.parse("1900-01-01TZ")); + assertThat(resource.getLastEppUpdateClientId()).isEqualTo("TheRegistrar"); + assertThat(resource.getLastEppUpdateTime()).isEqualTo(DateTime.parse("1930-04-20TZ")); + assertThat(resource.getLastTransferTime()).isEqualTo(DateTime.parse("1925-04-20TZ")); + + assertThat(resource.getTransferData()).isNotNull(); + assertThat(resource.getTransferData().getTransferStatus()) + .isEqualTo(TransferStatus.SERVER_APPROVED); + assertThat(resource.getTransferData().getGainingClientId()).isEqualTo("TheRegistrar"); + assertThat(resource.getTransferData().getTransferRequestTime()) + .isEqualTo(DateTime.parse("1925-04-19TZ")); + assertThat(resource.getTransferData().getLosingClientId()).isEqualTo("NewRegistrar"); + assertThat(resource.getTransferData().getPendingTransferExpirationTime()) + .isEqualTo(DateTime.parse("1925-04-21TZ")); + + assertThat(resource.getDisclose()).isNotNull(); + assertThat(resource.getDisclose().getFlag()).isTrue(); + assertThat(resource.getDisclose().getAddrs()).hasSize(1); + assertThat(resource.getDisclose().getAddrs().get(0).getType()) + .isEqualTo(PostalInfo.Type.INTERNATIONALIZED); + assertThat(resource.getDisclose().getNames()).hasSize(1); + assertThat(resource.getDisclose().getNames().get(0).getType()) + .isEqualTo(PostalInfo.Type.INTERNATIONALIZED); + assertThat(resource.getDisclose().getOrgs()).isEmpty(); + } + + @Test + public void testConvertContact_absentVoiceAndFaxNumbers() throws Exception { + XjcRdeContact contact = getContact(); + contact.setVoice(null); + contact.setFax(null); + ContactResource resource = XjcToContactResourceConverter.convertContact(contact); + assertThat(resource.getVoiceNumber()).isNull(); + assertThat(resource.getFaxNumber()).isNull(); + } + + @Test + public void testConvertContact_absentDisclose() throws Exception { + XjcRdeContact contact = getContact(); + contact.setDisclose(null); + ContactResource resource = XjcToContactResourceConverter.convertContact(contact); + assertThat(resource.getDisclose()).isNull(); + } + + @Test + public void testConvertContact_absentTransferData() throws Exception { + XjcRdeContact contact = getContact(); + contact.setTrDate(null); + contact.setTrnData(null); + ContactResource resource = XjcToContactResourceConverter.convertContact(contact); + assertThat(resource.getLastTransferTime()).isNull(); + assertThat(resource.getTransferData()).isSameAs(TransferData.EMPTY); + } + + private XjcRdeContact getContact() throws Exception { + InputStream in = null; + try { + in = CONTACT_XML.openBufferedStream(); + XMLInputFactory factory = XMLInputFactory.newInstance(); + XMLStreamReader reader = factory.createXMLStreamReader(in); + 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()); + XjcRdeContactElement element = XjcXmlTransformer.unmarshal(XjcRdeContactElement.class, bin); + return element.getValue(); + } finally { + if (in != null) { + in.close(); + } + } + } +} diff --git a/javatests/google/registry/rde/imports/XjcToDomainResourceConverterTest.java b/javatests/google/registry/rde/imports/XjcToDomainResourceConverterTest.java new file mode 100644 index 000000000..e4c93b172 --- /dev/null +++ b/javatests/google/registry/rde/imports/XjcToDomainResourceConverterTest.java @@ -0,0 +1,375 @@ +// Copyright 2016 The Nomulus 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.imports; + +import static com.google.common.io.BaseEncoding.base16; +import static com.google.common.truth.Truth.assertThat; +import static google.registry.model.ofy.ObjectifyService.ofy; +import static google.registry.testing.DatastoreHelper.createTld; +import static google.registry.testing.DatastoreHelper.getHistoryEntries; +import static google.registry.testing.DatastoreHelper.persistActiveContact; +import static google.registry.testing.DatastoreHelper.persistActiveHost; +import static google.registry.testing.DatastoreHelper.persistResource; +import static google.registry.util.DateTimeUtils.END_OF_TIME; +import static java.util.Arrays.asList; + +import com.google.common.base.Joiner; +import com.google.common.collect.ImmutableSet; +import com.google.common.io.ByteSource; +import com.googlecode.objectify.Key; +import com.googlecode.objectify.Work; +import google.registry.model.billing.BillingEvent; +import google.registry.model.billing.BillingEvent.Flag; +import google.registry.model.billing.BillingEvent.Reason; +import google.registry.model.contact.ContactResource; +import google.registry.model.domain.DesignatedContact; +import google.registry.model.domain.DomainResource; +import google.registry.model.domain.GracePeriod; +import google.registry.model.domain.rgp.GracePeriodStatus; +import google.registry.model.domain.secdns.DelegationSignerData; +import google.registry.model.eppcommon.StatusValue; +import google.registry.model.host.HostResource; +import google.registry.model.poll.PollMessage; +import google.registry.model.reporting.HistoryEntry; +import google.registry.testing.AppEngineRule; +import google.registry.testing.ExceptionRule; +import google.registry.xjc.rdedomain.XjcRdeDomain; +import google.registry.xjc.rdedomain.XjcRdeDomainElement; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import org.joda.time.DateTime; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Tests for {@link XjcToDomainResourceConverter} */ +@RunWith(JUnit4.class) +public class XjcToDomainResourceConverterTest { + + //List of packages to initialize JAXBContext + private static final String JAXB_CONTEXT_PACKAGES = Joiner.on(":").join(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")); + + @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); + + @Rule public final ExceptionRule thrown = new ExceptionRule(); + + private Unmarshaller unmarshaller; + + @Before + public void before() throws Exception { + createTld("example"); + unmarshaller = JAXBContext.newInstance(JAXB_CONTEXT_PACKAGES).createUnmarshaller(); + } + + @Test + public void testConvertDomainResource() throws Exception { + final ContactResource jd1234 = persistActiveContact("jd1234"); + final ContactResource sh8013 = persistActiveContact("sh8013"); + ImmutableSet expectedContacts = + ImmutableSet.of( + DesignatedContact.create(DesignatedContact.Type.ADMIN, Key.create(sh8013)), + DesignatedContact.create(DesignatedContact.Type.TECH, Key.create(sh8013))); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml"); + DomainResource domain = convertDomainInTransaction(xjcDomain); + assertThat(domain.getFullyQualifiedDomainName()).isEqualTo("example1.example"); + assertThat(domain.getRepoId()).isEqualTo("Dexample1-TEST"); + // A DomainResource has status INACTIVE if there are no nameservers. + assertThat(domain.getStatusValues()).isEqualTo(ImmutableSet.of(StatusValue.INACTIVE)); + assertThat(domain.getRegistrant().getName()).isEqualTo(jd1234.getRepoId()); + assertThat(domain.getContacts()).isEqualTo(expectedContacts); + assertThat(domain.getCurrentSponsorClientId()).isEqualTo("RegistrarX"); + assertThat(domain.getCreationClientId()).isEqualTo("RegistrarX"); + assertThat(domain.getCreationTime()).isEqualTo(DateTime.parse("1999-04-03T22:00:00.0Z")); + assertThat(domain.getRegistrationExpirationTime()) + .isEqualTo(DateTime.parse("2015-04-03T22:00:00.0Z")); + assertThat(domain.getGracePeriods()).isEmpty(); + assertThat(domain.getLastEppUpdateClientId()).isNull(); + assertThat(domain.getLastEppUpdateTime()).isNull(); + } + + @Test + public void testConvertDomainResourceAddPeriod() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_addPeriod.xml"); + DomainResource domain = convertDomainInTransaction(xjcDomain); + assertThat(domain.getGracePeriods()).hasSize(1); + GracePeriod gracePeriod = domain.getGracePeriods().asList().get(0); + assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.ADD); + assertThat(gracePeriod.getClientId()).isEqualTo(xjcDomain.getCrRr().getClient()); + assertThat(gracePeriod.getExpirationTime()).isEqualTo(xjcDomain.getCrDate().plusDays(5)); + } + + @Test + public void testConvertDomainResourceAutoRenewPeriod() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_autoRenewPeriod.xml"); + DomainResource domain = convertDomainInTransaction(xjcDomain); + assertThat(domain.getGracePeriods()).hasSize(1); + GracePeriod gracePeriod = domain.getGracePeriods().asList().get(0); + assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.AUTO_RENEW); + assertThat(gracePeriod.getClientId()).isEqualTo(xjcDomain.getClID()); + assertThat(gracePeriod.getExpirationTime()).isEqualTo(xjcDomain.getUpDate().plusDays(45)); + } + + @Test + public void testConvertDomainResourceRedemptionPeriod() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_redemptionPeriod.xml"); + DomainResource domain = convertDomainInTransaction(xjcDomain); + assertThat(domain.getGracePeriods()).hasSize(1); + GracePeriod gracePeriod = domain.getGracePeriods().asList().get(0); + assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.REDEMPTION); + assertThat(gracePeriod.getClientId()).isEqualTo(xjcDomain.getClID()); + assertThat(gracePeriod.getExpirationTime()).isEqualTo(xjcDomain.getUpDate().plusDays(30)); + } + + @Test + public void testConvertDomainResourceRenewPeriod() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_renewPeriod.xml"); + DomainResource domain = convertDomainInTransaction(xjcDomain); + assertThat(domain.getGracePeriods()).hasSize(1); + GracePeriod gracePeriod = domain.getGracePeriods().asList().get(0); + assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.RENEW); + assertThat(gracePeriod.getClientId()).isEqualTo(xjcDomain.getClID()); + assertThat(gracePeriod.getExpirationTime()).isEqualTo(xjcDomain.getUpDate().plusDays(5)); + } + + @Test + public void testConvertDomainResourcePendingDeletePeriod() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_pendingDeletePeriod.xml"); + DomainResource domain = convertDomainInTransaction(xjcDomain); + assertThat(domain.getGracePeriods()).hasSize(1); + GracePeriod gracePeriod = domain.getGracePeriods().asList().get(0); + assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.PENDING_DELETE); + assertThat(gracePeriod.getClientId()).isEqualTo(xjcDomain.getClID()); + assertThat(gracePeriod.getExpirationTime()).isEqualTo(xjcDomain.getUpDate().plusDays(5)); + } + + @Test + public void testConvertDomainResourcePendingRestorePeriodUnsupported() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_pendingRestorePeriod.xml"); + thrown.expect( + IllegalArgumentException.class, "Unsupported grace period status: PENDING_RESTORE"); + convertDomainInTransaction(xjcDomain); + } + + @Test + public void testConvertDomainResourceTransferPeriod() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_transferPeriod.xml"); + DomainResource domain = convertDomainInTransaction(xjcDomain); + assertThat(domain.getGracePeriods()).hasSize(1); + GracePeriod gracePeriod = domain.getGracePeriods().asList().get(0); + assertThat(gracePeriod.getType()).isEqualTo(GracePeriodStatus.TRANSFER); + assertThat(gracePeriod.getClientId()).isEqualTo(xjcDomain.getClID()); + assertThat(gracePeriod.getExpirationTime()).isEqualTo(xjcDomain.getUpDate().plusDays(5)); + } + + @Test + public void testConvertDomainResourceEppUpdateRegistrar() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_up_rr.xml"); + DomainResource domain = convertDomainInTransaction(xjcDomain); + assertThat(domain.getLastEppUpdateClientId()).isEqualTo("RegistrarX"); + } + + @Test + public void testConvertDomainResourceWithHostObjs() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + HostResource host1 = persistActiveHost("ns1.example.net"); + HostResource host2 = persistActiveHost("ns2.example.net"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_host_objs.xml"); + DomainResource domain = convertDomainInTransaction(xjcDomain); + assertThat(domain.getNameservers()).containsExactly(Key.create(host1), Key.create(host2)); + } + + @Test + public void testConvertDomainResourceWithHostAttrs() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + persistActiveHost("ns1.example.net"); + persistActiveHost("ns2.example.net"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_host_attrs.xml"); + thrown.expect(IllegalArgumentException.class, "Host attributes are not yet supported"); + convertDomainInTransaction(xjcDomain); + } + + @Test + public void testConvertDomainResourceHostNotFound() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + persistActiveHost("ns1.example.net"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_host_objs.xml"); + thrown.expect( + IllegalStateException.class, "HostResource not found with name 'ns2.example.net'"); + convertDomainInTransaction(xjcDomain); + } + + @Test + public void testConvertDomainResourceRegistrantNotFound() throws Exception { + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml"); + thrown.expect(IllegalStateException.class, "Registrant not found: 'jd1234'"); + convertDomainInTransaction(xjcDomain); + } + + @Test + public void testConvertDomainResourceRegistrantMissing() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_registrant_missing.xml"); + thrown.expect( + IllegalArgumentException.class, "Registrant is missing for domain 'example1.example'"); + convertDomainInTransaction(xjcDomain); + } + + @Test + public void testConvertDomainResourceAdminNotFound() throws Exception { + persistActiveContact("jd1234"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml"); + thrown.expect(IllegalStateException.class, "Contact not found: 'sh8013'"); + convertDomainInTransaction(xjcDomain); + } + + @Test + public void testConvertDomainResourceSecDnsData() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_secdns.xml"); + DomainResource domain = convertDomainInTransaction(xjcDomain); + byte[] digest = + base16().decode("5FA1FA1C2F70AA483FE178B765D82B272072B4E4167902C5B7F97D46C8899F44"); + assertThat(domain.getDsData()).containsExactly(DelegationSignerData.create(4609, 8, 2, digest)); + } + + @Test + public void testConvertDomainResourceHistoryEntry() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml"); + // First import in a transaction, then verify in another transaction. + // Ancestor queries don't work within the same transaction. + DomainResource domain = persistResource(convertDomainInTransaction(xjcDomain)); + List historyEntries = getHistoryEntries(domain); + assertThat(historyEntries).hasSize(1); + HistoryEntry entry = historyEntries.get(0); + assertThat(entry.getType()).isEqualTo(HistoryEntry.Type.RDE_IMPORT); + assertThat(entry.getClientId()).isEqualTo(xjcDomain.getClID()); + assertThat(entry.getBySuperuser()).isTrue(); + assertThat(entry.getReason()).isEqualTo("RDE Import"); + assertThat(entry.getRequestedByRegistrar()).isFalse(); + // check xml against original domain xml + try (InputStream ins = new ByteArrayInputStream(entry.getXmlBytes())) { + XjcRdeDomain unmarshalledXml = ((XjcRdeDomainElement) unmarshaller.unmarshal(ins)).getValue(); + assertThat(unmarshalledXml.getName()).isEqualTo(xjcDomain.getName()); + assertThat(unmarshalledXml.getRoid()).isEqualTo(xjcDomain.getRoid()); + } + } + + @Test + public void testConvertDomainResourceAutoRenewBillingEvent() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml"); + // First import in a transaction, then verify in another transaction. + // Ancestor queries don't work within the same transaction. + DomainResource domain = persistResource(convertDomainInTransaction(xjcDomain)); + List historyEntries = getHistoryEntries(domain); + assertThat(historyEntries).hasSize(1); + HistoryEntry entry = historyEntries.get(0); + List billingEvents = + ofy().load().type(BillingEvent.Recurring.class).ancestor(entry).list(); + assertThat(billingEvents).hasSize(1); + BillingEvent.Recurring autoRenewEvent = billingEvents.get(0); + assertThat(autoRenewEvent.getReason()).isEqualTo(Reason.RENEW); + assertThat(autoRenewEvent.getFlags()).isEqualTo(ImmutableSet.of(Flag.AUTO_RENEW)); + assertThat(autoRenewEvent.getTargetId()).isEqualTo(xjcDomain.getRoid()); + assertThat(autoRenewEvent.getClientId()).isEqualTo(xjcDomain.getClID()); + assertThat(autoRenewEvent.getEventTime()).isEqualTo(xjcDomain.getExDate()); + assertThat(autoRenewEvent.getRecurrenceEndTime()).isEqualTo(END_OF_TIME); + } + + @Test + public void testConvertDomainResourceAutoRenewPollMessage() throws Exception { + persistActiveContact("jd1234"); + persistActiveContact("sh8013"); + final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml"); + // First import in a transaction, then verify in another transaction. + // Ancestor queries don't work within the same transaction. + DomainResource domain = persistResource(convertDomainInTransaction(xjcDomain)); + List historyEntries = getHistoryEntries(domain); + assertThat(historyEntries).hasSize(1); + HistoryEntry entry = historyEntries.get(0); + List pollMessages = ofy().load().type(PollMessage.class).ancestor(entry).list(); + assertThat(pollMessages).hasSize(1); + PollMessage pollMessage = pollMessages.get(0); + assertThat(pollMessage).isInstanceOf(PollMessage.Autorenew.class); + assertThat(((PollMessage.Autorenew) pollMessage).getTargetId()).isEqualTo(xjcDomain.getRoid()); + assertThat(pollMessage.getClientId()).isEqualTo(xjcDomain.getClID()); + assertThat(pollMessage.getEventTime()).isEqualTo(xjcDomain.getExDate()); + assertThat(pollMessage.getMsg()).isEqualTo("Domain was auto-renewed."); + } + + private static DomainResource convertDomainInTransaction(final XjcRdeDomain xjcDomain) { + return ofy().transact(new Work() { + @Override + public DomainResource run() { + return XjcToDomainResourceConverter.convertDomain(xjcDomain); + }}); + } + + private XjcRdeDomain loadDomainFromRdeXml(String filename) { + try { + ByteSource source = RdeImportsTestData.get(filename); + try (InputStream ins = source.openStream()) { + return ((XjcRdeDomainElement) unmarshaller.unmarshal(ins)).getValue(); + } + } catch (JAXBException | IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/javatests/google/registry/rde/imports/XjcToHostResourceConverterTest.java b/javatests/google/registry/rde/imports/XjcToHostResourceConverterTest.java new file mode 100644 index 000000000..348c70551 --- /dev/null +++ b/javatests/google/registry/rde/imports/XjcToHostResourceConverterTest.java @@ -0,0 +1,117 @@ +// Copyright 2016 The Nomulus 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.imports; + +import static com.google.common.truth.Truth.assertThat; +import static google.registry.testing.DatastoreHelper.createTld; + +import com.google.appengine.repackaged.com.google.common.net.InetAddresses; +import com.google.common.base.Joiner; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.common.io.ByteSource; +import google.registry.model.eppcommon.StatusValue; +import google.registry.model.host.HostResource; +import google.registry.testing.AppEngineRule; +import google.registry.xjc.rdehost.XjcRdeHost; +import google.registry.xjc.rdehost.XjcRdeHostElement; +import java.io.InputStream; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Unmarshaller; +import org.joda.time.DateTime; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** + * Unit tests for {@link XjcToHostResourceConverter} + */ +@RunWith(JUnit4.class) +public class XjcToHostResourceConverterTest { + + private static final ByteSource HOST_XML = RdeImportsTestData.get("host_fragment.xml"); + + //List of packages to initialize JAXBContext + private static final String JAXB_CONTEXT_PACKAGES = Joiner.on(":") + .join(ImmutableList.of( + "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")); + + @Rule + public final AppEngineRule appEngine = AppEngineRule.builder() + .withDatastore() + .build(); + + private Unmarshaller unmarshaller; + + @Before + public void before() throws Exception { + createTld("example"); + unmarshaller = JAXBContext.newInstance(JAXB_CONTEXT_PACKAGES) + .createUnmarshaller(); + } + + @Test + public void testConvertHostResource() throws Exception { + XjcRdeHost xjcHost = getHost(); + HostResource host = XjcToHostResourceConverter.convert(xjcHost); + assertThat(host.getFullyQualifiedHostName()).isEqualTo("ns1.example1.test"); + assertThat(host.getRepoId()).isEqualTo("Hns1_example1_test-TEST"); + assertThat(host.getStatusValues()) + .isEqualTo(ImmutableSet.of(StatusValue.OK, StatusValue.LINKED)); + assertThat(host.getInetAddresses()).isEqualTo( + ImmutableSet.of( + InetAddresses.forString("192.0.2.2"), + InetAddresses.forString("192.0.2.29"), + InetAddresses.forString("1080:0:0:0:8:800:200C:417A"))); + assertThat(host.getCurrentSponsorClientId()).isEqualTo("RegistrarX"); + assertThat(host.getCreationClientId()).isEqualTo("RegistrarX"); + assertThat(host.getCreationTime()).isEqualTo(DateTime.parse("1999-05-08T12:10:00.0Z")); + assertThat(host.getLastEppUpdateClientId()).isEqualTo("RegistrarX"); + assertThat(host.getLastEppUpdateTime()).isEqualTo(DateTime.parse("2009-10-03T09:34:00.0Z")); + assertThat(host.getLastTransferTime()).isEqualTo(DateTime.parse("2008-10-03T09:34:00.0Z")); + } + + // included to pass the round-robin sharding filter + @Test + public void testNothing1() {} + + // included to pass the round-robin sharding filter + @Test + public void testNothing2() {} + + // included to pass the round-robin sharding filter + @Test + public void testNothing3() {} + + private XjcRdeHost getHost() throws Exception { + try (InputStream ins = HOST_XML.openStream()) { + return ((XjcRdeHostElement) unmarshaller.unmarshal(ins)).getValue(); + } + } +} diff --git a/javatests/google/registry/rde/imports/testdata/contact_fragment.xml b/javatests/google/registry/rde/imports/testdata/contact_fragment.xml new file mode 100644 index 000000000..be8a13f07 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/contact_fragment.xml @@ -0,0 +1,40 @@ + + love-id + 2-ROID + + + + Dipsy Doodle + Charleston Road Registry Incorporated + + 123 Charleston Road + Suite 123 + Mountain View + CA + 31337 + US + + + +1.2126660000 + +1.2126660001 + justine@crr.com + TheRegistrar + NewRegistrar + 1900-01-01T00:00:00Z + TheRegistrar + 1930-04-20T00:00:00Z + 1925-04-20T00:00:00Z + + serverApproved + TheRegistrar + 1925-04-19T00:00:00Z + NewRegistrar + 1925-04-21T00:00:00Z + + + + + + diff --git a/javatests/google/registry/rde/imports/testdata/deposit_0_contact_header.xml b/javatests/google/registry/rde/imports/testdata/deposit_0_contact_header.xml new file mode 100644 index 000000000..7951dee38 --- /dev/null +++ b/javatests/google/registry/rde/imports/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/imports/testdata/deposit_0_host_header.xml b/javatests/google/registry/rde/imports/testdata/deposit_0_host_header.xml new file mode 100644 index 000000000..adb8768c1 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_0_host_header.xml @@ -0,0 +1,242 @@ + + + + 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 + + 0 + + 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.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/imports/testdata/deposit_10000_contact_header.xml b/javatests/google/registry/rde/imports/testdata/deposit_10000_contact_header.xml new file mode 100644 index 000000000..bfa76283c --- /dev/null +++ b/javatests/google/registry/rde/imports/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/imports/testdata/deposit_10000_host_header.xml b/javatests/google/registry/rde/imports/testdata/deposit_10000_host_header.xml new file mode 100644 index 000000000..4e39e5b95 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_10000_host_header.xml @@ -0,0 +1,242 @@ + + + + 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 + + 10000 + + 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.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/imports/testdata/deposit_1000_contact_header.xml b/javatests/google/registry/rde/imports/testdata/deposit_1000_contact_header.xml new file mode 100644 index 000000000..f8dd81604 --- /dev/null +++ b/javatests/google/registry/rde/imports/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/imports/testdata/deposit_1000_host_header.xml b/javatests/google/registry/rde/imports/testdata/deposit_1000_host_header.xml new file mode 100644 index 000000000..d499788b5 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_1000_host_header.xml @@ -0,0 +1,242 @@ + + + + 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 + + 1000 + + 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.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/imports/testdata/deposit_10_contact.xml b/javatests/google/registry/rde/imports/testdata/deposit_10_contact.xml new file mode 100644 index 000000000..3f16cdcb1 --- /dev/null +++ b/javatests/google/registry/rde/imports/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/imports/testdata/deposit_10_host.xml b/javatests/google/registry/rde/imports/testdata/deposit_10_host.xml new file mode 100644 index 000000000..e42b72404 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_10_host.xml @@ -0,0 +1,395 @@ + + + + 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 + + 3 + + 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.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 + + + + + ns1.example2.test + Hns1_example2_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 + + + + + ns1.example3.test + Hns1_example3_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 + + + + + ns1.example4.test + Hns1_example4_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 + + + + + ns1.example5.test + Hns1_example5_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 + + + + + ns1.example6.test + Hns1_example6_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 + + + + + ns1.example7.test + Hns1_example7_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 + + + + + ns1.example8.test + Hns1_example8_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 + + + + + ns1.example9.test + Hns1_example9_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 + + + + + ns1.example10.test + Hns1_example10_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/imports/testdata/deposit_199_contact_header.xml b/javatests/google/registry/rde/imports/testdata/deposit_199_contact_header.xml new file mode 100644 index 000000000..266450a5c --- /dev/null +++ b/javatests/google/registry/rde/imports/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/imports/testdata/deposit_199_host_header.xml b/javatests/google/registry/rde/imports/testdata/deposit_199_host_header.xml new file mode 100644 index 000000000..eb9d2156b --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_199_host_header.xml @@ -0,0 +1,242 @@ + + + + 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 + + 199 + + 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.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/imports/testdata/deposit_1_contact.xml b/javatests/google/registry/rde/imports/testdata/deposit_1_contact.xml new file mode 100644 index 000000000..412004326 --- /dev/null +++ b/javatests/google/registry/rde/imports/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/imports/testdata/deposit_1_host.xml b/javatests/google/registry/rde/imports/testdata/deposit_1_host.xml new file mode 100644 index 000000000..dba51527a --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_1_host.xml @@ -0,0 +1,242 @@ + + + + 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.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/imports/testdata/deposit_200_contact_header.xml b/javatests/google/registry/rde/imports/testdata/deposit_200_contact_header.xml new file mode 100644 index 000000000..253498e6c --- /dev/null +++ b/javatests/google/registry/rde/imports/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/imports/testdata/deposit_200_host_header.xml b/javatests/google/registry/rde/imports/testdata/deposit_200_host_header.xml new file mode 100644 index 000000000..289662150 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_200_host_header.xml @@ -0,0 +1,242 @@ + + + + 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 + + 200 + + 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.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/imports/testdata/deposit_3_contact.xml b/javatests/google/registry/rde/imports/testdata/deposit_3_contact.xml new file mode 100644 index 000000000..be311d374 --- /dev/null +++ b/javatests/google/registry/rde/imports/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/imports/testdata/deposit_3_host.xml b/javatests/google/registry/rde/imports/testdata/deposit_3_host.xml new file mode 100644 index 000000000..4cf7159e4 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_3_host.xml @@ -0,0 +1,276 @@ + + + + 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 + + 3 + + 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.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 + + + + + ns1.example2.test + Hns1_example2_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 + + + + + ns1.example3.test + Hns1_example3_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/imports/testdata/deposit_4_contact.xml b/javatests/google/registry/rde/imports/testdata/deposit_4_contact.xml new file mode 100644 index 000000000..ddac4dca7 --- /dev/null +++ b/javatests/google/registry/rde/imports/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 + + + + + + + + + + + + + + + + + + + + + + diff --git a/javatests/google/registry/rde/imports/testdata/deposit_4_host.xml b/javatests/google/registry/rde/imports/testdata/deposit_4_host.xml new file mode 100644 index 000000000..4b49d10b7 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_4_host.xml @@ -0,0 +1,293 @@ + + + + 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 + + 3 + + 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.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 + + + + + ns1.example2.test + Hns1_example2_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 + + + + + ns1.example3.test + Hns1_example3_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 + + + + + ns1.example4.test + Hns1_example4_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/imports/testdata/deposit_full.xml b/javatests/google/registry/rde/imports/testdata/deposit_full.xml new file mode 100644 index 000000000..70f607571 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_full.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 + + + + + sh8013 + Csh8013-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/imports/testdata/deposit_full_badregistrar.xml b/javatests/google/registry/rde/imports/testdata/deposit_full_badregistrar.xml new file mode 100644 index 000000000..17d6f183d --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_full_badregistrar.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 + + + + + sh8013 + Csh8013-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 + + + + + + + + + RegistrarY + Registrar Y + 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/imports/testdata/deposit_full_badtld.xml b/javatests/google/registry/rde/imports/testdata/deposit_full_badtld.xml new file mode 100644 index 000000000..e2eab56ae --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_full_badtld.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 + + + + + + + badtld + 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 + + + + + sh8013 + Csh8013-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/imports/testdata/deposit_full_getld.xml b/javatests/google/registry/rde/imports/testdata/deposit_full_getld.xml new file mode 100644 index 000000000..7f7f5138b --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_full_getld.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 + + + + + + + getld + 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 + + + + + sh8013 + Csh8013-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/imports/testdata/deposit_full_parser.xml b/javatests/google/registry/rde/imports/testdata/deposit_full_parser.xml new file mode 100644 index 000000000..70f607571 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/deposit_full_parser.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 + + + + + sh8013 + Csh8013-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/imports/testdata/domain_fragment.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment.xml new file mode 100644 index 000000000..39940b8a3 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment.xml @@ -0,0 +1,14 @@ + + example1.example + Dexample1-TEST + + jd1234 + sh8013 + sh8013 + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + diff --git a/javatests/google/registry/rde/imports/testdata/domain_fragment_addPeriod.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment_addPeriod.xml new file mode 100644 index 000000000..f920a832e --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment_addPeriod.xml @@ -0,0 +1,15 @@ + + example1.example + Dexample1-TEST + + + jd1234 + sh8013 + sh8013 + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + diff --git a/javatests/google/registry/rde/imports/testdata/domain_fragment_autoRenewPeriod.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment_autoRenewPeriod.xml new file mode 100644 index 000000000..ee7244db1 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment_autoRenewPeriod.xml @@ -0,0 +1,16 @@ + + example1.example + Dexample1-TEST + + + jd1234 + sh8013 + sh8013 + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + 2014-04-03T22:00:00.0Z + diff --git a/javatests/google/registry/rde/imports/testdata/domain_fragment_host_attrs.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment_host_attrs.xml new file mode 100644 index 000000000..7c6005ccd --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment_host_attrs.xml @@ -0,0 +1,26 @@ + + example1.example + Dexample1-TEST + + jd1234 + sh8013 + sh8013 + + + ns1.example.net + 192.0.2.2 + 1080:0:0:0:8:800:200C:417A + + + ns2.example.net + + + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + diff --git a/javatests/google/registry/rde/imports/testdata/domain_fragment_host_objs.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment_host_objs.xml new file mode 100644 index 000000000..9395c05d7 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment_host_objs.xml @@ -0,0 +1,18 @@ + + example1.example + Dexample1-TEST + + jd1234 + sh8013 + sh8013 + + ns1.example.net + ns2.example.net + + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + diff --git a/javatests/google/registry/rde/imports/testdata/domain_fragment_pendingDeletePeriod.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment_pendingDeletePeriod.xml new file mode 100644 index 000000000..cbd4cf742 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment_pendingDeletePeriod.xml @@ -0,0 +1,16 @@ + + example1.example + Dexample1-TEST + + + jd1234 + sh8013 + sh8013 + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + 2014-04-03T22:00:00.0Z + diff --git a/javatests/google/registry/rde/imports/testdata/domain_fragment_pendingRestorePeriod.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment_pendingRestorePeriod.xml new file mode 100644 index 000000000..1834ff004 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment_pendingRestorePeriod.xml @@ -0,0 +1,16 @@ + + example1.example + Dexample1-TEST + + + jd1234 + sh8013 + sh8013 + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + 2014-04-03T22:00:00.0Z + diff --git a/javatests/google/registry/rde/imports/testdata/domain_fragment_redemptionPeriod.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment_redemptionPeriod.xml new file mode 100644 index 000000000..11c34817f --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment_redemptionPeriod.xml @@ -0,0 +1,16 @@ + + example1.example + Dexample1-TEST + + + jd1234 + sh8013 + sh8013 + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + 2014-04-03T22:00:00.0Z + diff --git a/javatests/google/registry/rde/imports/testdata/domain_fragment_registrant_missing.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment_registrant_missing.xml new file mode 100644 index 000000000..b3c778dd3 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment_registrant_missing.xml @@ -0,0 +1,13 @@ + + example1.example + Dexample1-TEST + + sh8013 + sh8013 + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + diff --git a/javatests/google/registry/rde/imports/testdata/domain_fragment_renewPeriod.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment_renewPeriod.xml new file mode 100644 index 000000000..2ca5714e3 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment_renewPeriod.xml @@ -0,0 +1,16 @@ + + example1.example + Dexample1-TEST + + + jd1234 + sh8013 + sh8013 + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + 2014-04-03T22:00:00.0Z + diff --git a/javatests/google/registry/rde/imports/testdata/domain_fragment_secdns.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment_secdns.xml new file mode 100644 index 000000000..db7200412 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment_secdns.xml @@ -0,0 +1,23 @@ + + example1.example + Dexample1-TEST + + jd1234 + sh8013 + sh8013 + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + + + 4609 + 8 + 2 + 5FA1FA1C2F70AA483FE178B765D82B272072B4E4167902C5B7F97D46C8899F44 + + + diff --git a/javatests/google/registry/rde/imports/testdata/domain_fragment_transferPeriod.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment_transferPeriod.xml new file mode 100644 index 000000000..41661bb23 --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment_transferPeriod.xml @@ -0,0 +1,24 @@ + + example1.example + Dexample1-TEST + + + jd1234 + sh8013 + sh8013 + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + 2014-04-03T22:00:00.0Z + + clientApproved + RegistrarX + 2014-10-08T16:23:21.897803Z + RegistrarY + 2014-10-09T08:25:43.305554Z + 2017-08-07T18:05:14.039016Z + + diff --git a/javatests/google/registry/rde/imports/testdata/domain_fragment_up_rr.xml b/javatests/google/registry/rde/imports/testdata/domain_fragment_up_rr.xml new file mode 100644 index 000000000..dac24751c --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/domain_fragment_up_rr.xml @@ -0,0 +1,16 @@ + + example1.example + Dexample1-TEST + + jd1234 + sh8013 + sh8013 + RegistrarX + RegistrarX + RegistrarX + 1999-04-03T22:00:00.0Z + 2015-04-03T22:00:00.0Z + 2014-04-03T22:00:00.0Z + diff --git a/javatests/google/registry/rde/imports/testdata/host_fragment.xml b/javatests/google/registry/rde/imports/testdata/host_fragment.xml new file mode 100644 index 000000000..0a9856a7d --- /dev/null +++ b/javatests/google/registry/rde/imports/testdata/host_fragment.xml @@ -0,0 +1,15 @@ + + 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 + 2008-10-03T09:34:00.0Z +