Move ROID suffix handling from RegistryConfig to ConfigModule

This is the first in a decently long series of commits to delete RegistryConfig
entirely and centralize all configuration in ConfigModule using Dagger. Once
this is done, then the text-based YAML configuration work can begin in earnest.

Note that the configuration settings from TestRegistryConfig will be moving
into ConfigModule.LocalTestConfig. This way they can be referred to in a static
context from test and test utility helpers, rather than having to be injected
everywhere, which we don't typically bother with for tests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143473089
This commit is contained in:
mcilwain 2017-01-03 12:30:12 -08:00 committed by Ben McIlwain
parent ab3f352782
commit 0b112f17a7
11 changed files with 43 additions and 46 deletions

View file

@ -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);
}