mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Make name and address fields required on Registrar
The absence of these fields causes RDE failures, so they are in effect required on any functioning registry system. We are currently experiencing problems in sandbox caused by null values on these fields. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=155474895
This commit is contained in:
parent
5313ca58d6
commit
ef1487cb57
18 changed files with 460 additions and 272 deletions
|
@ -32,6 +32,7 @@ import static google.registry.model.ofy.Ofy.RECOMMENDED_MEMCACHE_EXPIRATION;
|
||||||
import static google.registry.model.registry.Registries.assertTldsExist;
|
import static google.registry.model.registry.Registries.assertTldsExist;
|
||||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableSortedCopy;
|
import static google.registry.util.CollectionUtils.nullToEmptyImmutableSortedCopy;
|
||||||
|
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||||
import static google.registry.util.X509Utils.getCertificateHash;
|
import static google.registry.util.X509Utils.getCertificateHash;
|
||||||
import static google.registry.util.X509Utils.loadCertificate;
|
import static google.registry.util.X509Utils.loadCertificate;
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
@ -849,7 +850,11 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
|
||||||
/** Build the registrar, nullifying empty fields. */
|
/** Build the registrar, nullifying empty fields. */
|
||||||
@Override
|
@Override
|
||||||
public Registrar build() {
|
public Registrar build() {
|
||||||
checkNotNull(getInstance().type, "Registrar type cannot be null");
|
checkArgumentNotNull(getInstance().type, "Registrar type cannot be null");
|
||||||
|
checkArgumentNotNull(getInstance().registrarName, "Registrar name cannot be null");
|
||||||
|
checkArgument(
|
||||||
|
getInstance().localizedAddress != null || getInstance().internationalizedAddress != null,
|
||||||
|
"Must specify at least one of localized or internationalized address");
|
||||||
checkArgument(getInstance().type.isValidIanaId(getInstance().ianaIdentifier),
|
checkArgument(getInstance().type.isValidIanaId(getInstance().ianaIdentifier),
|
||||||
String.format("Supplied IANA ID is not valid for %s registrar type: %s",
|
String.format("Supplied IANA ID is not valid for %s registrar type: %s",
|
||||||
getInstance().type, getInstance().ianaIdentifier));
|
getInstance().type, getInstance().ianaIdentifier));
|
||||||
|
@ -860,6 +865,7 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
|
||||||
/** Load a registrar entity by its client id outside of a transaction. */
|
/** Load a registrar entity by its client id outside of a transaction. */
|
||||||
@Nullable
|
@Nullable
|
||||||
public static Registrar loadByClientId(final String clientId) {
|
public static Registrar loadByClientId(final String clientId) {
|
||||||
|
checkNotNull(clientId, "Client ID cannot be null");
|
||||||
return ofy().doTransactionless(new Work<Registrar>() {
|
return ofy().doTransactionless(new Work<Registrar>() {
|
||||||
@Override
|
@Override
|
||||||
public Registrar run() {
|
public Registrar run() {
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
package google.registry.tools;
|
package google.registry.tools;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
import static com.google.common.base.Strings.emptyToNull;
|
import static com.google.common.base.Strings.emptyToNull;
|
||||||
import static com.google.common.collect.Iterables.filter;
|
import static com.google.common.collect.Iterables.filter;
|
||||||
|
@ -25,11 +24,11 @@ import static google.registry.model.registrar.Registrar.State.ACTIVE;
|
||||||
import static google.registry.tools.RegistryToolEnvironment.PRODUCTION;
|
import static google.registry.tools.RegistryToolEnvironment.PRODUCTION;
|
||||||
import static google.registry.tools.RegistryToolEnvironment.SANDBOX;
|
import static google.registry.tools.RegistryToolEnvironment.SANDBOX;
|
||||||
import static google.registry.tools.RegistryToolEnvironment.UNITTEST;
|
import static google.registry.tools.RegistryToolEnvironment.UNITTEST;
|
||||||
|
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||||
import static google.registry.util.RegistrarUtils.normalizeClientId;
|
import static google.registry.util.RegistrarUtils.normalizeClientId;
|
||||||
|
|
||||||
import com.beust.jcommander.Parameter;
|
import com.beust.jcommander.Parameter;
|
||||||
import com.beust.jcommander.Parameters;
|
import com.beust.jcommander.Parameters;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -45,10 +44,6 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand
|
||||||
private static final ImmutableSet<RegistryToolEnvironment> ENVIRONMENTS_ALLOWING_GROUP_CREATION =
|
private static final ImmutableSet<RegistryToolEnvironment> ENVIRONMENTS_ALLOWING_GROUP_CREATION =
|
||||||
ImmutableSet.of(PRODUCTION, SANDBOX, UNITTEST);
|
ImmutableSet.of(PRODUCTION, SANDBOX, UNITTEST);
|
||||||
|
|
||||||
// Allows test cases to be cleaner.
|
|
||||||
@VisibleForTesting
|
|
||||||
static boolean requireAddress = true;
|
|
||||||
|
|
||||||
@Parameter(
|
@Parameter(
|
||||||
names = "--create_groups",
|
names = "--create_groups",
|
||||||
description = "Whether the Google Groups for this registrar should be created",
|
description = "Whether the Google Groups for this registrar should be created",
|
||||||
|
@ -65,12 +60,10 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand
|
||||||
@Override
|
@Override
|
||||||
protected void initRegistrarCommand() throws Exception {
|
protected void initRegistrarCommand() throws Exception {
|
||||||
checkArgument(mainParameters.size() == 1, "Must specify exactly one client identifier.");
|
checkArgument(mainParameters.size() == 1, "Must specify exactly one client identifier.");
|
||||||
checkNotNull(emptyToNull(password), "--password is a required field");
|
checkArgumentNotNull(emptyToNull(password), "--password is a required field");
|
||||||
checkNotNull(registrarName, "--name is a required field");
|
checkArgumentNotNull(registrarName, "--name is a required field");
|
||||||
checkNotNull(icannReferralEmail, "--icann_referral_email is a required field");
|
checkArgumentNotNull(icannReferralEmail, "--icann_referral_email is a required field");
|
||||||
if (requireAddress) {
|
checkArgumentNotNull(street, "Address fields are required when creating a registrar");
|
||||||
checkNotNull(street, "Address fields are required when creating a registrar");
|
|
||||||
}
|
|
||||||
// Default new registrars to active.
|
// Default new registrars to active.
|
||||||
registrarState = Optional.fromNullable(registrarState).or(ACTIVE);
|
registrarState = Optional.fromNullable(registrarState).or(ACTIVE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,11 @@ final class DomainWhoisResponse extends WhoisResponseImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WhoisResponseResults getResponse(final boolean preferUnicode, String disclaimer) {
|
public WhoisResponseResults getResponse(final boolean preferUnicode, String disclaimer) {
|
||||||
Registrar registrar = getRegistrar(domain.getCurrentSponsorClientId());
|
Registrar registrar =
|
||||||
|
checkNotNull(
|
||||||
|
Registrar.loadByClientId(domain.getCurrentSponsorClientId()),
|
||||||
|
"Could not load registrar %s",
|
||||||
|
domain.getCurrentSponsorClientId());
|
||||||
Optional<RegistrarContact> abuseContact =
|
Optional<RegistrarContact> abuseContact =
|
||||||
Iterables.tryFind(
|
Iterables.tryFind(
|
||||||
registrar.getContacts(),
|
registrar.getContacts(),
|
||||||
|
|
|
@ -53,7 +53,8 @@ final class NameserverWhoisResponse extends WhoisResponseImpl {
|
||||||
.cloneProjectedAtTime(getTimestamp())
|
.cloneProjectedAtTime(getTimestamp())
|
||||||
.getCurrentSponsorClientId()
|
.getCurrentSponsorClientId()
|
||||||
: host.getPersistedCurrentSponsorClientId();
|
: host.getPersistedCurrentSponsorClientId();
|
||||||
Registrar registrar = getRegistrar(clientId);
|
Registrar registrar =
|
||||||
|
checkNotNull(Registrar.loadByClientId(clientId), "Could not load registrar %s", clientId);
|
||||||
emitter
|
emitter
|
||||||
.emitField(
|
.emitField(
|
||||||
"Server Name", maybeFormatHostname(host.getFullyQualifiedHostName(), preferUnicode))
|
"Server Name", maybeFormatHostname(host.getFullyQualifiedHostName(), preferUnicode))
|
||||||
|
|
|
@ -21,12 +21,10 @@ import static com.google.common.html.HtmlEscapers.htmlEscaper;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Ordering;
|
import com.google.common.collect.Ordering;
|
||||||
import google.registry.model.eppcommon.Address;
|
import google.registry.model.eppcommon.Address;
|
||||||
import google.registry.model.registrar.Registrar;
|
|
||||||
import google.registry.util.Idn;
|
import google.registry.util.Idn;
|
||||||
import google.registry.xml.UtcDateTimeAdapter;
|
import google.registry.xml.UtcDateTimeAdapter;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -45,13 +43,6 @@ abstract class WhoisResponseImpl implements WhoisResponse {
|
||||||
/** ICANN problem reporting URL appended to all WHOIS responses. */
|
/** ICANN problem reporting URL appended to all WHOIS responses. */
|
||||||
private static final String ICANN_REPORTING_URL = "https://www.icann.org/wicf/";
|
private static final String ICANN_REPORTING_URL = "https://www.icann.org/wicf/";
|
||||||
|
|
||||||
private static final Registrar EMPTY_REGISTRAR = new Supplier<Registrar>() {
|
|
||||||
@Override
|
|
||||||
public Registrar get() {
|
|
||||||
// Use Type.TEST here to avoid requiring an IANA ID (the type does not appear in WHOIS).
|
|
||||||
return new Registrar.Builder().setType(Registrar.Type.TEST).build();
|
|
||||||
}}.get();
|
|
||||||
|
|
||||||
/** The time at which this response was created. */
|
/** The time at which this response was created. */
|
||||||
private final DateTime timestamp;
|
private final DateTime timestamp;
|
||||||
|
|
||||||
|
@ -196,11 +187,4 @@ abstract class WhoisResponseImpl implements WhoisResponse {
|
||||||
|
|
||||||
/** An emitter that needs no special logic. */
|
/** An emitter that needs no special logic. */
|
||||||
static class BasicEmitter extends Emitter<BasicEmitter> {}
|
static class BasicEmitter extends Emitter<BasicEmitter> {}
|
||||||
|
|
||||||
/** Returns the registrar for this client id, or an empty registrar with null values. */
|
|
||||||
static Registrar getRegistrar(@Nullable String clientId) {
|
|
||||||
return Optional
|
|
||||||
.fromNullable(clientId == null ? null : Registrar.loadByClientId(clientId))
|
|
||||||
.or(EMPTY_REGISTRAR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import static google.registry.model.common.Cursor.CursorType.SYNC_REGISTRAR_SHEE
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
import static google.registry.testing.DatastoreHelper.createTld;
|
import static google.registry.testing.DatastoreHelper.createTld;
|
||||||
import static google.registry.testing.DatastoreHelper.deleteResource;
|
import static google.registry.testing.DatastoreHelper.deleteResource;
|
||||||
|
import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
|
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
|
||||||
import static org.joda.time.DateTimeZone.UTC;
|
import static org.joda.time.DateTimeZone.UTC;
|
||||||
|
@ -94,13 +95,7 @@ public class SyncRegistrarsSheetTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_wereRegistrarsModified_atDifferentCursorTimes() throws Exception {
|
public void test_wereRegistrarsModified_atDifferentCursorTimes() throws Exception {
|
||||||
persistResource(new Registrar.Builder()
|
persistNewRegistrar("SomeRegistrar", "Some Registrar Inc.", Registrar.Type.REAL, 8L);
|
||||||
.setClientId("SomeRegistrar")
|
|
||||||
.setRegistrarName("Some Registrar Inc.")
|
|
||||||
.setType(Registrar.Type.REAL)
|
|
||||||
.setIanaIdentifier(8L)
|
|
||||||
.setState(Registrar.State.ACTIVE)
|
|
||||||
.build());
|
|
||||||
persistResource(Cursor.createGlobal(SYNC_REGISTRAR_SHEET, clock.nowUtc().minusHours(1)));
|
persistResource(Cursor.createGlobal(SYNC_REGISTRAR_SHEET, clock.nowUtc().minusHours(1)));
|
||||||
assertThat(newSyncRegistrarsSheet().wereRegistrarsModified()).isTrue();
|
assertThat(newSyncRegistrarsSheet().wereRegistrarsModified()).isTrue();
|
||||||
persistResource(Cursor.createGlobal(SYNC_REGISTRAR_SHEET, clock.nowUtc().plusHours(1)));
|
persistResource(Cursor.createGlobal(SYNC_REGISTRAR_SHEET, clock.nowUtc().plusHours(1)));
|
||||||
|
@ -327,18 +322,14 @@ public class SyncRegistrarsSheetTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_missingValues_stillWorks() throws Exception {
|
public void testRun_missingValues_stillWorks() throws Exception {
|
||||||
persistResource(new Registrar.Builder()
|
persistNewRegistrar("SomeRegistrar", "Some Registrar", Registrar.Type.REAL, 8L);
|
||||||
.setClientId("SomeRegistrar")
|
|
||||||
.setType(Registrar.Type.REAL)
|
|
||||||
.setIanaIdentifier(8L)
|
|
||||||
.build());
|
|
||||||
|
|
||||||
newSyncRegistrarsSheet().run("foobar");
|
newSyncRegistrarsSheet().run("foobar");
|
||||||
|
|
||||||
verify(sheetSynchronizer).synchronize(eq("foobar"), rowsCaptor.capture());
|
verify(sheetSynchronizer).synchronize(eq("foobar"), rowsCaptor.capture());
|
||||||
ImmutableMap<String, String> row = getOnlyElement(getOnlyElement(rowsCaptor.getAllValues()));
|
ImmutableMap<String, String> row = getOnlyElement(getOnlyElement(rowsCaptor.getAllValues()));
|
||||||
assertThat(row).containsEntry("clientIdentifier", "SomeRegistrar");
|
assertThat(row).containsEntry("clientIdentifier", "SomeRegistrar");
|
||||||
assertThat(row).containsEntry("registrarName", "");
|
assertThat(row).containsEntry("registrarName", "Some Registrar");
|
||||||
assertThat(row).containsEntry("state", "");
|
assertThat(row).containsEntry("state", "");
|
||||||
assertThat(row).containsEntry("ianaIdentifier", "8");
|
assertThat(row).containsEntry("ianaIdentifier", "8");
|
||||||
assertThat(row).containsEntry("billingIdentifier", "");
|
assertThat(row).containsEntry("billingIdentifier", "");
|
||||||
|
@ -352,8 +343,8 @@ public class SyncRegistrarsSheetTest {
|
||||||
assertThat(row).containsEntry("contactsMarkedAsWhoisAdmin", "");
|
assertThat(row).containsEntry("contactsMarkedAsWhoisAdmin", "");
|
||||||
assertThat(row).containsEntry("contactsMarkedAsWhoisTech", "");
|
assertThat(row).containsEntry("contactsMarkedAsWhoisTech", "");
|
||||||
assertThat(row).containsEntry("emailAddress", "");
|
assertThat(row).containsEntry("emailAddress", "");
|
||||||
assertThat(row).containsEntry("address.street", "UNKNOWN");
|
assertThat(row).containsEntry("address.street", "123 Fake St");
|
||||||
assertThat(row).containsEntry("address.city", "UNKNOWN");
|
assertThat(row).containsEntry("address.city", "Fakington");
|
||||||
assertThat(row).containsEntry("address.state", "");
|
assertThat(row).containsEntry("address.state", "");
|
||||||
assertThat(row).containsEntry("address.zip", "");
|
assertThat(row).containsEntry("address.zip", "");
|
||||||
assertThat(row).containsEntry("address.countryCode", "US");
|
assertThat(row).containsEntry("address.countryCode", "US");
|
||||||
|
|
|
@ -16,6 +16,7 @@ package google.registry.model.ofy;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static google.registry.model.ofy.ObjectifyService.initOfy;
|
import static google.registry.model.ofy.ObjectifyService.initOfy;
|
||||||
|
import static google.registry.testing.DatastoreHelper.newContactResource;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
|
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
|
||||||
|
@ -26,8 +27,7 @@ import com.googlecode.objectify.ObjectifyFilter;
|
||||||
import com.googlecode.objectify.ObjectifyService;
|
import com.googlecode.objectify.ObjectifyService;
|
||||||
import com.googlecode.objectify.annotation.Entity;
|
import com.googlecode.objectify.annotation.Entity;
|
||||||
import com.googlecode.objectify.annotation.Id;
|
import com.googlecode.objectify.annotation.Id;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.registrar.Registrar.Type;
|
|
||||||
import google.registry.testing.ExceptionRule;
|
import google.registry.testing.ExceptionRule;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -93,9 +93,8 @@ public class OfyFilterTest {
|
||||||
@Test
|
@Test
|
||||||
public void testKeyCreateAfterFilter() throws Exception {
|
public void testKeyCreateAfterFilter() throws Exception {
|
||||||
new OfyFilter().init(null);
|
new OfyFilter().init(null);
|
||||||
Registrar registrar =
|
ContactResource contact = newContactResource("contact1234");
|
||||||
new Registrar.Builder().setType(Type.TEST).setClientId("clientId").build();
|
Key.create(contact);
|
||||||
Key.create(registrar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
|
|
@ -314,8 +314,26 @@ public class RegistrarTest extends EntityTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_missingRegistrarType() throws Exception {
|
public void testFailure_missingRegistrarType() throws Exception {
|
||||||
thrown.expect(NullPointerException.class);
|
thrown.expect(IllegalArgumentException.class, "Registrar type cannot be null");
|
||||||
new Registrar.Builder().build();
|
new Registrar.Builder().setRegistrarName("blah").build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFailure_missingRegistrarName() throws Exception {
|
||||||
|
thrown.expect(IllegalArgumentException.class, "Registrar name cannot be null");
|
||||||
|
new Registrar.Builder().setClientId("blahid").setType(Registrar.Type.TEST).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFailure_missingAddress() throws Exception {
|
||||||
|
thrown.expect(
|
||||||
|
IllegalArgumentException.class,
|
||||||
|
"Must specify at least one of localized or internationalized address");
|
||||||
|
new Registrar.Builder()
|
||||||
|
.setClientId("blahid")
|
||||||
|
.setType(Registrar.Type.TEST)
|
||||||
|
.setRegistrarName("Blah Co")
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -20,8 +20,6 @@ import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.testing.AppEngineRule;
|
import google.registry.testing.AppEngineRule;
|
||||||
import google.registry.testing.ShardableTestCase;
|
import google.registry.testing.ShardableTestCase;
|
||||||
import google.registry.xml.XmlTestUtils;
|
import google.registry.xml.XmlTestUtils;
|
||||||
import org.joda.time.DateTime;
|
|
||||||
import org.joda.time.format.ISODateTimeFormat;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -82,46 +80,10 @@ public class RdeMarshallerTest extends ShardableTestCase {
|
||||||
"registrar.upDate");
|
"registrar.upDate");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testMarshalRegistrar_breaksRdeXmlSchema_producesErrorMessage() throws Exception {
|
|
||||||
Registrar reg = Registrar.loadByClientId("TheRegistrar").asBuilder()
|
|
||||||
.setLocalizedAddress(null)
|
|
||||||
.setInternationalizedAddress(null)
|
|
||||||
.build();
|
|
||||||
DepositFragment fragment = new RdeMarshaller().marshalRegistrar(reg);
|
|
||||||
assertThat(fragment.type()).isEqualTo(RdeResourceType.REGISTRAR);
|
|
||||||
assertThat(fragment.xml()).isEmpty();
|
|
||||||
assertThat(fragment.error()).isEqualTo(""
|
|
||||||
+ "RDE XML schema validation failed: "
|
|
||||||
+ "Key<?>(EntityGroupRoot(\"cross-tld\")/Registrar(\"TheRegistrar\"))\n"
|
|
||||||
+ "org.xml.sax.SAXParseException; lineNumber: 0; columnNumber: 0; cvc-complex-type.2.4.a: "
|
|
||||||
+ "Invalid content was found starting with element 'rdeRegistrar:voice'. "
|
|
||||||
+ "One of '{\"urn:ietf:params:xml:ns:rdeRegistrar-1.0\":postalInfo}' is expected.\n"
|
|
||||||
+ "<rdeRegistrar:registrar>\n"
|
|
||||||
+ " <rdeRegistrar:id>TheRegistrar</rdeRegistrar:id>\n"
|
|
||||||
+ " <rdeRegistrar:name>The Registrar</rdeRegistrar:name>\n"
|
|
||||||
+ " <rdeRegistrar:gurid>1</rdeRegistrar:gurid>\n"
|
|
||||||
+ " <rdeRegistrar:status>ok</rdeRegistrar:status>\n"
|
|
||||||
+ " <rdeRegistrar:voice>+1.2223334444</rdeRegistrar:voice>\n"
|
|
||||||
+ " <rdeRegistrar:email>new.registrar@example.com</rdeRegistrar:email>\n"
|
|
||||||
+ " <rdeRegistrar:whoisInfo>\n"
|
|
||||||
+ " <rdeRegistrar:name>whois.nic.fakewhois.example</rdeRegistrar:name>\n"
|
|
||||||
+ " </rdeRegistrar:whoisInfo>\n"
|
|
||||||
+ " <rdeRegistrar:crDate>" + ft(reg.getCreationTime()) + "</rdeRegistrar:crDate>\n"
|
|
||||||
+ " <rdeRegistrar:upDate>" + ft(reg.getLastUpdateTime()) + "</rdeRegistrar:upDate>\n"
|
|
||||||
+ "</rdeRegistrar:registrar>\n"
|
|
||||||
+ "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMarshalRegistrar_unicodeCharacters_dontGetMangled() throws Exception {
|
public void testMarshalRegistrar_unicodeCharacters_dontGetMangled() throws Exception {
|
||||||
DepositFragment fragment =
|
DepositFragment fragment =
|
||||||
new RdeMarshaller().marshalRegistrar(Registrar.loadByClientId("TheRegistrar"));
|
new RdeMarshaller().marshalRegistrar(Registrar.loadByClientId("TheRegistrar"));
|
||||||
assertThat(fragment.xml()).contains("123 Example Bőulevard");
|
assertThat(fragment.xml()).contains("123 Example Bőulevard");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Formats {@code timestamp} without milliseconds. */
|
|
||||||
private static String ft(DateTime timestamp) {
|
|
||||||
return ISODateTimeFormat.dateTimeNoMillis().withZoneUTC().print(timestamp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.index.EppResourceIndex;
|
import google.registry.model.index.EppResourceIndex;
|
||||||
import google.registry.model.index.EppResourceIndexBucket;
|
import google.registry.model.index.EppResourceIndexBucket;
|
||||||
import google.registry.model.index.ForeignKeyIndex;
|
import google.registry.model.index.ForeignKeyIndex;
|
||||||
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.registry.Registry.TldState;
|
import google.registry.model.registry.Registry.TldState;
|
||||||
import google.registry.testing.AppEngineRule;
|
import google.registry.testing.AppEngineRule;
|
||||||
import google.registry.testing.ExceptionRule;
|
import google.registry.testing.ExceptionRule;
|
||||||
|
@ -96,7 +97,7 @@ public class RdeImportUtilsTest extends ShardableTestCase {
|
||||||
rdeImportUtils = new RdeImportUtils(ofy(), clock, "import-bucket", gcsUtils);
|
rdeImportUtils = new RdeImportUtils(ofy(), clock, "import-bucket", gcsUtils);
|
||||||
createTld("test", TldState.PREDELEGATION);
|
createTld("test", TldState.PREDELEGATION);
|
||||||
createTld("getld", TldState.GENERAL_AVAILABILITY);
|
createTld("getld", TldState.GENERAL_AVAILABILITY);
|
||||||
persistNewRegistrar("RegistrarX", 1L);
|
persistNewRegistrar("RegistrarX", "RegistrarX", Registrar.Type.REAL, 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
@ -287,8 +288,8 @@ public class RdeImportUtilsTest extends ShardableTestCase {
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, Key.create(admin)),
|
DesignatedContact.create(Type.ADMIN, Key.create(admin)),
|
||||||
DesignatedContact.create(Type.TECH, Key.create(admin))))
|
DesignatedContact.create(Type.TECH, Key.create(admin))))
|
||||||
.setPersistedCurrentSponsorClientId("RegistrarX")
|
.setPersistedCurrentSponsorClientId("registrarx")
|
||||||
.setCreationClientId("RegistrarX")
|
.setCreationClientId("registrarx")
|
||||||
.setCreationTime(DateTime.parse("1999-04-03T22:00:00.0Z"))
|
.setCreationTime(DateTime.parse("1999-04-03T22:00:00.0Z"))
|
||||||
.setRegistrationExpirationTime(DateTime.parse("2015-04-03T22:00:00.0Z"))
|
.setRegistrationExpirationTime(DateTime.parse("2015-04-03T22:00:00.0Z"))
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -83,6 +83,7 @@ import google.registry.model.ofy.ObjectifyService;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.pricing.StaticPremiumListPricingEngine;
|
import google.registry.model.pricing.StaticPremiumListPricingEngine;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
|
import google.registry.model.registrar.RegistrarAddress;
|
||||||
import google.registry.model.registry.Registry;
|
import google.registry.model.registry.Registry;
|
||||||
import google.registry.model.registry.Registry.TldState;
|
import google.registry.model.registry.Registry.TldState;
|
||||||
import google.registry.model.registry.Registry.TldType;
|
import google.registry.model.registry.Registry.TldType;
|
||||||
|
@ -611,14 +612,22 @@ public class DatastoreHelper {
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates a stripped-down {@link Registrar} with the specified clientId and ianaIdentifier */
|
/** Persists and returns a {@link Registrar} with the specified attributes. */
|
||||||
public static Registrar persistNewRegistrar(String clientId, long ianaIdentifier) {
|
public static Registrar persistNewRegistrar(
|
||||||
|
String clientId, String registrarName, Registrar.Type type, long ianaIdentifier) {
|
||||||
return persistSimpleResource(
|
return persistSimpleResource(
|
||||||
new Registrar.Builder()
|
new Registrar.Builder()
|
||||||
.setClientId(clientId)
|
.setClientId(clientId)
|
||||||
.setType(Registrar.Type.REAL)
|
.setRegistrarName(registrarName)
|
||||||
.setIanaIdentifier(ianaIdentifier)
|
.setType(type)
|
||||||
.build());
|
.setIanaIdentifier(ianaIdentifier)
|
||||||
|
.setLocalizedAddress(
|
||||||
|
new RegistrarAddress.Builder()
|
||||||
|
.setStreet(ImmutableList.of("123 Fake St"))
|
||||||
|
.setCity("Fakington")
|
||||||
|
.setCountryCode("US")
|
||||||
|
.build())
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Iterable<BillingEvent> getBillingEvents() {
|
private static Iterable<BillingEvent> getBillingEvents() {
|
||||||
|
|
|
@ -130,7 +130,8 @@ public final class FullFieldsTestEntityHelper {
|
||||||
HostResource.Builder builder = new HostResource.Builder()
|
HostResource.Builder builder = new HostResource.Builder()
|
||||||
.setRepoId(generateNewContactHostRoid())
|
.setRepoId(generateNewContactHostRoid())
|
||||||
.setFullyQualifiedHostName(Idn.toASCII(fqhn))
|
.setFullyQualifiedHostName(Idn.toASCII(fqhn))
|
||||||
.setCreationTimeForTest(DateTime.parse("2000-10-08T00:45:00Z"));
|
.setCreationTimeForTest(DateTime.parse("2000-10-08T00:45:00Z"))
|
||||||
|
.setPersistedCurrentSponsorClientId("TheRegistrar");
|
||||||
if ((ip1 != null) || (ip2 != null)) {
|
if ((ip1 != null) || (ip2 != null)) {
|
||||||
ImmutableSet.Builder<InetAddress> ipBuilder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<InetAddress> ipBuilder = new ImmutableSet.Builder<>();
|
||||||
if (ip1 != null) {
|
if (ip1 != null) {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -23,6 +23,7 @@ import static org.mockito.Mockito.verifyZeroInteractions;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.net.MediaType;
|
import com.google.common.net.MediaType;
|
||||||
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.tools.ServerSideCommand.Connection;
|
import google.registry.tools.ServerSideCommand.Connection;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -37,7 +38,7 @@ public class LoadTestCommandTest extends CommandTestCase<LoadTestCommand> {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
command.setConnection(connection);
|
command.setConnection(connection);
|
||||||
createTld("example");
|
createTld("example");
|
||||||
persistNewRegistrar("acme", 99);
|
persistNewRegistrar("acme", "ACME", Registrar.Type.REAL, 99L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -20,6 +20,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
import static google.registry.testing.DatastoreHelper.createTld;
|
import static google.registry.testing.DatastoreHelper.createTld;
|
||||||
import static google.registry.testing.DatastoreHelper.deleteResource;
|
import static google.registry.testing.DatastoreHelper.deleteResource;
|
||||||
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
||||||
|
import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static org.joda.time.DateTimeZone.UTC;
|
import static org.joda.time.DateTimeZone.UTC;
|
||||||
|
|
||||||
|
@ -58,16 +59,8 @@ public class MutatingCommandTest {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void init() {
|
public void init() {
|
||||||
registrar1 = persistResource(new Registrar.Builder()
|
registrar1 = persistNewRegistrar("Registrar1", "Registrar1", Registrar.Type.REAL, 1L);
|
||||||
.setType(Registrar.Type.REAL)
|
registrar2 = persistNewRegistrar("Registrar2", "Registrar2", Registrar.Type.REAL, 2L);
|
||||||
.setClientId("Registrar1")
|
|
||||||
.setIanaIdentifier(1L)
|
|
||||||
.build());
|
|
||||||
registrar2 = persistResource(new Registrar.Builder()
|
|
||||||
.setType(Registrar.Type.REAL)
|
|
||||||
.setClientId("Registrar2")
|
|
||||||
.setIanaIdentifier(2L)
|
|
||||||
.build());
|
|
||||||
newRegistrar1 = registrar1.asBuilder().setBillingIdentifier(42L).build();
|
newRegistrar1 = registrar1.asBuilder().setBillingIdentifier(42L).build();
|
||||||
newRegistrar2 = registrar2.asBuilder().setBlockPremiumNames(true).build();
|
newRegistrar2 = registrar2.asBuilder().setBlockPremiumNames(true).build();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.whois;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static google.registry.testing.DatastoreHelper.createTld;
|
import static google.registry.testing.DatastoreHelper.createTld;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
|
||||||
import static google.registry.whois.WhoisHelper.loadWhoisTestFile;
|
import static google.registry.whois.WhoisHelper.loadWhoisTestFile;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
@ -50,13 +50,7 @@ public class NameserverWhoisResponseTest {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
persistResource(new Registrar.Builder()
|
persistNewRegistrar("example", "Example Registrar, Inc.", Registrar.Type.REAL, 8L);
|
||||||
.setClientId("example")
|
|
||||||
.setRegistrarName("Example Registrar, Inc.")
|
|
||||||
.setType(Registrar.Type.REAL)
|
|
||||||
.setIanaIdentifier(8L)
|
|
||||||
.build());
|
|
||||||
|
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
|
|
||||||
hostResource1 = new HostResource.Builder()
|
hostResource1 = new HostResource.Builder()
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
package google.registry.whois;
|
package google.registry.whois;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
|
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
|
||||||
import static google.registry.whois.WhoisHelper.loadWhoisTestFile;
|
import static google.registry.whois.WhoisHelper.loadWhoisTestFile;
|
||||||
|
@ -120,12 +121,8 @@ public class RegistrarWhoisResponseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetOfFields() {
|
public void testSetOfFields() {
|
||||||
Registrar registrar = new Registrar.Builder()
|
Registrar registrar =
|
||||||
.setClientId("exregistrar")
|
persistNewRegistrar("exregistrar", "Ex-Registrar", Registrar.Type.REAL, 8L);
|
||||||
.setType(Registrar.Type.REAL)
|
|
||||||
.setIanaIdentifier(8L)
|
|
||||||
.setState(Registrar.State.ACTIVE)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
RegistrarWhoisResponse registrarWhoisResponse =
|
RegistrarWhoisResponse registrarWhoisResponse =
|
||||||
new RegistrarWhoisResponse(registrar, clock.nowUtc());
|
new RegistrarWhoisResponse(registrar, clock.nowUtc());
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Server Name: ns1.cat.lol
|
Server Name: ns1.cat.lol
|
||||||
IP Address: 1.2.3.4
|
IP Address: 1.2.3.4
|
||||||
Registrar:
|
Registrar: The Registrar
|
||||||
Registrar WHOIS Server: whois.nic.fakewhois.example
|
Registrar WHOIS Server: whois.nic.fakewhois.example
|
||||||
Registrar URL: http://www.referral.example/path
|
Registrar URL: http://www.referral.example/path
|
||||||
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue