diff --git a/java/google/registry/config/ConfigModule.java b/java/google/registry/config/ConfigModule.java
index 06632c726..62e43fb16 100644
--- a/java/google/registry/config/ConfigModule.java
+++ b/java/google/registry/config/ConfigModule.java
@@ -113,6 +113,19 @@ public final class ConfigModule {
return "Nomulus";
}
+ /**
+ * Returns the roid suffix to be used for the roids of all contacts and hosts. E.g. a value of
+ * "ROID" would end up creating roids that look like "ABC123-ROID".
+ *
+ * @see
+ * Extensible Provisioning Protocol (EPP) Repository Identifiers
+ */
+ @Provides
+ @Config("contactAndHostRoidSuffix")
+ public static String provideContactAndHostRoidSuffix(RegistryEnvironment environment) {
+ return LocalTestConfig.CONTACT_AND_HOST_ROID_SUFFIX;
+ }
+
/**
* The e-mail address for questions about integrating with the registry. Used in the
* "contact-us" section of the registrar console.
@@ -1007,4 +1020,10 @@ public final class ConfigModule {
.build())
.build();
}
+
+ /** Config values used for local and unit test environments. */
+ public static class LocalTestConfig {
+
+ public static final String CONTACT_AND_HOST_ROID_SUFFIX = "ROID";
+ }
}
diff --git a/java/google/registry/config/ProductionRegistryConfigExample.java b/java/google/registry/config/ProductionRegistryConfigExample.java
index 2134e8efb..4690ab60e 100644
--- a/java/google/registry/config/ProductionRegistryConfigExample.java
+++ b/java/google/registry/config/ProductionRegistryConfigExample.java
@@ -158,11 +158,6 @@ public final class ProductionRegistryConfigExample implements RegistryConfig {
return Duration.millis(100);
}
- @Override
- public String getContactAndHostRepositoryIdentifier() {
- return "ROID";
- }
-
@Override
public Duration getContactAutomaticTransferLength() {
return standardDays(5);
diff --git a/java/google/registry/config/RegistryConfig.java b/java/google/registry/config/RegistryConfig.java
index 8042c2fed..dbb317063 100644
--- a/java/google/registry/config/RegistryConfig.java
+++ b/java/google/registry/config/RegistryConfig.java
@@ -118,15 +118,6 @@ public interface RegistryConfig {
*/
public String getGoogleAppsSendFromEmailAddress();
- /**
- * Returns the roid suffix to be used for the roids of all contacts and hosts. E.g. a value of
- * "ROID" would end up creating roids that look like "ABC123-ROID".
- *
- * @see
- * Extensible Provisioning Protocol (EPP) Repository Identifiers
- */
- public String getContactAndHostRepositoryIdentifier();
-
/**
* Returns default WHOIS server to use when {@code Registrar#getWhoisServer()} is {@code null}.
*
diff --git a/java/google/registry/config/TestRegistryConfig.java b/java/google/registry/config/TestRegistryConfig.java
index 1cc7c5d8d..49f0af4f1 100644
--- a/java/google/registry/config/TestRegistryConfig.java
+++ b/java/google/registry/config/TestRegistryConfig.java
@@ -116,11 +116,6 @@ public class TestRegistryConfig implements RegistryConfig {
return Duration.ZERO;
}
- @Override
- public String getContactAndHostRepositoryIdentifier() {
- return "ROID";
- }
-
@Override
public Duration getContactAutomaticTransferLength() {
return standardDays(5);
diff --git a/java/google/registry/flows/contact/ContactCreateFlow.java b/java/google/registry/flows/contact/ContactCreateFlow.java
index ecf4d1d38..0699d8cba 100644
--- a/java/google/registry/flows/contact/ContactCreateFlow.java
+++ b/java/google/registry/flows/contact/ContactCreateFlow.java
@@ -18,10 +18,11 @@ import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
import static google.registry.flows.ResourceFlowUtils.verifyResourceDoesNotExist;
import static google.registry.flows.contact.ContactFlowUtils.validateAsciiPostalInfo;
import static google.registry.flows.contact.ContactFlowUtils.validateContactAgainstPolicy;
-import static google.registry.model.EppResourceUtils.createContactHostRoid;
+import static google.registry.model.EppResourceUtils.createRepoId;
import static google.registry.model.ofy.ObjectifyService.ofy;
import com.googlecode.objectify.Key;
+import google.registry.config.ConfigModule.Config;
import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager;
import google.registry.flows.FlowModule.ClientId;
@@ -56,6 +57,7 @@ public final class ContactCreateFlow implements TransactionalFlow {
@Inject @TargetId String targetId;
@Inject HistoryEntry.Builder historyBuilder;
@Inject EppResponse.Builder responseBuilder;
+ @Inject @Config("contactAndHostRoidSuffix") String roidSuffix;
@Inject ContactCreateFlow() {}
@Override
@@ -71,7 +73,7 @@ public final class ContactCreateFlow implements TransactionalFlow {
.setAuthInfo(command.getAuthInfo())
.setCreationClientId(clientId)
.setCurrentSponsorClientId(clientId)
- .setRepoId(createContactHostRoid(ObjectifyService.allocateId()))
+ .setRepoId(createRepoId(ObjectifyService.allocateId(), roidSuffix))
.setFaxNumber(command.getFax())
.setVoiceNumber(command.getVoice())
.setDisclose(command.getDisclose())
diff --git a/java/google/registry/flows/domain/DomainAllocateFlow.java b/java/google/registry/flows/domain/DomainAllocateFlow.java
index 7d6ae6ebe..4c3189028 100644
--- a/java/google/registry/flows/domain/DomainAllocateFlow.java
+++ b/java/google/registry/flows/domain/DomainAllocateFlow.java
@@ -28,7 +28,7 @@ import static google.registry.flows.domain.DomainFlowUtils.validateDomainName;
import static google.registry.flows.domain.DomainFlowUtils.validateDomainNameWithIdnTables;
import static google.registry.flows.domain.DomainFlowUtils.validateSecDnsExtension;
import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears;
-import static google.registry.model.EppResourceUtils.createDomainRoid;
+import static google.registry.model.EppResourceUtils.createDomainRepoId;
import static google.registry.model.EppResourceUtils.loadDomainApplication;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.label.ReservedList.matchesAnchorTenantReservation;
@@ -140,7 +140,7 @@ public class DomainAllocateFlow implements TransactionalFlow {
eppInput.getSingleExtension(AllocateCreateExtension.class);
DomainApplication application =
loadAndValidateApplication(allocateCreate.getApplicationRoid(), now);
- String repoId = createDomainRoid(ObjectifyService.allocateId(), registry.getTldStr());
+ String repoId = createDomainRepoId(ObjectifyService.allocateId(), registry.getTldStr());
ImmutableSet.Builder entitiesToSave = new ImmutableSet.Builder<>();
HistoryEntry historyEntry = buildHistory(repoId, period, now);
entitiesToSave.add(historyEntry);
diff --git a/java/google/registry/flows/domain/DomainApplicationCreateFlow.java b/java/google/registry/flows/domain/DomainApplicationCreateFlow.java
index 83705c54f..80617ae98 100644
--- a/java/google/registry/flows/domain/DomainApplicationCreateFlow.java
+++ b/java/google/registry/flows/domain/DomainApplicationCreateFlow.java
@@ -38,7 +38,7 @@ import static google.registry.flows.domain.DomainFlowUtils.verifyPremiumNameIsNo
import static google.registry.flows.domain.DomainFlowUtils.verifyRegistryStateAllowsLaunchFlows;
import static google.registry.flows.domain.DomainFlowUtils.verifySignedMarks;
import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears;
-import static google.registry.model.EppResourceUtils.createDomainRoid;
+import static google.registry.model.EppResourceUtils.createDomainRepoId;
import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.label.ReservedList.matchesAnchorTenantReservation;
@@ -232,7 +232,7 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow {
.setCreationTrid(trid)
.setCreationClientId(clientId)
.setCurrentSponsorClientId(clientId)
- .setRepoId(createDomainRoid(ObjectifyService.allocateId(), tld))
+ .setRepoId(createDomainRepoId(ObjectifyService.allocateId(), tld))
.setLaunchNotice(launchCreate == null ? null : launchCreate.getNotice())
.setIdnTableName(idnTableName)
.setPhase(launchCreate.getPhase())
diff --git a/java/google/registry/flows/domain/DomainCreateFlow.java b/java/google/registry/flows/domain/DomainCreateFlow.java
index 57a589864..cf0dac15f 100644
--- a/java/google/registry/flows/domain/DomainCreateFlow.java
+++ b/java/google/registry/flows/domain/DomainCreateFlow.java
@@ -36,7 +36,7 @@ import static google.registry.flows.domain.DomainFlowUtils.verifyNotReserved;
import static google.registry.flows.domain.DomainFlowUtils.verifyPremiumNameIsNotBlocked;
import static google.registry.flows.domain.DomainFlowUtils.verifySignedMarks;
import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears;
-import static google.registry.model.EppResourceUtils.createDomainRoid;
+import static google.registry.model.EppResourceUtils.createDomainRepoId;
import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.label.ReservedList.matchesAnchorTenantReservation;
@@ -233,7 +233,7 @@ public class DomainCreateFlow implements TransactionalFlow {
}
SecDnsCreateExtension secDnsCreate =
validateSecDnsExtension(eppInput.getSingleExtension(SecDnsCreateExtension.class));
- String repoId = createDomainRoid(ObjectifyService.allocateId(), registry.getTldStr());
+ String repoId = createDomainRepoId(ObjectifyService.allocateId(), registry.getTldStr());
DateTime registrationExpirationTime = leapSafeAddYears(now, years);
HistoryEntry historyEntry = buildHistory(repoId, period, now);
// Bill for the create.
diff --git a/java/google/registry/flows/host/HostCreateFlow.java b/java/google/registry/flows/host/HostCreateFlow.java
index e9a8a26f0..da1756990 100644
--- a/java/google/registry/flows/host/HostCreateFlow.java
+++ b/java/google/registry/flows/host/HostCreateFlow.java
@@ -19,7 +19,7 @@ import static google.registry.flows.ResourceFlowUtils.verifyResourceDoesNotExist
import static google.registry.flows.host.HostFlowUtils.lookupSuperordinateDomain;
import static google.registry.flows.host.HostFlowUtils.validateHostName;
import static google.registry.flows.host.HostFlowUtils.verifyDomainIsSameRegistrar;
-import static google.registry.model.EppResourceUtils.createContactHostRoid;
+import static google.registry.model.EppResourceUtils.createRepoId;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.CollectionUtils.isNullOrEmpty;
import static google.registry.util.CollectionUtils.union;
@@ -27,6 +27,7 @@ import static google.registry.util.CollectionUtils.union;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
+import google.registry.config.ConfigModule.Config;
import google.registry.dns.DnsQueue;
import google.registry.flows.EppException;
import google.registry.flows.EppException.ParameterValueRangeErrorException;
@@ -81,6 +82,7 @@ public final class HostCreateFlow implements TransactionalFlow {
@Inject HistoryEntry.Builder historyBuilder;
@Inject DnsQueue dnsQueue;
@Inject EppResponse.Builder responseBuilder;
+ @Inject @Config("contactAndHostRoidSuffix") String roidSuffix;
@Inject HostCreateFlow() {}
@Override
@@ -110,7 +112,7 @@ public final class HostCreateFlow implements TransactionalFlow {
.setCurrentSponsorClientId(clientId)
.setFullyQualifiedHostName(targetId)
.setInetAddresses(command.getInetAddresses())
- .setRepoId(createContactHostRoid(ObjectifyService.allocateId()))
+ .setRepoId(createRepoId(ObjectifyService.allocateId(), roidSuffix))
.setSuperordinateDomain(
superordinateDomain.isPresent() ? Key.create(superordinateDomain.get()) : null)
.build();
diff --git a/java/google/registry/model/EppResourceUtils.java b/java/google/registry/model/EppResourceUtils.java
index 31ffa5870..2dcae0035 100644
--- a/java/google/registry/model/EppResourceUtils.java
+++ b/java/google/registry/model/EppResourceUtils.java
@@ -27,7 +27,6 @@ import com.google.common.base.Function;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.Result;
import com.googlecode.objectify.util.ResultNow;
-import google.registry.config.RegistryEnvironment;
import google.registry.model.EppResource.Builder;
import google.registry.model.EppResource.BuilderWithTransferData;
import google.registry.model.EppResource.ForeignKeyedEppResource;
@@ -55,20 +54,13 @@ public final class EppResourceUtils {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
- /** Returns the full domain repoId of the format HEX-TLD for the specified long id and tld. */
- public static String createDomainRoid(long repoId, String tld) {
- return createRoid(repoId, getRoidSuffixForTld(tld));
+ /** Returns the full domain repoId in the format HEX-TLD for the specified long id and tld. */
+ public static String createDomainRepoId(long repoId, String tld) {
+ return createRepoId(repoId, getRoidSuffixForTld(tld));
}
- /**
- * Returns the full contact/host repoId of the format HEX-GOOGLE for the specified long repo id.
- */
- public static String createContactHostRoid(long repoId) {
- return createRoid(
- repoId, RegistryEnvironment.get().config().getContactAndHostRepositoryIdentifier());
- }
-
- private static String createRoid(long repoId, String roidSuffix) {
+ /** Returns the full repoId in the format HEX-TLD for the specified long id and ROID suffix. */
+ public static String createRepoId(long repoId, String roidSuffix) {
// %X is uppercase hexadecimal.
return String.format("%X-%s", repoId, roidSuffix);
}
diff --git a/javatests/google/registry/testing/DatastoreHelper.java b/javatests/google/registry/testing/DatastoreHelper.java
index 3851b31e5..a0af4e80d 100644
--- a/javatests/google/registry/testing/DatastoreHelper.java
+++ b/javatests/google/registry/testing/DatastoreHelper.java
@@ -20,9 +20,10 @@ import static com.google.common.base.Suppliers.memoize;
import static com.google.common.collect.Iterables.toArray;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
+import static google.registry.config.ConfigModule.LocalTestConfig.CONTACT_AND_HOST_ROID_SUFFIX;
import static google.registry.flows.ResourceFlowUtils.createTransferResponse;
-import static google.registry.model.EppResourceUtils.createContactHostRoid;
-import static google.registry.model.EppResourceUtils.createDomainRoid;
+import static google.registry.model.EppResourceUtils.createDomainRepoId;
+import static google.registry.model.EppResourceUtils.createRepoId;
import static google.registry.model.domain.launch.ApplicationStatus.VALIDATED;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
@@ -736,7 +737,7 @@ public class DatastoreHelper {
/** Returns a newly allocated, globally unique domain repoId of the format HEX-TLD. */
public static String generateNewDomainRoid(String tld) {
- return createDomainRoid(ObjectifyService.allocateId(), tld);
+ return createDomainRepoId(ObjectifyService.allocateId(), tld);
}
/**
@@ -744,7 +745,7 @@ public class DatastoreHelper {
* HEX_TLD-ROID.
*/
public static String generateNewContactHostRoid() {
- return createContactHostRoid(ObjectifyService.allocateId());
+ return createRepoId(ObjectifyService.allocateId(), CONTACT_AND_HOST_ROID_SUFFIX);
}
/**