Move registry policy settings and some others into YAML config

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=145571850
This commit is contained in:
mcilwain 2017-01-25 11:19:47 -08:00 committed by Ben McIlwain
parent efedc03d45
commit f647ea1190
15 changed files with 131 additions and 109 deletions

View file

@ -20,7 +20,6 @@ import static google.registry.config.YamlUtils.getConfigSettings;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static org.joda.time.Duration.standardDays; import static org.joda.time.Duration.standardDays;
import com.google.appengine.api.utils.SystemProperty;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -132,9 +131,8 @@ public final class RegistryConfig {
*/ */
@Provides @Provides
@Config("integrationEmail") @Config("integrationEmail")
public static String provideIntegrationEmail(RegistryEnvironment environment) { public static String provideIntegrationEmail(RegistryConfigSettings config) {
// Change this to your integration email address. return config.registrarConsole.integrationEmailAddress;
return "integration@example.com";
} }
/** /**
@ -145,9 +143,8 @@ public final class RegistryConfig {
*/ */
@Provides @Provides
@Config("supportEmail") @Config("supportEmail")
public static String provideSupportEmail(RegistryEnvironment environment) { public static String provideSupportEmail(RegistryConfigSettings config) {
// Change this to your support email address. return config.registrarConsole.supportEmailAddress;
return "support@example.com";
} }
/** /**
@ -158,9 +155,8 @@ public final class RegistryConfig {
*/ */
@Provides @Provides
@Config("announcementsEmail") @Config("announcementsEmail")
public static String provideAnnouncementsEmail(RegistryEnvironment environment) { public static String provideAnnouncementsEmail(RegistryConfigSettings config) {
// Change this to your announcements e-mail. return config.registrarConsole.announcementsEmailAddress;
return "announcements@example.com";
} }
/** /**
@ -170,9 +166,8 @@ public final class RegistryConfig {
*/ */
@Provides @Provides
@Config("supportPhoneNumber") @Config("supportPhoneNumber")
public static String provideSupportPhoneNumber(RegistryEnvironment environment) { public static String provideSupportPhoneNumber(RegistryConfigSettings config) {
// Change this to your phone number. return config.registrarConsole.supportPhoneNumber;
return "+1 (888) 555 0123";
} }
/** /**
@ -183,9 +178,8 @@ public final class RegistryConfig {
*/ */
@Provides @Provides
@Config("technicalDocsUrl") @Config("technicalDocsUrl")
public static String provideTechnicalDocsUrl(RegistryEnvironment environment) { public static String provideTechnicalDocsUrl(RegistryConfigSettings config) {
// Change this to your support docs link. return config.registrarConsole.technicalDocsUrl;
return "http://example.com/your_support_docs/";
} }
/** /**
@ -372,15 +366,15 @@ public final class RegistryConfig {
} }
/** /**
* Gets the email address of the admin account for the Google App. * Returns the email address of the admin account on the G Suite app used to perform
* administrative actions.
* *
* @see google.registry.groups.DirectoryGroupsConnection * @see google.registry.groups.DirectoryGroupsConnection
*/ */
@Provides @Provides
@Config("googleAppsAdminEmailAddress") @Config("gSuiteAdminAccountEmailAddress")
public static String provideGoogleAppsAdminEmailAddress(RegistryEnvironment environment) { public static String provideGSuiteAdminAccountEmailAddress(RegistryConfigSettings config) {
// Change this to your admin account. return config.gSuite.adminAccountEmailAddress;
return "admin@example.com";
} }
/** /**
@ -392,29 +386,20 @@ public final class RegistryConfig {
@Provides @Provides
@Config("registrarChangesNotificationEmailAddresses") @Config("registrarChangesNotificationEmailAddresses")
public static ImmutableList<String> provideRegistrarChangesNotificationEmailAddresses( public static ImmutableList<String> provideRegistrarChangesNotificationEmailAddresses(
RegistryEnvironment environment) { RegistryConfigSettings config) {
switch (environment) { return ImmutableList.copyOf(config.registryPolicy.registrarChangesNotificationEmailAddresses);
case PRODUCTION:
// Change this to an appropriate notification e-mail address.
return ImmutableList.of("notification@registry.example");
case UNITTEST:
return ImmutableList.of("notification@test.example", "notification2@test.example");
default:
return ImmutableList.<String>of();
}
} }
/** /**
* Returns the publicly accessible domain name for the running Google Apps instance. * Returns the publicly accessible domain name for the running G Suite instance.
* *
* @see google.registry.export.SyncGroupMembersAction * @see google.registry.export.SyncGroupMembersAction
* @see google.registry.tools.server.CreateGroupsAction * @see google.registry.tools.server.CreateGroupsAction
*/ */
@Provides @Provides
@Config("publicDomainName") @Config("gSuiteDomainName")
public static String providePublicDomainName(RegistryEnvironment environment) { public static String provideGSuiteDomainName(RegistryConfigSettings config) {
// Change this to your domain name. return config.gSuite.domainName;
return "registry.example.com";
} }
/** /**
@ -490,9 +475,9 @@ public final class RegistryConfig {
* @see google.registry.ui.server.registrar.SendEmailUtils * @see google.registry.ui.server.registrar.SendEmailUtils
*/ */
@Provides @Provides
@Config("googleAppsSendFromEmailAddress") @Config("gSuiteOutgoingEmailAddress")
public static String provideGoogleAppsSendFromEmailAddress() { public static String provideGSuiteOutgoingEmailAddress(RegistryConfigSettings config) {
return String.format("noreply@%s.appspotmail.com", SystemProperty.applicationId.get()); return config.gSuite.outgoingEmailAddress;
} }
/** /**
@ -501,10 +486,9 @@ public final class RegistryConfig {
* @see google.registry.ui.server.registrar.SendEmailUtils * @see google.registry.ui.server.registrar.SendEmailUtils
*/ */
@Provides @Provides
@Config("googleAppsAdminEmailDisplayName") @Config("gSuiteOutoingEmailDisplayName")
public static String provideGoogleAppsAdminEmailDisplayName() { public static String provideGSuiteOutgoingEmailDisplayName(RegistryConfigSettings config) {
// Production example: "Example Registry" return config.gSuite.outgoingEmailDisplayName;
return "Google Domain Registry";
} }
/** /**
@ -1214,25 +1198,15 @@ public final class RegistryConfig {
* @see "google.registry.whois.DomainWhoisResponse" * @see "google.registry.whois.DomainWhoisResponse"
* @see "google.registry.whois.RegistrarWhoisResponse" * @see "google.registry.whois.RegistrarWhoisResponse"
*/ */
public static String getRegistrarDefaultWhoisServer() { public static String getDefaultRegistrarWhoisServer() {
switch (RegistryEnvironment.get()) { return CONFIG_SETTINGS.get().registryPolicy.defaultRegistrarWhoisServer;
case UNITTEST:
return "whois.nic.fakewhois.example";
default:
return "whois.nic.registry.example";
}
} }
/** /**
* Returns the default referral URL that is used unless registrars have specified otherwise. * Returns the default referral URL that is used unless registrars have specified otherwise.
*/ */
public static URL getRegistrarDefaultReferralUrl() { public static String getDefaultRegistrarReferralUrl() {
switch (RegistryEnvironment.get()) { return CONFIG_SETTINGS.get().registryPolicy.defaultRegistrarReferralUrl;
case UNITTEST:
return makeUrl("http://www.referral.example/path");
default:
return makeUrl("https://www.registry.example");
}
} }
/** /**

View file

@ -14,54 +14,60 @@
package google.registry.config; package google.registry.config;
import java.util.List;
/** The POJO that YAML config files are deserialized into. */ /** The POJO that YAML config files are deserialized into. */
public class RegistryConfigSettings { public class RegistryConfigSettings {
public AppEngine appEngine; public AppEngine appEngine;
public GSuite gSuite;
public RegistryPolicy registryPolicy; public RegistryPolicy registryPolicy;
public Datastore datastore; public Datastore datastore;
public RegistrarConsole registrarConsole; public RegistrarConsole registrarConsole;
public Monitoring monitoring; public Monitoring monitoring;
/** Configuration options that apply to the entire App Engine project. */ /** Configuration options that apply to the entire App Engine project. */
public static class AppEngine { public static class AppEngine {
public String projectId; public String projectId;
} }
/** Configuration options for the G Suite account used by Nomulus. */
public static class GSuite {
public String domainName;
public String outgoingEmailAddress;
public String outgoingEmailDisplayName;
public String adminAccountEmailAddress;
}
/** Configuration options for registry policy. */ /** Configuration options for registry policy. */
public static class RegistryPolicy { public static class RegistryPolicy {
public String contactAndHostRoidSuffix; public String contactAndHostRoidSuffix;
public String productName; public String productName;
public List<String> registrarChangesNotificationEmailAddresses;
public String defaultRegistrarWhoisServer;
public String defaultRegistrarReferralUrl;
} }
/** Configuration for Cloud Datastore. */ /** Configuration for Cloud Datastore. */
public static class Datastore { public static class Datastore {
public int commitLogBucketsNum; public int commitLogBucketsNum;
public int eppResourceIndexBucketsNum; public int eppResourceIndexBucketsNum;
} }
/** Configuration for the web-based registrar console. */ /** Configuration for the web-based registrar console. */
public static class RegistrarConsole { public static class RegistrarConsole {
public String logoFilename; public String logoFilename;
public String supportPhoneNumber;
public String supportEmailAddress;
public String announcementsEmailAddress;
public String integrationEmailAddress;
public String technicalDocsUrl;
} }
/** Configuration for monitoring. */ /** Configuration for monitoring. */
public static class Monitoring { public static class Monitoring {
public int stackdriverMaxQps; public int stackdriverMaxQps;
public int stackdriverMaxPointsPerRequest; public int stackdriverMaxPointsPerRequest;
public int writeIntervalSeconds; public int writeIntervalSeconds;
} }
} }

View file

@ -7,6 +7,18 @@ appEngine:
# Globally unique App Engine project ID # Globally unique App Engine project ID
projectId: domain-registry projectId: domain-registry
gSuite:
# Publicly accessible domain name of the running G Suite instance.
domainName: domain-registry.example
# Display name and email address used on outgoing emails through G Suite.
outgoingEmailDisplayName: Example Registry
outgoingEmailAddress: noreply@project-id.appspotmail.com
# Email address of the admin account on the G Suite app. This is used for
# logging in to perform administrative actions, not sending emails.
adminAccountEmailAddress: admin@example.com
registryPolicy: registryPolicy:
# Repository identifier (ROID) suffix for contacts and hosts. # Repository identifier (ROID) suffix for contacts and hosts.
contactAndHostRoidSuffix: ROID contactAndHostRoidSuffix: ROID
@ -14,6 +26,16 @@ registryPolicy:
# Product name of the registry. Used throughout the registrar console. # Product name of the registry. Used throughout the registrar console.
productName: Nomulus productName: Nomulus
# List of email addresses that notifications of registrar and/or registrar
# contact updates should be sent to, or empty list for no notifications.
registrarChangesNotificationEmailAddresses: []
# Default WHOIS server used when not specified on a registrar.
defaultRegistrarWhoisServer: whois.domain-registry.example
# Default referral URL used when not changed by a registrar.
defaultRegistrarReferralUrl: https://www.domain-registry.example
datastore: datastore:
# Number of commit log buckets in Datastore. Don't change after initial # Number of commit log buckets in Datastore. Don't change after initial
# install. # install.
@ -28,6 +50,21 @@ registrarConsole:
# relative to ui/assets/images/ # relative to ui/assets/images/
logoFilename: logo.png logoFilename: logo.png
# Contact phone number for support with the registry.
supportPhoneNumber: +1 (888) 555 0123
# Contact email address for support with the registry.
supportEmailAddress: support@example.com
# From: email address used to send announcements from the registry.
announcementsEmailAddress: announcements@example.com
# Contact email address for questions about integrating with the registry.
integrationEmailAddress: integration@example.com
# URL linking to directory of technical support docs on the registry.
technicalDocsUrl: http://example.com/your_support_docs/
monitoring: monitoring:
# Max queries per second for the Google Cloud Monitoring V3 (aka Stackdriver) # Max queries per second for the Google Cloud Monitoring V3 (aka Stackdriver)
# API. The limit can be adjusted by contacting Cloud Support. # API. The limit can be adjusted by contacting Cloud Support.

View file

@ -1,6 +1,13 @@
# This is the configuration file used by unit tests. These values ARE NOT # This is the configuration file used by unit tests. These values ARE NOT
# SUITABLE for use in a real deployed environment. # SUITABLE for use in a real deployed environment.
registryPolicy:
registrarChangesNotificationEmailAddresses:
- notification@test.example
- notification2@test.example
defaultRegistrarWhoisServer: whois.nic.fakewhois.example
defaultRegistrarReferralUrl: http://www.referral.example/path
datastore: datastore:
commitLogBucketsNum: 3 commitLogBucketsNum: 3
eppResourceIndexBucketsNum: 3 eppResourceIndexBucketsNum: 3

View file

@ -57,7 +57,6 @@ public final class SyncGroupMembersAction implements Runnable {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private enum Result { private enum Result {
OK(SC_OK, "Group memberships successfully updated."), OK(SC_OK, "Group memberships successfully updated."),
NOT_MODIFIED(SC_OK, "No registrar contacts have been updated since the last time servlet ran."), NOT_MODIFIED(SC_OK, "No registrar contacts have been updated since the last time servlet ran."),
@ -82,7 +81,7 @@ public final class SyncGroupMembersAction implements Runnable {
} }
@Inject GroupsConnection groupsConnection; @Inject GroupsConnection groupsConnection;
@Inject @Config("publicDomainName") String publicDomainName; @Inject @Config("gSuiteDomainName") String gSuiteDomainName;
@Inject Response response; @Inject Response response;
@Inject Retrier retrier; @Inject Retrier retrier;
@Inject SyncGroupMembersAction() {} @Inject SyncGroupMembersAction() {}
@ -100,13 +99,12 @@ public final class SyncGroupMembersAction implements Runnable {
* RegistrarContact.Type * RegistrarContact.Type
*/ */
public static String getGroupEmailAddressForContactType( public static String getGroupEmailAddressForContactType(
String clientId, String clientId, RegistrarContact.Type type, String gSuiteDomainName) {
RegistrarContact.Type type,
String publicDomainName) {
// Take the registrar's clientId, make it lowercase, and remove all characters that aren't // Take the registrar's clientId, make it lowercase, and remove all characters that aren't
// alphanumeric, hyphens, or underscores. // alphanumeric, hyphens, or underscores.
return String.format( return String.format(
"%s-%s-contacts@%s", normalizeClientId(clientId), type.getDisplayName(), publicDomainName); "%s-%s-contacts@%s",
normalizeClientId(clientId), type.getDisplayName(), gSuiteDomainName);
} }
/** /**
@ -188,7 +186,7 @@ public final class SyncGroupMembersAction implements Runnable {
long totalRemoved = 0; long totalRemoved = 0;
for (final RegistrarContact.Type type : RegistrarContact.Type.values()) { for (final RegistrarContact.Type type : RegistrarContact.Type.values()) {
groupKey = getGroupEmailAddressForContactType( groupKey = getGroupEmailAddressForContactType(
registrar.getClientId(), type, publicDomainName); registrar.getClientId(), type, gSuiteDomainName);
Set<String> currentMembers = groupsConnection.getMembersOfGroup(groupKey); Set<String> currentMembers = groupsConnection.getMembersOfGroup(groupKey);
Set<String> desiredMembers = FluentIterable.from(registrarContacts) Set<String> desiredMembers = FluentIterable.from(registrarContacts)
.filter(new Predicate<RegistrarContact>() { .filter(new Predicate<RegistrarContact>() {

View file

@ -63,7 +63,7 @@ public class DirectoryGroupsConnection implements GroupsConnection {
@Inject Directory directory; @Inject Directory directory;
@Inject Groupssettings groupsSettings; @Inject Groupssettings groupsSettings;
@Inject @Config("googleAppsAdminEmailAddress") String googleAppsAdminEmailAddress; @Inject @Config("gSuiteAdminAccountEmailAddress") String gSuiteAdminAccountEmailAddress;
@Inject DirectoryGroupsConnection() {} @Inject DirectoryGroupsConnection() {}
@Override @Override
@ -152,7 +152,7 @@ public class DirectoryGroupsConnection implements GroupsConnection {
group.setEmail(groupKey); group.setEmail(groupKey);
try { try {
Group createdGroup = directory.groups().insert(group).execute(); Group createdGroup = directory.groups().insert(group).execute();
addMemberToGroup(groupKey, googleAppsAdminEmailAddress, Role.OWNER); addMemberToGroup(groupKey, gSuiteAdminAccountEmailAddress, Role.OWNER);
groupsSettings.groups().patch(groupKey, defaultGroupPermissions).execute(); groupsSettings.groups().patch(groupKey, defaultGroupPermissions).execute();
return createdGroup; return createdGroup;
} catch (GoogleJsonResponseException e) { } catch (GoogleJsonResponseException e) {

View file

@ -24,8 +24,8 @@ import static com.google.common.base.Strings.emptyToNull;
import static com.google.common.base.Strings.nullToEmpty; import static com.google.common.base.Strings.nullToEmpty;
import static com.google.common.collect.Sets.immutableEnumSet; import static com.google.common.collect.Sets.immutableEnumSet;
import static com.google.common.io.BaseEncoding.base64; import static com.google.common.io.BaseEncoding.base64;
import static google.registry.config.RegistryConfig.getRegistrarDefaultReferralUrl; import static google.registry.config.RegistryConfig.getDefaultRegistrarReferralUrl;
import static google.registry.config.RegistryConfig.getRegistrarDefaultWhoisServer; import static google.registry.config.RegistryConfig.getDefaultRegistrarWhoisServer;
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey; import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.ofy.Ofy.RECOMMENDED_MEMCACHE_EXPIRATION; import static google.registry.model.ofy.Ofy.RECOMMENDED_MEMCACHE_EXPIRATION;
@ -445,7 +445,7 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
} }
public String getWhoisServer() { public String getWhoisServer() {
return firstNonNull(whoisServer, getRegistrarDefaultWhoisServer()); return firstNonNull(whoisServer, getDefaultRegistrarWhoisServer());
} }
public boolean getBlockPremiumNames() { public boolean getBlockPremiumNames() {
@ -461,7 +461,7 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
} }
public String getReferralUrl() { public String getReferralUrl() {
return firstNonNull(referralUrl, getRegistrarDefaultReferralUrl().toString()); return firstNonNull(referralUrl, getDefaultRegistrarReferralUrl());
} }
public String getIcannReferralEmail() { public String getIcannReferralEmail() {

View file

@ -223,7 +223,7 @@ public final class Modules {
static GoogleCredential provideDelegatedAdminGoogleCredential( static GoogleCredential provideDelegatedAdminGoogleCredential(
GoogleCredential googleCredential, GoogleCredential googleCredential,
HttpTransport httpTransport, HttpTransport httpTransport,
@Config("googleAppsAdminEmailAddress") String googleAppsAdminEmailAddress) { @Config("gSuiteAdminAccountEmailAddress") String gSuiteAdminAccountEmailAddress) {
return new GoogleCredential.Builder() return new GoogleCredential.Builder()
.setTransport(httpTransport) .setTransport(httpTransport)
.setJsonFactory(googleCredential.getJsonFactory()) .setJsonFactory(googleCredential.getJsonFactory())
@ -234,7 +234,7 @@ public final class Modules {
// is thus the responsibility of every user of a delegated admin credential to call // is thus the responsibility of every user of a delegated admin credential to call
// createScoped() on it first to get the version with the correct scopes set. // createScoped() on it first to get the version with the correct scopes set.
.setServiceAccountScopes(ImmutableSet.<String>of()) .setServiceAccountScopes(ImmutableSet.<String>of())
.setServiceAccountUser(googleAppsAdminEmailAddress) .setServiceAccountUser(gSuiteAdminAccountEmailAddress)
.build(); .build();
} }
} }

View file

@ -52,7 +52,7 @@ public class CreateGroupsAction implements Runnable {
@Inject GroupsConnection groupsConnection; @Inject GroupsConnection groupsConnection;
@Inject Response response; @Inject Response response;
@Inject @Config("publicDomainName") String publicDomainName; @Inject @Config("gSuiteDomainName") String gSuiteDomainName;
@Inject @Parameter("clientId") Optional<String> clientId; @Inject @Parameter("clientId") Optional<String> clientId;
@Inject CreateGroupsAction() {} @Inject CreateGroupsAction() {}
@ -73,9 +73,9 @@ public class CreateGroupsAction implements Runnable {
public Optional<Exception> apply(Type type) { public Optional<Exception> apply(Type type) {
try { try {
String groupKey = getGroupEmailAddressForContactType( String groupKey = getGroupEmailAddressForContactType(
registrar.getClientId(), type, publicDomainName); registrar.getClientId(), type, gSuiteDomainName);
String parentGroup = String parentGroup =
getGroupEmailAddressForContactType("registrar", type, publicDomainName); getGroupEmailAddressForContactType("registrar", type, gSuiteDomainName);
// Creates the group, then adds it as a member to the global registrar group for // Creates the group, then adds it as a member to the global registrar group for
// that type. // that type.
groupsConnection.createGroup(groupKey); groupsConnection.createGroup(groupKey);

View file

@ -37,15 +37,15 @@ public class SendEmailUtils {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private final String googleAppsSendFromEmailAddress; private final String gSuiteOutgoingEmailAddress;
private final String googleAppsAdminEmailDisplayName; private final String gSuiteOutoingEmailDisplayName;
@Inject @Inject
public SendEmailUtils( public SendEmailUtils(
@Config("googleAppsSendFromEmailAddress") String googleAppsSendFromEmailAddress, @Config("gSuiteOutgoingEmailAddress") String gSuiteOutgoingEmailAddress,
@Config("googleAppsAdminEmailDisplayName") String googleAppsAdminEmailDisplayName) { @Config("gSuiteOutoingEmailDisplayName") String gSuiteOutoingEmailDisplayName) {
this.googleAppsSendFromEmailAddress = googleAppsSendFromEmailAddress; this.gSuiteOutgoingEmailAddress = gSuiteOutgoingEmailAddress;
this.googleAppsAdminEmailDisplayName = googleAppsAdminEmailDisplayName; this.gSuiteOutoingEmailDisplayName = gSuiteOutoingEmailDisplayName;
} }
@NonFinalForTesting @NonFinalForTesting
@ -59,7 +59,7 @@ public class SendEmailUtils {
try { try {
Message msg = emailService.createMessage(); Message msg = emailService.createMessage();
msg.setFrom( msg.setFrom(
new InternetAddress(googleAppsSendFromEmailAddress, googleAppsAdminEmailDisplayName)); new InternetAddress(gSuiteOutgoingEmailAddress, gSuiteOutoingEmailDisplayName));
List<InternetAddress> emails = FluentIterable List<InternetAddress> emails = FluentIterable
.from(addresses) .from(addresses)
.transform(new Function<String, InternetAddress>() { .transform(new Function<String, InternetAddress>() {

View file

@ -80,7 +80,7 @@ public class SyncGroupMembersActionTest {
private void runAction() { private void runAction() {
SyncGroupMembersAction action = new SyncGroupMembersAction(); SyncGroupMembersAction action = new SyncGroupMembersAction();
action.groupsConnection = connection; action.groupsConnection = connection;
action.publicDomainName = "domain-registry.example"; action.gSuiteDomainName = "domain-registry.example";
action.response = response; action.response = response;
action.retrier = new Retrier(new FakeSleeper(new FakeClock()), 3); action.retrier = new Retrier(new FakeSleeper(new FakeClock()), 3);
action.run(); action.run();

View file

@ -16,8 +16,8 @@ package google.registry.export.sheet;
import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.config.RegistryConfig.getRegistrarDefaultReferralUrl; import static google.registry.config.RegistryConfig.getDefaultRegistrarReferralUrl;
import static google.registry.config.RegistryConfig.getRegistrarDefaultWhoisServer; import static google.registry.config.RegistryConfig.getDefaultRegistrarWhoisServer;
import static google.registry.model.common.Cursor.CursorType.SYNC_REGISTRAR_SHEET; import static google.registry.model.common.Cursor.CursorType.SYNC_REGISTRAR_SHEET;
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;
@ -262,8 +262,8 @@ public class SyncRegistrarsSheetTest {
assertThat(row).containsEntry("ipAddressWhitelist", ""); assertThat(row).containsEntry("ipAddressWhitelist", "");
assertThat(row).containsEntry("url", "http://www.example.org/aaa_registrar"); assertThat(row).containsEntry("url", "http://www.example.org/aaa_registrar");
assertThat(row).containsEntry("icannReferralEmail", ""); assertThat(row).containsEntry("icannReferralEmail", "");
assertThat(row).containsEntry("whoisServer", getRegistrarDefaultWhoisServer()); assertThat(row).containsEntry("whoisServer", getDefaultRegistrarWhoisServer());
assertThat(row).containsEntry("referralUrl", getRegistrarDefaultReferralUrl().toString()); assertThat(row).containsEntry("referralUrl", getDefaultRegistrarReferralUrl());
row = rows.get(1); row = rows.get(1);
assertThat(row).containsEntry("clientIdentifier", "anotherregistrar"); assertThat(row).containsEntry("clientIdentifier", "anotherregistrar");
@ -295,7 +295,7 @@ public class SyncRegistrarsSheetTest {
assertThat(row).containsEntry("blockPremiumNames", "false"); assertThat(row).containsEntry("blockPremiumNames", "false");
assertThat(row).containsEntry("ipAddressWhitelist", ""); assertThat(row).containsEntry("ipAddressWhitelist", "");
assertThat(row).containsEntry("url", "http://www.example.org/another_registrar"); assertThat(row).containsEntry("url", "http://www.example.org/another_registrar");
assertThat(row).containsEntry("referralUrl", getRegistrarDefaultReferralUrl().toString()); assertThat(row).containsEntry("referralUrl", getDefaultRegistrarReferralUrl());
assertThat(row).containsEntry("icannReferralEmail", "jim@example.net"); assertThat(row).containsEntry("icannReferralEmail", "jim@example.net");
Cursor cursor = ofy().load().key(Cursor.createGlobalKey(SYNC_REGISTRAR_SHEET)).now(); Cursor cursor = ofy().load().key(Cursor.createGlobalKey(SYNC_REGISTRAR_SHEET)).now();
@ -338,11 +338,11 @@ public class SyncRegistrarsSheetTest {
assertThat(row).containsEntry("phoneNumber", ""); assertThat(row).containsEntry("phoneNumber", "");
assertThat(row).containsEntry("faxNumber", ""); assertThat(row).containsEntry("faxNumber", "");
assertThat(row).containsEntry("allowedTlds", ""); assertThat(row).containsEntry("allowedTlds", "");
assertThat(row).containsEntry("whoisServer", getRegistrarDefaultWhoisServer()); assertThat(row).containsEntry("whoisServer", getDefaultRegistrarWhoisServer());
assertThat(row).containsEntry("blockPremiumNames", "false"); assertThat(row).containsEntry("blockPremiumNames", "false");
assertThat(row).containsEntry("ipAddressWhitelist", ""); assertThat(row).containsEntry("ipAddressWhitelist", "");
assertThat(row).containsEntry("url", ""); assertThat(row).containsEntry("url", "");
assertThat(row).containsEntry("referralUrl", getRegistrarDefaultReferralUrl().toString()); assertThat(row).containsEntry("referralUrl", getDefaultRegistrarReferralUrl());
assertThat(row).containsEntry("icannReferralEmail", ""); assertThat(row).containsEntry("icannReferralEmail", "");
} }
} }

View file

@ -114,7 +114,7 @@ public class DirectoryGroupsConnectionTest {
connection = new DirectoryGroupsConnection(); connection = new DirectoryGroupsConnection();
connection.directory = directory; connection.directory = directory;
connection.groupsSettings = groupsSettings; connection.groupsSettings = groupsSettings;
connection.googleAppsAdminEmailAddress = "admin@domain-registry.example"; connection.gSuiteAdminAccountEmailAddress = "admin@domain-registry.example";
expectedOwner.setEmail("admin@domain-registry.example"); expectedOwner.setEmail("admin@domain-registry.example");
expectedOwner.setRole("OWNER"); expectedOwner.setRole("OWNER");
} }

View file

@ -63,7 +63,7 @@ public class CreateGroupsActionTest {
CreateGroupsAction action = new CreateGroupsAction(); CreateGroupsAction action = new CreateGroupsAction();
action.response = response; action.response = response;
action.groupsConnection = connection; action.groupsConnection = connection;
action.publicDomainName = "domain-registry.example"; action.gSuiteDomainName = "domain-registry.example";
action.clientId = Optional.fromNullable(clientId); action.clientId = Optional.fromNullable(clientId);
action.run(); action.run();
} }

View file

@ -15,8 +15,8 @@
package google.registry.ui.server.registrar; package google.registry.ui.server.registrar;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.config.RegistryConfig.getRegistrarDefaultReferralUrl; import static google.registry.config.RegistryConfig.getDefaultRegistrarReferralUrl;
import static google.registry.config.RegistryConfig.getRegistrarDefaultWhoisServer; import static google.registry.config.RegistryConfig.getDefaultRegistrarWhoisServer;
import static google.registry.testing.CertificateSamples.SAMPLE_CERT; import static google.registry.testing.CertificateSamples.SAMPLE_CERT;
import static google.registry.testing.CertificateSamples.SAMPLE_CERT2; import static google.registry.testing.CertificateSamples.SAMPLE_CERT2;
import static google.registry.testing.CertificateSamples.SAMPLE_CERT2_HASH; import static google.registry.testing.CertificateSamples.SAMPLE_CERT2_HASH;
@ -52,8 +52,8 @@ public class SecuritySettingsTest extends RegistrarSettingsActionTestCase {
modified = modified =
modified modified
.asBuilder() .asBuilder()
.setWhoisServer(getRegistrarDefaultWhoisServer()) .setWhoisServer(getDefaultRegistrarWhoisServer())
.setReferralUrl(getRegistrarDefaultReferralUrl().toString()) .setReferralUrl(getDefaultRegistrarReferralUrl())
.build(); .build();
assertThat(response).containsEntry("status", "SUCCESS"); assertThat(response).containsEntry("status", "SUCCESS");
assertThat(response).containsEntry("results", asList(modified.toJsonMap())); assertThat(response).containsEntry("results", asList(modified.toJsonMap()));