mirror of
https://github.com/google/nomulus.git
synced 2025-07-25 03:58:34 +02:00
Change Registry class name to Tld (#1991)
* Change Registry class name to Tld * Fix merge conflict * Some capitalization fixes
This commit is contained in:
parent
371d83b4cc
commit
6f3d062c32
151 changed files with 1339 additions and 1411 deletions
|
@ -37,7 +37,7 @@ import google.registry.model.CreateAutoTimestamp;
|
||||||
import google.registry.model.EppResourceUtils;
|
import google.registry.model.EppResourceUtils;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.Parameter;
|
import google.registry.request.Parameter;
|
||||||
import google.registry.request.auth.Auth;
|
import google.registry.request.auth.Auth;
|
||||||
|
|
|
@ -48,7 +48,7 @@ import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.domain.Period;
|
import google.registry.model.domain.Period;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
||||||
import google.registry.util.Clock;
|
import google.registry.util.Clock;
|
||||||
import google.registry.util.SystemClock;
|
import google.registry.util.SystemClock;
|
||||||
|
@ -281,7 +281,7 @@ public class ExpandRecurringBillingEventsPipeline implements Serializable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Domain domain = tm().loadByKey(Domain.createVKey(recurring.getDomainRepoId()));
|
Domain domain = tm().loadByKey(Domain.createVKey(recurring.getDomainRepoId()));
|
||||||
Registry tld = Registry.get(domain.getTld());
|
Tld tld = Tld.get(domain.getTld());
|
||||||
|
|
||||||
// Find the times for which the OneTime billing event are already created, making this expansion
|
// Find the times for which the OneTime billing event are already created, making this expansion
|
||||||
// idempotent. There is no need to match to the domain repo ID as the cancellation matching
|
// idempotent. There is no need to match to the domain repo ID as the cancellation matching
|
||||||
|
|
|
@ -33,7 +33,7 @@ import google.registry.model.common.Cursor;
|
||||||
import google.registry.model.rde.RdeMode;
|
import google.registry.model.rde.RdeMode;
|
||||||
import google.registry.model.rde.RdeNamingUtils;
|
import google.registry.model.rde.RdeNamingUtils;
|
||||||
import google.registry.model.rde.RdeRevision;
|
import google.registry.model.rde.RdeRevision;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.rde.BrdaCopyAction;
|
import google.registry.rde.BrdaCopyAction;
|
||||||
import google.registry.rde.DepositFragment;
|
import google.registry.rde.DepositFragment;
|
||||||
import google.registry.rde.Ghostryde;
|
import google.registry.rde.Ghostryde;
|
||||||
|
@ -272,12 +272,12 @@ public class RdeIO {
|
||||||
tm().transact(
|
tm().transact(
|
||||||
() -> {
|
() -> {
|
||||||
PendingDeposit key = input.getKey();
|
PendingDeposit key = input.getKey();
|
||||||
Registry registry = Registry.get(key.tld());
|
Tld tld = Tld.get(key.tld());
|
||||||
Optional<Cursor> cursor =
|
Optional<Cursor> cursor =
|
||||||
tm().transact(
|
tm().transact(
|
||||||
() ->
|
() ->
|
||||||
tm().loadByKeyIfPresent(
|
tm().loadByKeyIfPresent(
|
||||||
Cursor.createScopedVKey(key.cursor(), registry)));
|
Cursor.createScopedVKey(key.cursor(), tld)));
|
||||||
DateTime position = getCursorTimeOrStartOfTime(cursor);
|
DateTime position = getCursorTimeOrStartOfTime(cursor);
|
||||||
checkState(key.interval() != null, "Interval must be present");
|
checkState(key.interval() != null, "Interval must be present");
|
||||||
DateTime newPosition = key.watermark().plus(key.interval());
|
DateTime newPosition = key.watermark().plus(key.interval());
|
||||||
|
@ -290,7 +290,7 @@ public class RdeIO {
|
||||||
"Partial ordering of RDE deposits broken: %s %s",
|
"Partial ordering of RDE deposits broken: %s %s",
|
||||||
position,
|
position,
|
||||||
key);
|
key);
|
||||||
tm().put(Cursor.createScoped(key.cursor(), newPosition, registry));
|
tm().put(Cursor.createScoped(key.cursor(), newPosition, tld));
|
||||||
logger.atInfo().log(
|
logger.atInfo().log(
|
||||||
"Rolled forward %s on %s cursor to %s.", key.cursor(), key.tld(), newPosition);
|
"Rolled forward %s on %s cursor to %s.", key.cursor(), key.tld(), newPosition);
|
||||||
RdeRevision.saveRevision(key.tld(), key.watermark(), key.mode(), input.getValue());
|
RdeRevision.saveRevision(key.tld(), key.watermark(), key.mode(), input.getValue());
|
||||||
|
|
|
@ -63,7 +63,7 @@ import org.joda.time.Duration;
|
||||||
* <p>This class does not represent the total configuration of the Nomulus service. It's <b>only
|
* <p>This class does not represent the total configuration of the Nomulus service. It's <b>only
|
||||||
* meant for settings that need to be configured <i>once</i></b>. Settings which may be subject to
|
* meant for settings that need to be configured <i>once</i></b>. Settings which may be subject to
|
||||||
* change in the future, should instead be retrieved from the database. The {@link
|
* change in the future, should instead be retrieved from the database. The {@link
|
||||||
* google.registry.model.tld.Registry Registry} class is one such example of this.
|
* google.registry.model.tld.Tld Tld} class is one such example of this.
|
||||||
*
|
*
|
||||||
* <p>Note: Only settings that are actually configurable belong in this file. It's not a catch-all
|
* <p>Note: Only settings that are actually configurable belong in this file. It's not a catch-all
|
||||||
* for anything widely used throughout the code base.
|
* for anything widely used throughout the code base.
|
||||||
|
|
|
@ -28,8 +28,8 @@ import static google.registry.cron.CronModule.JITTER_SECONDS_PARAM;
|
||||||
import static google.registry.cron.CronModule.QUEUE_PARAM;
|
import static google.registry.cron.CronModule.QUEUE_PARAM;
|
||||||
import static google.registry.cron.CronModule.RUN_IN_EMPTY_PARAM;
|
import static google.registry.cron.CronModule.RUN_IN_EMPTY_PARAM;
|
||||||
import static google.registry.model.tld.Registries.getTldsOfType;
|
import static google.registry.model.tld.Registries.getTldsOfType;
|
||||||
import static google.registry.model.tld.Registry.TldType.REAL;
|
import static google.registry.model.tld.Tld.TldType.REAL;
|
||||||
import static google.registry.model.tld.Registry.TldType.TEST;
|
import static google.registry.model.tld.Tld.TldType.TEST;
|
||||||
|
|
||||||
import com.google.cloud.tasks.v2.Task;
|
import com.google.cloud.tasks.v2.Task;
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import static com.google.common.base.Preconditions.checkState;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.flogger.FluentLogger;
|
import com.google.common.flogger.FluentLogger;
|
||||||
import google.registry.dns.writer.DnsWriter;
|
import google.registry.dns.writer.DnsWriter;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public final class DnsWriterProxy {
|
||||||
* If the DnsWriter doesn't belong to this TLD, will return null.
|
* If the DnsWriter doesn't belong to this TLD, will return null.
|
||||||
*/
|
*/
|
||||||
public DnsWriter getByClassNameForTld(String className, String tld) {
|
public DnsWriter getByClassNameForTld(String className, String tld) {
|
||||||
if (!Registry.get(tld).getDnsWriters().contains(className)) {
|
if (!Tld.get(tld).getDnsWriters().contains(className)) {
|
||||||
logger.atWarning().log(
|
logger.atWarning().log(
|
||||||
"Loaded potentially stale DNS writer %s which is not active on TLD %s.", className, tld);
|
"Loaded potentially stale DNS writer %s which is not active on TLD %s.", className, tld);
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -45,7 +45,7 @@ import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.Host;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.registrar.RegistrarPoc;
|
import google.registry.model.registrar.RegistrarPoc;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.Action.Service;
|
import google.registry.request.Action.Service;
|
||||||
import google.registry.request.Header;
|
import google.registry.request.Header;
|
||||||
|
@ -96,8 +96,8 @@ public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> {
|
||||||
*
|
*
|
||||||
* <p>This comes from the fanout in {@link ReadDnsQueueAction} which dispatches each batch to be
|
* <p>This comes from the fanout in {@link ReadDnsQueueAction} which dispatches each batch to be
|
||||||
* published by each DNS writer on the TLD. So this field contains the value of one of the DNS
|
* published by each DNS writer on the TLD. So this field contains the value of one of the DNS
|
||||||
* writers configured in {@link Registry#getDnsWriters()}, as of the time the batch was written
|
* writers configured in {@link Tld#getDnsWriters()}, as of the time the batch was written out
|
||||||
* out (and not necessarily currently).
|
* (and not necessarily currently).
|
||||||
*/
|
*/
|
||||||
private final String dnsWriter;
|
private final String dnsWriter;
|
||||||
|
|
||||||
|
@ -372,11 +372,11 @@ public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Check if the Registry object's num locks has changed since this task was batched
|
// Check if the Registry object's num locks has changed since this task was batched
|
||||||
int registryNumPublishLocks = Registry.get(tld).getNumDnsPublishLocks();
|
int tldNumPublishLocks = Tld.get(tld).getNumDnsPublishLocks();
|
||||||
if (registryNumPublishLocks != numPublishLocks) {
|
if (tldNumPublishLocks != numPublishLocks) {
|
||||||
logger.atWarning().log(
|
logger.atWarning().log(
|
||||||
"Registry numDnsPublishLocks %d out of sync with parameter %d.",
|
"Registry numDnsPublishLocks %d out of sync with parameter %d.",
|
||||||
registryNumPublishLocks, numPublishLocks);
|
tldNumPublishLocks, numPublishLocks);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -48,7 +48,7 @@ import google.registry.batch.CloudTasksUtils;
|
||||||
import google.registry.config.RegistryConfig.Config;
|
import google.registry.config.RegistryConfig.Config;
|
||||||
import google.registry.dns.DnsConstants.TargetType;
|
import google.registry.dns.DnsConstants.TargetType;
|
||||||
import google.registry.model.tld.Registries;
|
import google.registry.model.tld.Registries;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.Action.Service;
|
import google.registry.request.Action.Service;
|
||||||
import google.registry.request.Parameter;
|
import google.registry.request.Parameter;
|
||||||
|
@ -292,7 +292,7 @@ public final class ReadDnsQueueAction implements Runnable {
|
||||||
} else if (!tlds.contains(tld)) {
|
} else if (!tlds.contains(tld)) {
|
||||||
classifiedTasksBuilder.tasksToKeepBuilder().add(task);
|
classifiedTasksBuilder.tasksToKeepBuilder().add(task);
|
||||||
classifiedTasksBuilder.unknownTldsBuilder().add(tld);
|
classifiedTasksBuilder.unknownTldsBuilder().add(tld);
|
||||||
} else if (Registry.get(tld).getDnsPaused()) {
|
} else if (Tld.get(tld).getDnsPaused()) {
|
||||||
classifiedTasksBuilder.tasksToKeepBuilder().add(task);
|
classifiedTasksBuilder.tasksToKeepBuilder().add(task);
|
||||||
classifiedTasksBuilder.pausedTldsBuilder().add(tld);
|
classifiedTasksBuilder.pausedTldsBuilder().add(tld);
|
||||||
} else {
|
} else {
|
||||||
|
@ -330,7 +330,7 @@ public final class ReadDnsQueueAction implements Runnable {
|
||||||
for (Map.Entry<String, Collection<RefreshItem>> tldRefreshItemsEntry
|
for (Map.Entry<String, Collection<RefreshItem>> tldRefreshItemsEntry
|
||||||
: refreshItemsByTld.asMap().entrySet()) {
|
: refreshItemsByTld.asMap().entrySet()) {
|
||||||
String tld = tldRefreshItemsEntry.getKey();
|
String tld = tldRefreshItemsEntry.getKey();
|
||||||
int numPublishLocks = Registry.get(tld).getNumDnsPublishLocks();
|
int numPublishLocks = Tld.get(tld).getNumDnsPublishLocks();
|
||||||
// 1 lock or less implies no TLD-wide locks, simply enqueue everything under lock 1 of 1
|
// 1 lock or less implies no TLD-wide locks, simply enqueue everything under lock 1 of 1
|
||||||
if (numPublishLocks <= 1) {
|
if (numPublishLocks <= 1) {
|
||||||
enqueueUpdates(tld, 1, 1, tldRefreshItemsEntry.getValue());
|
enqueueUpdates(tld, 1, 1, tldRefreshItemsEntry.getValue());
|
||||||
|
@ -368,7 +368,7 @@ public final class ReadDnsQueueAction implements Runnable {
|
||||||
for (List<RefreshItem> chunk : Iterables.partition(items, tldUpdateBatchSize)) {
|
for (List<RefreshItem> chunk : Iterables.partition(items, tldUpdateBatchSize)) {
|
||||||
DateTime earliestCreateTime =
|
DateTime earliestCreateTime =
|
||||||
chunk.stream().map(RefreshItem::creationTime).min(Comparator.naturalOrder()).get();
|
chunk.stream().map(RefreshItem::creationTime).min(Comparator.naturalOrder()).get();
|
||||||
for (String dnsWriter : Registry.get(tld).getDnsWriters()) {
|
for (String dnsWriter : Tld.get(tld).getDnsWriters()) {
|
||||||
Task task =
|
Task task =
|
||||||
cloudTasksUtils.createPostTaskWithJitter(
|
cloudTasksUtils.createPostTaskWithJitter(
|
||||||
PublishDnsUpdatesAction.PATH,
|
PublishDnsUpdatesAction.PATH,
|
||||||
|
|
|
@ -41,7 +41,7 @@ import google.registry.batch.CloudTasksUtils;
|
||||||
import google.registry.config.RegistryConfig.Config;
|
import google.registry.config.RegistryConfig.Config;
|
||||||
import google.registry.dns.DnsConstants.TargetType;
|
import google.registry.dns.DnsConstants.TargetType;
|
||||||
import google.registry.model.common.DnsRefreshRequest;
|
import google.registry.model.common.DnsRefreshRequest;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.Action.Service;
|
import google.registry.request.Action.Service;
|
||||||
import google.registry.request.Parameter;
|
import google.registry.request.Parameter;
|
||||||
|
@ -102,14 +102,14 @@ public final class ReadDnsRefreshRequestsAction implements Runnable {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (Registry.get(tld).getDnsPaused()) {
|
if (Tld.get(tld).getDnsPaused()) {
|
||||||
logger.atInfo().log("The queue updated is paused for TLD: %s.", tld);
|
logger.atInfo().log("The queue updated is paused for TLD: %s.", tld);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DateTime requestedEndTime = clock.nowUtc().plus(requestedMaximumDuration);
|
DateTime requestedEndTime = clock.nowUtc().plus(requestedMaximumDuration);
|
||||||
// See getLockIndex(), requests are evenly distributed to [1, numDnsPublishLocks], so each
|
// See getLockIndex(), requests are evenly distributed to [1, numDnsPublishLocks], so each
|
||||||
// bucket would be roughly the size of tldUpdateBatchSize.
|
// bucket would be roughly the size of tldUpdateBatchSize.
|
||||||
int processBatchSize = tldUpdateBatchSize * Registry.get(tld).getNumDnsPublishLocks();
|
int processBatchSize = tldUpdateBatchSize * Tld.get(tld).getNumDnsPublishLocks();
|
||||||
while (requestedEndTime.isAfter(clock.nowUtc())) {
|
while (requestedEndTime.isAfter(clock.nowUtc())) {
|
||||||
ImmutableList<DnsRefreshRequest> requests =
|
ImmutableList<DnsRefreshRequest> requests =
|
||||||
dnsUtils.readAndUpdateRequestsWithLatestProcessTime(
|
dnsUtils.readAndUpdateRequestsWithLatestProcessTime(
|
||||||
|
@ -128,7 +128,7 @@ public final class ReadDnsRefreshRequestsAction implements Runnable {
|
||||||
* bucket, and then delete the requests in each bucket.
|
* bucket, and then delete the requests in each bucket.
|
||||||
*/
|
*/
|
||||||
void processRequests(Collection<DnsRefreshRequest> requests) {
|
void processRequests(Collection<DnsRefreshRequest> requests) {
|
||||||
int numPublishLocks = Registry.get(tld).getNumDnsPublishLocks();
|
int numPublishLocks = Tld.get(tld).getNumDnsPublishLocks();
|
||||||
requests.stream()
|
requests.stream()
|
||||||
.collect(
|
.collect(
|
||||||
toImmutableSetMultimap(
|
toImmutableSetMultimap(
|
||||||
|
@ -181,7 +181,7 @@ public final class ReadDnsRefreshRequestsAction implements Runnable {
|
||||||
}
|
}
|
||||||
ImmutableList<String> domains = domainsBuilder.build();
|
ImmutableList<String> domains = domainsBuilder.build();
|
||||||
ImmutableList<String> hosts = hostsBuilder.build();
|
ImmutableList<String> hosts = hostsBuilder.build();
|
||||||
for (String dnsWriter : Registry.get(tld).getDnsWriters()) {
|
for (String dnsWriter : Tld.get(tld).getDnsWriters()) {
|
||||||
Task task =
|
Task task =
|
||||||
cloudTasksUtils.createPostTaskWithJitter(
|
cloudTasksUtils.createPostTaskWithJitter(
|
||||||
PublishDnsUpdatesAction.PATH,
|
PublishDnsUpdatesAction.PATH,
|
||||||
|
|
|
@ -27,8 +27,8 @@ import com.google.common.flogger.FluentLogger;
|
||||||
import com.google.common.net.MediaType;
|
import com.google.common.net.MediaType;
|
||||||
import google.registry.config.RegistryConfig.Config;
|
import google.registry.config.RegistryConfig.Config;
|
||||||
import google.registry.gcs.GcsUtils;
|
import google.registry.gcs.GcsUtils;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.auth.Auth;
|
import google.registry.request.auth.Auth;
|
||||||
import google.registry.storage.drive.DriveConnection;
|
import google.registry.storage.drive.DriveConnection;
|
||||||
|
@ -106,27 +106,28 @@ public class ExportDomainListsAction implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean exportToDrive(
|
protected static boolean exportToDrive(
|
||||||
String tld, String domains, DriveConnection driveConnection) {
|
String tldStr, String domains, DriveConnection driveConnection) {
|
||||||
verifyNotNull(driveConnection, "Expecting non-null driveConnection");
|
verifyNotNull(driveConnection, "Expecting non-null driveConnection");
|
||||||
try {
|
try {
|
||||||
Registry registry = Registry.get(tld);
|
Tld tld = Tld.get(tldStr);
|
||||||
if (registry.getDriveFolderId() == null) {
|
if (tld.getDriveFolderId() == null) {
|
||||||
logger.atInfo().log(
|
logger.atInfo().log(
|
||||||
"Skipping registered domains export for TLD %s because Drive folder isn't specified.",
|
"Skipping registered domains export for TLD %s because Drive folder isn't specified.",
|
||||||
tld);
|
tldStr);
|
||||||
} else {
|
} else {
|
||||||
String resultMsg =
|
String resultMsg =
|
||||||
driveConnection.createOrUpdateFile(
|
driveConnection.createOrUpdateFile(
|
||||||
REGISTERED_DOMAINS_FILENAME,
|
REGISTERED_DOMAINS_FILENAME,
|
||||||
MediaType.PLAIN_TEXT_UTF_8,
|
MediaType.PLAIN_TEXT_UTF_8,
|
||||||
registry.getDriveFolderId(),
|
tld.getDriveFolderId(),
|
||||||
domains.getBytes(UTF_8));
|
domains.getBytes(UTF_8));
|
||||||
logger.atInfo().log(
|
logger.atInfo().log(
|
||||||
"Exporting registered domains succeeded for TLD %s, response was: %s", tld, resultMsg);
|
"Exporting registered domains succeeded for TLD %s, response was: %s",
|
||||||
|
tldStr, resultMsg);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.atSevere().withCause(e).log(
|
logger.atSevere().withCause(e).log(
|
||||||
"Error exporting registered domains for TLD %s to Drive, skipping...", tld);
|
"Error exporting registered domains for TLD %s to Drive, skipping...", tldStr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -29,7 +29,7 @@ import com.google.common.collect.Iterables;
|
||||||
import com.google.common.flogger.FluentLogger;
|
import com.google.common.flogger.FluentLogger;
|
||||||
import com.google.common.net.MediaType;
|
import com.google.common.net.MediaType;
|
||||||
import google.registry.config.RegistryConfig.Config;
|
import google.registry.config.RegistryConfig.Config;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.label.PremiumList.PremiumEntry;
|
import google.registry.model.tld.label.PremiumList.PremiumEntry;
|
||||||
import google.registry.model.tld.label.PremiumListDao;
|
import google.registry.model.tld.label.PremiumListDao;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
|
@ -61,7 +61,10 @@ public class ExportPremiumTermsAction implements Runnable {
|
||||||
@Config("premiumTermsExportDisclaimer")
|
@Config("premiumTermsExportDisclaimer")
|
||||||
String exportDisclaimer;
|
String exportDisclaimer;
|
||||||
|
|
||||||
@Inject @Parameter(RequestParameters.PARAM_TLD) String tld;
|
@Inject
|
||||||
|
@Parameter(RequestParameters.PARAM_TLD)
|
||||||
|
String tldStr;
|
||||||
|
|
||||||
@Inject Response response;
|
@Inject Response response;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -88,59 +91,59 @@ public class ExportPremiumTermsAction implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
response.setContentType(PLAIN_TEXT_UTF_8);
|
response.setContentType(PLAIN_TEXT_UTF_8);
|
||||||
try {
|
try {
|
||||||
Registry registry = Registry.get(tld);
|
Tld tld = Tld.get(tldStr);
|
||||||
String resultMsg = checkConfig(registry).orElseGet(() -> exportPremiumTerms(registry));
|
String resultMsg = checkConfig(tld).orElseGet(() -> exportPremiumTerms(tld));
|
||||||
response.setStatus(SC_OK);
|
response.setStatus(SC_OK);
|
||||||
response.setPayload(resultMsg);
|
response.setPayload(resultMsg);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
response.setStatus(SC_INTERNAL_SERVER_ERROR);
|
response.setStatus(SC_INTERNAL_SERVER_ERROR);
|
||||||
response.setPayload(e.getMessage());
|
response.setPayload(e.getMessage());
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
String.format("Exception occurred while exporting premium terms for TLD %s.", tld), e);
|
String.format("Exception occurred while exporting premium terms for TLD %s.", tldStr), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if {@code registry} is properly configured to export premium terms.
|
* Checks if {@link Tld} is properly configured to export premium terms.
|
||||||
*
|
*
|
||||||
* @return {@link Optional#empty()} if {@code registry} export may proceed. Otherwise returns an
|
* @return {@link Optional#empty()} if {@link Tld} export may proceed. Otherwise returns an error
|
||||||
* error message
|
* message
|
||||||
*/
|
*/
|
||||||
private Optional<String> checkConfig(Registry registry) {
|
private Optional<String> checkConfig(Tld tld) {
|
||||||
if (isNullOrEmpty(registry.getDriveFolderId())) {
|
if (isNullOrEmpty(tld.getDriveFolderId())) {
|
||||||
logger.atInfo().log(
|
logger.atInfo().log(
|
||||||
"Skipping premium terms export for TLD %s because Drive folder isn't specified.", tld);
|
"Skipping premium terms export for TLD %s because Drive folder isn't specified.", tldStr);
|
||||||
return Optional.of("Skipping export because no Drive folder is associated with this TLD");
|
return Optional.of("Skipping export because no Drive folder is associated with this TLD");
|
||||||
}
|
}
|
||||||
if (!registry.getPremiumListName().isPresent()) {
|
if (!tld.getPremiumListName().isPresent()) {
|
||||||
logger.atInfo().log("No premium terms to export for TLD '%s'.", tld);
|
logger.atInfo().log("No premium terms to export for TLD '%s'.", tldStr);
|
||||||
return Optional.of("No premium lists configured");
|
return Optional.of("No premium lists configured");
|
||||||
}
|
}
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String exportPremiumTerms(Registry registry) {
|
private String exportPremiumTerms(Tld tld) {
|
||||||
try {
|
try {
|
||||||
String fileId =
|
String fileId =
|
||||||
driveConnection.createOrUpdateFile(
|
driveConnection.createOrUpdateFile(
|
||||||
PREMIUM_TERMS_FILENAME,
|
PREMIUM_TERMS_FILENAME,
|
||||||
EXPORT_MIME_TYPE,
|
EXPORT_MIME_TYPE,
|
||||||
registry.getDriveFolderId(),
|
tld.getDriveFolderId(),
|
||||||
getFormattedPremiumTerms(registry).getBytes(UTF_8));
|
getFormattedPremiumTerms(tld).getBytes(UTF_8));
|
||||||
logger.atInfo().log(
|
logger.atInfo().log(
|
||||||
"Exporting premium terms succeeded for TLD %s, file ID is: %s", tld, fileId);
|
"Exporting premium terms succeeded for TLD %s, file ID is: %s", tldStr, fileId);
|
||||||
return fileId;
|
return fileId;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException("Error exporting premium terms file to Drive.", e);
|
throw new RuntimeException("Error exporting premium terms file to Drive.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getFormattedPremiumTerms(Registry registry) {
|
private String getFormattedPremiumTerms(Tld tld) {
|
||||||
checkState(registry.getPremiumListName().isPresent(), "%s does not have a premium list", tld);
|
checkState(tld.getPremiumListName().isPresent(), "%s does not have a premium list", tldStr);
|
||||||
String premiumListName = registry.getPremiumListName().get();
|
String premiumListName = tld.getPremiumListName().get();
|
||||||
checkState(
|
checkState(
|
||||||
PremiumListDao.getLatestRevision(premiumListName).isPresent(),
|
PremiumListDao.getLatestRevision(premiumListName).isPresent(),
|
||||||
"Could not load premium list for " + tld);
|
"Could not load premium list for " + tldStr);
|
||||||
SortedSet<String> premiumTerms =
|
SortedSet<String> premiumTerms =
|
||||||
PremiumListDao.loadAllPremiumEntries(premiumListName).stream()
|
PremiumListDao.loadAllPremiumEntries(premiumListName).stream()
|
||||||
.map(PremiumEntry::toString)
|
.map(PremiumEntry::toString)
|
||||||
|
|
|
@ -23,7 +23,7 @@ import static javax.servlet.http.HttpServletResponse.SC_OK;
|
||||||
|
|
||||||
import com.google.common.flogger.FluentLogger;
|
import com.google.common.flogger.FluentLogger;
|
||||||
import com.google.common.net.MediaType;
|
import com.google.common.net.MediaType;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.Parameter;
|
import google.registry.request.Parameter;
|
||||||
import google.registry.request.RequestParameters;
|
import google.registry.request.RequestParameters;
|
||||||
|
@ -46,7 +46,11 @@ public class ExportReservedTermsAction implements Runnable {
|
||||||
|
|
||||||
@Inject DriveConnection driveConnection;
|
@Inject DriveConnection driveConnection;
|
||||||
@Inject ExportUtils exportUtils;
|
@Inject ExportUtils exportUtils;
|
||||||
@Inject @Parameter(RequestParameters.PARAM_TLD) String tld;
|
|
||||||
|
@Inject
|
||||||
|
@Parameter(RequestParameters.PARAM_TLD)
|
||||||
|
String tldStr;
|
||||||
|
|
||||||
@Inject Response response;
|
@Inject Response response;
|
||||||
@Inject ExportReservedTermsAction() {}
|
@Inject ExportReservedTermsAction() {}
|
||||||
|
|
||||||
|
@ -61,23 +65,25 @@ public class ExportReservedTermsAction implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
response.setContentType(PLAIN_TEXT_UTF_8);
|
response.setContentType(PLAIN_TEXT_UTF_8);
|
||||||
try {
|
try {
|
||||||
Registry registry = Registry.get(tld);
|
Tld tld = Tld.get(tldStr);
|
||||||
String resultMsg;
|
String resultMsg;
|
||||||
if (registry.getReservedListNames().isEmpty() && isNullOrEmpty(registry.getDriveFolderId())) {
|
if (tld.getReservedListNames().isEmpty() && isNullOrEmpty(tld.getDriveFolderId())) {
|
||||||
resultMsg = "No reserved lists configured";
|
resultMsg = "No reserved lists configured";
|
||||||
logger.atInfo().log("No reserved terms to export for TLD '%s'.", tld);
|
logger.atInfo().log("No reserved terms to export for TLD '%s'.", tldStr);
|
||||||
} else if (registry.getDriveFolderId() == null) {
|
} else if (tld.getDriveFolderId() == null) {
|
||||||
resultMsg = "Skipping export because no Drive folder is associated with this TLD";
|
resultMsg = "Skipping export because no Drive folder is associated with this TLD";
|
||||||
logger.atInfo().log(
|
logger.atInfo().log(
|
||||||
"Skipping reserved terms export for TLD %s because Drive folder isn't specified.", tld);
|
"Skipping reserved terms export for TLD %s because Drive folder isn't specified.",
|
||||||
|
tldStr);
|
||||||
} else {
|
} else {
|
||||||
resultMsg = driveConnection.createOrUpdateFile(
|
resultMsg =
|
||||||
RESERVED_TERMS_FILENAME,
|
driveConnection.createOrUpdateFile(
|
||||||
EXPORT_MIME_TYPE,
|
RESERVED_TERMS_FILENAME,
|
||||||
registry.getDriveFolderId(),
|
EXPORT_MIME_TYPE,
|
||||||
exportUtils.exportReservedTerms(registry).getBytes(UTF_8));
|
tld.getDriveFolderId(),
|
||||||
|
exportUtils.exportReservedTerms(tld).getBytes(UTF_8));
|
||||||
logger.atInfo().log(
|
logger.atInfo().log(
|
||||||
"Exporting reserved terms succeeded for TLD %s, response was: %s", tld, resultMsg);
|
"Exporting reserved terms succeeded for TLD %s, response was: %s", tldStr, resultMsg);
|
||||||
}
|
}
|
||||||
response.setStatus(SC_OK);
|
response.setStatus(SC_OK);
|
||||||
response.setPayload(resultMsg);
|
response.setPayload(resultMsg);
|
||||||
|
@ -85,7 +91,8 @@ public class ExportReservedTermsAction implements Runnable {
|
||||||
response.setStatus(SC_INTERNAL_SERVER_ERROR);
|
response.setStatus(SC_INTERNAL_SERVER_ERROR);
|
||||||
response.setPayload(e.getMessage());
|
response.setPayload(e.getMessage());
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
String.format("Exception occurred while exporting reserved terms for TLD %s.", tld), e);
|
String.format("Exception occurred while exporting reserved terms for TLD %s.", tldStr),
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.export;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import google.registry.config.RegistryConfig.Config;
|
import google.registry.config.RegistryConfig.Config;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.label.ReservedList;
|
import google.registry.model.tld.label.ReservedList;
|
||||||
import google.registry.model.tld.label.ReservedList.ReservedListEntry;
|
import google.registry.model.tld.label.ReservedList.ReservedListEntry;
|
||||||
import google.registry.model.tld.label.ReservedListDao;
|
import google.registry.model.tld.label.ReservedListDao;
|
||||||
|
@ -36,10 +36,10 @@ public final class ExportUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the file contents of the auto-export reserved terms document for the given TLD. */
|
/** Returns the file contents of the auto-export reserved terms document for the given TLD. */
|
||||||
public String exportReservedTerms(Registry registry) {
|
public String exportReservedTerms(Tld tld) {
|
||||||
StringBuilder termsBuilder = new StringBuilder(reservedTermsExportDisclaimer).append("\n");
|
StringBuilder termsBuilder = new StringBuilder(reservedTermsExportDisclaimer).append("\n");
|
||||||
Set<String> reservedTerms = new TreeSet<>();
|
Set<String> reservedTerms = new TreeSet<>();
|
||||||
for (String reservedListName : registry.getReservedListNames()) {
|
for (String reservedListName : tld.getReservedListNames()) {
|
||||||
ReservedList reservedList =
|
ReservedList reservedList =
|
||||||
ReservedListDao.getLatestRevision(reservedListName)
|
ReservedListDao.getLatestRevision(reservedListName)
|
||||||
.orElseThrow(
|
.orElseThrow(
|
||||||
|
|
|
@ -46,7 +46,7 @@ import google.registry.flows.domain.DomainFlowUtils.BadCommandForRegistryPhaseEx
|
||||||
import google.registry.flows.domain.DomainFlowUtils.InvalidIdnDomainLabelException;
|
import google.registry.flows.domain.DomainFlowUtils.InvalidIdnDomainLabelException;
|
||||||
import google.registry.model.ForeignKeyUtils;
|
import google.registry.model.ForeignKeyUtils;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.label.ReservationType;
|
import google.registry.model.tld.label.ReservationType;
|
||||||
import google.registry.monitoring.whitebox.CheckApiMetric;
|
import google.registry.monitoring.whitebox.CheckApiMetric;
|
||||||
import google.registry.monitoring.whitebox.CheckApiMetric.Availability;
|
import google.registry.monitoring.whitebox.CheckApiMetric.Availability;
|
||||||
|
@ -116,9 +116,9 @@ public class CheckApiAction implements Runnable {
|
||||||
validateDomainNameWithIdnTables(domainName);
|
validateDomainNameWithIdnTables(domainName);
|
||||||
|
|
||||||
DateTime now = clock.nowUtc();
|
DateTime now = clock.nowUtc();
|
||||||
Registry registry = Registry.get(domainName.parent().toString());
|
Tld tld = Tld.get(domainName.parent().toString());
|
||||||
try {
|
try {
|
||||||
verifyNotInPredelegation(registry, now);
|
verifyNotInPredelegation(tld, now);
|
||||||
} catch (BadCommandForRegistryPhaseException e) {
|
} catch (BadCommandForRegistryPhaseException e) {
|
||||||
metricBuilder.status(INVALID_REGISTRY_PHASE);
|
metricBuilder.status(INVALID_REGISTRY_PHASE);
|
||||||
return fail("Check in this TLD is not allowed in the current registry phase");
|
return fail("Check in this TLD is not allowed in the current registry phase");
|
||||||
|
|
|
@ -23,7 +23,7 @@ import google.registry.flows.domain.DomainPricingLogic;
|
||||||
import google.registry.flows.domain.FeesAndCredits;
|
import google.registry.flows.domain.FeesAndCredits;
|
||||||
import google.registry.model.ImmutableObject;
|
import google.registry.model.ImmutableObject;
|
||||||
import google.registry.model.eppinput.EppInput;
|
import google.registry.model.eppinput.EppInput;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
public abstract FeesAndCredits feesAndCredits();
|
public abstract FeesAndCredits feesAndCredits();
|
||||||
|
|
||||||
public abstract Registry registry();
|
public abstract Tld tld();
|
||||||
|
|
||||||
public abstract InternetDomainName domainName();
|
public abstract InternetDomainName domainName();
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||||
|
|
||||||
public abstract Builder setRegistry(Registry registry);
|
public abstract Builder setTld(Tld tld);
|
||||||
|
|
||||||
public abstract Builder setDomainName(InternetDomainName domainName);
|
public abstract Builder setDomainName(InternetDomainName domainName);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
public abstract FeesAndCredits feesAndCredits();
|
public abstract FeesAndCredits feesAndCredits();
|
||||||
|
|
||||||
public abstract Registry registry();
|
public abstract Tld tld();
|
||||||
|
|
||||||
public abstract InternetDomainName domainName();
|
public abstract InternetDomainName domainName();
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||||
|
|
||||||
public abstract Builder setRegistry(Registry registry);
|
public abstract Builder setTld(Tld tld);
|
||||||
|
|
||||||
public abstract Builder setDomainName(InternetDomainName domainName);
|
public abstract Builder setDomainName(InternetDomainName domainName);
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
public abstract FeesAndCredits feesAndCredits();
|
public abstract FeesAndCredits feesAndCredits();
|
||||||
|
|
||||||
public abstract Registry registry();
|
public abstract Tld tld();
|
||||||
|
|
||||||
public abstract InternetDomainName domainName();
|
public abstract InternetDomainName domainName();
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||||
|
|
||||||
public abstract Builder setRegistry(Registry registry);
|
public abstract Builder setTld(Tld tld);
|
||||||
|
|
||||||
public abstract Builder setDomainName(InternetDomainName domainName);
|
public abstract Builder setDomainName(InternetDomainName domainName);
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
public abstract FeesAndCredits feesAndCredits();
|
public abstract FeesAndCredits feesAndCredits();
|
||||||
|
|
||||||
public abstract Registry registry();
|
public abstract Tld tld();
|
||||||
|
|
||||||
public abstract InternetDomainName domainName();
|
public abstract InternetDomainName domainName();
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||||
|
|
||||||
public abstract Builder setRegistry(Registry registry);
|
public abstract Builder setTld(Tld tld);
|
||||||
|
|
||||||
public abstract Builder setDomainName(InternetDomainName domainName);
|
public abstract Builder setDomainName(InternetDomainName domainName);
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
public abstract FeesAndCredits feesAndCredits();
|
public abstract FeesAndCredits feesAndCredits();
|
||||||
|
|
||||||
public abstract Registry registry();
|
public abstract Tld tld();
|
||||||
|
|
||||||
public abstract InternetDomainName domainName();
|
public abstract InternetDomainName domainName();
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||||
|
|
||||||
public abstract Builder setRegistry(Registry registry);
|
public abstract Builder setTld(Tld tld);
|
||||||
|
|
||||||
public abstract Builder setDomainName(InternetDomainName domainName);
|
public abstract Builder setDomainName(InternetDomainName domainName);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import static google.registry.flows.domain.DomainFlowUtils.isValidReservedCreate
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateDomainName;
|
import static google.registry.flows.domain.DomainFlowUtils.validateDomainName;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateDomainNameWithIdnTables;
|
import static google.registry.flows.domain.DomainFlowUtils.validateDomainNameWithIdnTables;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPredelegation;
|
import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPredelegation;
|
||||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||||
import static google.registry.model.tld.label.ReservationType.getTypeOfHighestSeverity;
|
import static google.registry.model.tld.label.ReservationType.getTypeOfHighestSeverity;
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
|
|
||||||
|
@ -77,8 +77,8 @@ import google.registry.model.eppoutput.CheckData.DomainCheckData;
|
||||||
import google.registry.model.eppoutput.EppResponse;
|
import google.registry.model.eppoutput.EppResponse;
|
||||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import google.registry.model.tld.label.ReservationType;
|
import google.registry.model.tld.label.ReservationType;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.util.Clock;
|
import google.registry.util.Clock;
|
||||||
|
@ -164,7 +164,7 @@ public final class DomainCheckFlow implements Flow {
|
||||||
if (tldFirstTimeSeen && !isSuperuser) {
|
if (tldFirstTimeSeen && !isSuperuser) {
|
||||||
checkAllowedAccessToTld(registrarId, tld);
|
checkAllowedAccessToTld(registrarId, tld);
|
||||||
checkHasBillingAccount(registrarId, tld);
|
checkHasBillingAccount(registrarId, tld);
|
||||||
verifyNotInPredelegation(Registry.get(tld), now);
|
verifyNotInPredelegation(Tld.get(tld), now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImmutableMap<String, InternetDomainName> parsedDomains = parsedDomainsBuilder.build();
|
ImmutableMap<String, InternetDomainName> parsedDomains = parsedDomainsBuilder.build();
|
||||||
|
@ -190,7 +190,7 @@ public final class DomainCheckFlow implements Flow {
|
||||||
ImmutableList.Builder<DomainCheck> checksBuilder = new ImmutableList.Builder<>();
|
ImmutableList.Builder<DomainCheck> checksBuilder = new ImmutableList.Builder<>();
|
||||||
ImmutableSet.Builder<String> availableDomains = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<String> availableDomains = new ImmutableSet.Builder<>();
|
||||||
ImmutableMap<String, TldState> tldStates =
|
ImmutableMap<String, TldState> tldStates =
|
||||||
Maps.toMap(seenTlds, tld -> Registry.get(tld).getTldState(now));
|
Maps.toMap(seenTlds, tld -> Tld.get(tld).getTldState(now));
|
||||||
ImmutableMap<InternetDomainName, String> domainCheckResults =
|
ImmutableMap<InternetDomainName, String> domainCheckResults =
|
||||||
tokenDomainCheckResults
|
tokenDomainCheckResults
|
||||||
.map(AllocationTokenDomainCheckResults::domainCheckResults)
|
.map(AllocationTokenDomainCheckResults::domainCheckResults)
|
||||||
|
@ -278,7 +278,7 @@ public final class DomainCheckFlow implements Flow {
|
||||||
for (String domainName : getDomainNamesToCheckForFee(feeCheckItem, domainNames.keySet())) {
|
for (String domainName : getDomainNamesToCheckForFee(feeCheckItem, domainNames.keySet())) {
|
||||||
Optional<AllocationToken> defaultToken =
|
Optional<AllocationToken> defaultToken =
|
||||||
DomainFlowUtils.checkForDefaultToken(
|
DomainFlowUtils.checkForDefaultToken(
|
||||||
Registry.get(InternetDomainName.from(domainName).parent().toString()),
|
Tld.get(InternetDomainName.from(domainName).parent().toString()),
|
||||||
domainName,
|
domainName,
|
||||||
feeCheckItem.getCommandName(),
|
feeCheckItem.getCommandName(),
|
||||||
registrarId,
|
registrarId,
|
||||||
|
@ -313,7 +313,7 @@ public final class DomainCheckFlow implements Flow {
|
||||||
| AllocationTokenNotInPromotionException e) {
|
| AllocationTokenNotInPromotionException e) {
|
||||||
// Allocation token is either not an active token or it is not valid for the EPP command,
|
// Allocation token is either not an active token or it is not valid for the EPP command,
|
||||||
// registrar, domain, or TLD.
|
// registrar, domain, or TLD.
|
||||||
Registry registry = Registry.get(InternetDomainName.from(domainName).parent().toString());
|
Tld tld = Tld.get(InternetDomainName.from(domainName).parent().toString());
|
||||||
responseItems.add(
|
responseItems.add(
|
||||||
builder
|
builder
|
||||||
.setDomainNameIfSupported(domainName)
|
.setDomainNameIfSupported(domainName)
|
||||||
|
@ -322,7 +322,7 @@ public final class DomainCheckFlow implements Flow {
|
||||||
feeCheckItem.getCommandName(),
|
feeCheckItem.getCommandName(),
|
||||||
feeCheckItem.getPhase(),
|
feeCheckItem.getPhase(),
|
||||||
feeCheckItem.getSubphase())
|
feeCheckItem.getSubphase())
|
||||||
.setCurrencyIfSupported(registry.getCurrency())
|
.setCurrencyIfSupported(tld.getCurrency())
|
||||||
.setClass("token-not-supported")
|
.setClass("token-not-supported")
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ import google.registry.model.eppinput.EppInput;
|
||||||
import google.registry.model.eppinput.ResourceCommand;
|
import google.registry.model.eppinput.ResourceCommand;
|
||||||
import google.registry.model.eppoutput.EppResponse;
|
import google.registry.model.eppoutput.EppResponse;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tmch.ClaimsListDao;
|
import google.registry.model.tmch.ClaimsListDao;
|
||||||
import google.registry.util.Clock;
|
import google.registry.util.Clock;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -96,16 +96,16 @@ public final class DomainClaimsCheckFlow implements Flow {
|
||||||
for (String domainName : ImmutableSet.copyOf(domainNames)) {
|
for (String domainName : ImmutableSet.copyOf(domainNames)) {
|
||||||
InternetDomainName parsedDomain = validateDomainName(domainName);
|
InternetDomainName parsedDomain = validateDomainName(domainName);
|
||||||
validateDomainNameWithIdnTables(parsedDomain);
|
validateDomainNameWithIdnTables(parsedDomain);
|
||||||
String tld = parsedDomain.parent().toString();
|
String tldStr = parsedDomain.parent().toString();
|
||||||
// Only validate access to a TLD the first time it is encountered.
|
// Only validate access to a TLD the first time it is encountered.
|
||||||
if (seenTlds.add(tld)) {
|
if (seenTlds.add(tldStr)) {
|
||||||
if (!isSuperuser) {
|
if (!isSuperuser) {
|
||||||
checkAllowedAccessToTld(registrarId, tld);
|
checkAllowedAccessToTld(registrarId, tldStr);
|
||||||
checkHasBillingAccount(registrarId, tld);
|
checkHasBillingAccount(registrarId, tldStr);
|
||||||
Registry registry = Registry.get(tld);
|
Tld tld = Tld.get(tldStr);
|
||||||
DateTime now = clock.nowUtc();
|
DateTime now = clock.nowUtc();
|
||||||
verifyNotInPredelegation(registry, now);
|
verifyNotInPredelegation(tld, now);
|
||||||
verifyClaimsPeriodNotEnded(registry, now);
|
verifyClaimsPeriodNotEnded(tld, now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Optional<String> claimKey = ClaimsListDao.get().getClaimKey(parsedDomain.parts().get(0));
|
Optional<String> claimKey = ClaimsListDao.get().getClaimKey(parsedDomain.parts().get(0));
|
||||||
|
|
|
@ -47,9 +47,9 @@ import static google.registry.model.EppResourceUtils.createDomainRepoId;
|
||||||
import static google.registry.model.IdService.allocateId;
|
import static google.registry.model.IdService.allocateId;
|
||||||
import static google.registry.model.eppcommon.StatusValue.SERVER_HOLD;
|
import static google.registry.model.eppcommon.StatusValue.SERVER_HOLD;
|
||||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
|
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
|
||||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||||
import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD;
|
import static google.registry.model.tld.Tld.TldState.QUIET_PERIOD;
|
||||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||||
import static google.registry.model.tld.label.ReservationType.NAME_COLLISION;
|
import static google.registry.model.tld.label.ReservationType.NAME_COLLISION;
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||||
|
@ -112,9 +112,9 @@ import google.registry.model.reporting.DomainTransactionRecord.TransactionReport
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.model.tld.label.ReservationType;
|
import google.registry.model.tld.label.ReservationType;
|
||||||
import google.registry.model.tmch.ClaimsList;
|
import google.registry.model.tmch.ClaimsList;
|
||||||
import google.registry.model.tmch.ClaimsListDao;
|
import google.registry.model.tmch.ClaimsListDao;
|
||||||
|
@ -253,9 +253,9 @@ public final class DomainCreateFlow implements TransactionalFlow {
|
||||||
// Validate that this is actually a legal domain name on a TLD that the registrar has access to.
|
// Validate that this is actually a legal domain name on a TLD that the registrar has access to.
|
||||||
InternetDomainName domainName = validateDomainName(command.getDomainName());
|
InternetDomainName domainName = validateDomainName(command.getDomainName());
|
||||||
String domainLabel = domainName.parts().get(0);
|
String domainLabel = domainName.parts().get(0);
|
||||||
Registry registry = Registry.get(domainName.parent().toString());
|
Tld tld = Tld.get(domainName.parent().toString());
|
||||||
validateCreateCommandContactsAndNameservers(command, registry, domainName);
|
validateCreateCommandContactsAndNameservers(command, tld, domainName);
|
||||||
TldState tldState = registry.getTldState(now);
|
TldState tldState = tld.getTldState(now);
|
||||||
Optional<LaunchCreateExtension> launchCreate =
|
Optional<LaunchCreateExtension> launchCreate =
|
||||||
eppInput.getSingleExtension(LaunchCreateExtension.class);
|
eppInput.getSingleExtension(LaunchCreateExtension.class);
|
||||||
boolean hasSignedMarks =
|
boolean hasSignedMarks =
|
||||||
|
@ -270,7 +270,7 @@ public final class DomainCreateFlow implements TransactionalFlow {
|
||||||
Optional<AllocationToken> allocationToken =
|
Optional<AllocationToken> allocationToken =
|
||||||
allocationTokenFlowUtils.verifyAllocationTokenCreateIfPresent(
|
allocationTokenFlowUtils.verifyAllocationTokenCreateIfPresent(
|
||||||
command,
|
command,
|
||||||
registry,
|
tld,
|
||||||
registrarId,
|
registrarId,
|
||||||
now,
|
now,
|
||||||
eppInput.getSingleExtension(AllocationTokenExtension.class));
|
eppInput.getSingleExtension(AllocationTokenExtension.class));
|
||||||
|
@ -278,7 +278,7 @@ public final class DomainCreateFlow implements TransactionalFlow {
|
||||||
if (!allocationToken.isPresent()) {
|
if (!allocationToken.isPresent()) {
|
||||||
allocationToken =
|
allocationToken =
|
||||||
DomainFlowUtils.checkForDefaultToken(
|
DomainFlowUtils.checkForDefaultToken(
|
||||||
registry, command.getDomainName(), CommandName.CREATE, registrarId, now);
|
tld, command.getDomainName(), CommandName.CREATE, registrarId, now);
|
||||||
if (allocationToken.isPresent()) {
|
if (allocationToken.isPresent()) {
|
||||||
defaultTokenUsed = true;
|
defaultTokenUsed = true;
|
||||||
}
|
}
|
||||||
|
@ -291,12 +291,12 @@ public final class DomainCreateFlow implements TransactionalFlow {
|
||||||
// notice without specifying a claims key, ignore the registry phase, and override blocks on
|
// notice without specifying a claims key, ignore the registry phase, and override blocks on
|
||||||
// registering premium domains.
|
// registering premium domains.
|
||||||
if (!isSuperuser) {
|
if (!isSuperuser) {
|
||||||
checkAllowedAccessToTld(registrarId, registry.getTldStr());
|
checkAllowedAccessToTld(registrarId, tld.getTldStr());
|
||||||
checkHasBillingAccount(registrarId, registry.getTldStr());
|
checkHasBillingAccount(registrarId, tld.getTldStr());
|
||||||
boolean isValidReservedCreate = isValidReservedCreate(domainName, allocationToken);
|
boolean isValidReservedCreate = isValidReservedCreate(domainName, allocationToken);
|
||||||
ClaimsList claimsList = ClaimsListDao.get();
|
ClaimsList claimsList = ClaimsListDao.get();
|
||||||
verifyIsGaOrSpecialCase(
|
verifyIsGaOrSpecialCase(
|
||||||
registry,
|
tld,
|
||||||
claimsList,
|
claimsList,
|
||||||
now,
|
now,
|
||||||
domainLabel,
|
domainLabel,
|
||||||
|
@ -305,15 +305,15 @@ public final class DomainCreateFlow implements TransactionalFlow {
|
||||||
isValidReservedCreate,
|
isValidReservedCreate,
|
||||||
hasSignedMarks);
|
hasSignedMarks);
|
||||||
if (launchCreate.isPresent()) {
|
if (launchCreate.isPresent()) {
|
||||||
verifyLaunchPhaseMatchesRegistryPhase(registry, launchCreate.get(), now);
|
verifyLaunchPhaseMatchesRegistryPhase(tld, launchCreate.get(), now);
|
||||||
}
|
}
|
||||||
if (!isAnchorTenant && !isValidReservedCreate) {
|
if (!isAnchorTenant && !isValidReservedCreate) {
|
||||||
verifyNotReserved(domainName, isSunriseCreate);
|
verifyNotReserved(domainName, isSunriseCreate);
|
||||||
}
|
}
|
||||||
if (hasClaimsNotice) {
|
if (hasClaimsNotice) {
|
||||||
verifyClaimsPeriodNotEnded(registry, now);
|
verifyClaimsPeriodNotEnded(tld, now);
|
||||||
}
|
}
|
||||||
if (now.isBefore(registry.getClaimsPeriodEnd())) {
|
if (now.isBefore(tld.getClaimsPeriodEnd())) {
|
||||||
verifyClaimsNoticeIfAndOnlyIfNeeded(
|
verifyClaimsNoticeIfAndOnlyIfNeeded(
|
||||||
domainName, claimsList, hasSignedMarks, hasClaimsNotice);
|
domainName, claimsList, hasSignedMarks, hasClaimsNotice);
|
||||||
}
|
}
|
||||||
|
@ -338,20 +338,19 @@ public final class DomainCreateFlow implements TransactionalFlow {
|
||||||
Optional<FeeCreateCommandExtension> feeCreate =
|
Optional<FeeCreateCommandExtension> feeCreate =
|
||||||
eppInput.getSingleExtension(FeeCreateCommandExtension.class);
|
eppInput.getSingleExtension(FeeCreateCommandExtension.class);
|
||||||
FeesAndCredits feesAndCredits =
|
FeesAndCredits feesAndCredits =
|
||||||
pricingLogic.getCreatePrice(
|
pricingLogic.getCreatePrice(tld, targetId, now, years, isAnchorTenant, allocationToken);
|
||||||
registry, targetId, now, years, isAnchorTenant, allocationToken);
|
|
||||||
validateFeeChallenge(feeCreate, feesAndCredits, defaultTokenUsed);
|
validateFeeChallenge(feeCreate, feesAndCredits, defaultTokenUsed);
|
||||||
Optional<SecDnsCreateExtension> secDnsCreate =
|
Optional<SecDnsCreateExtension> secDnsCreate =
|
||||||
validateSecDnsExtension(eppInput.getSingleExtension(SecDnsCreateExtension.class));
|
validateSecDnsExtension(eppInput.getSingleExtension(SecDnsCreateExtension.class));
|
||||||
DateTime registrationExpirationTime = leapSafeAddYears(now, years);
|
DateTime registrationExpirationTime = leapSafeAddYears(now, years);
|
||||||
String repoId = createDomainRepoId(allocateId(), registry.getTldStr());
|
String repoId = createDomainRepoId(allocateId(), tld.getTldStr());
|
||||||
long historyRevisionId = allocateId();
|
long historyRevisionId = allocateId();
|
||||||
HistoryEntryId domainHistoryId = new HistoryEntryId(repoId, historyRevisionId);
|
HistoryEntryId domainHistoryId = new HistoryEntryId(repoId, historyRevisionId);
|
||||||
historyBuilder.setRevisionId(historyRevisionId);
|
historyBuilder.setRevisionId(historyRevisionId);
|
||||||
// Bill for the create.
|
// Bill for the create.
|
||||||
BillingEvent.OneTime createBillingEvent =
|
BillingEvent.OneTime createBillingEvent =
|
||||||
createOneTimeBillingEvent(
|
createOneTimeBillingEvent(
|
||||||
registry,
|
tld,
|
||||||
isAnchorTenant,
|
isAnchorTenant,
|
||||||
isSunriseCreate,
|
isSunriseCreate,
|
||||||
isReserved(domainName, isSunriseCreate),
|
isReserved(domainName, isSunriseCreate),
|
||||||
|
@ -414,7 +413,7 @@ public final class DomainCreateFlow implements TransactionalFlow {
|
||||||
domain.asBuilder().setCurrentPackageToken(allocationToken.get().createVKey()).build();
|
domain.asBuilder().setCurrentPackageToken(allocationToken.get().createVKey()).build();
|
||||||
}
|
}
|
||||||
DomainHistory domainHistory =
|
DomainHistory domainHistory =
|
||||||
buildDomainHistory(domain, registry, now, period, registry.getAddGracePeriodLength());
|
buildDomainHistory(domain, tld, now, period, tld.getAddGracePeriodLength());
|
||||||
if (reservationTypes.contains(NAME_COLLISION)) {
|
if (reservationTypes.contains(NAME_COLLISION)) {
|
||||||
entitiesToSave.add(
|
entitiesToSave.add(
|
||||||
createNameCollisionOneTimePollMessage(targetId, domainHistory, registrarId, now));
|
createNameCollisionOneTimePollMessage(targetId, domainHistory, registrarId, now));
|
||||||
|
@ -493,7 +492,7 @@ public final class DomainCreateFlow implements TransactionalFlow {
|
||||||
* non-superusers.
|
* non-superusers.
|
||||||
*/
|
*/
|
||||||
private void verifyIsGaOrSpecialCase(
|
private void verifyIsGaOrSpecialCase(
|
||||||
Registry registry,
|
Tld tld,
|
||||||
ClaimsList claimsList,
|
ClaimsList claimsList,
|
||||||
DateTime now,
|
DateTime now,
|
||||||
String domainLabel,
|
String domainLabel,
|
||||||
|
@ -505,7 +504,7 @@ public final class DomainCreateFlow implements TransactionalFlow {
|
||||||
MustHaveSignedMarksInCurrentPhaseException,
|
MustHaveSignedMarksInCurrentPhaseException,
|
||||||
NoTrademarkedRegistrationsBeforeSunriseException {
|
NoTrademarkedRegistrationsBeforeSunriseException {
|
||||||
// We allow general registration during GA.
|
// We allow general registration during GA.
|
||||||
TldState currentState = registry.getTldState(now);
|
TldState currentState = tld.getTldState(now);
|
||||||
if (currentState.equals(GENERAL_AVAILABILITY)) {
|
if (currentState.equals(GENERAL_AVAILABILITY)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -526,7 +525,7 @@ public final class DomainCreateFlow implements TransactionalFlow {
|
||||||
// Trademarked domains cannot be registered until after the sunrise period has ended, unless
|
// Trademarked domains cannot be registered until after the sunrise period has ended, unless
|
||||||
// a valid signed mark is provided. Signed marks can only be provided during sunrise.
|
// a valid signed mark is provided. Signed marks can only be provided during sunrise.
|
||||||
// Thus, when bypassing TLD state checks, a post-sunrise state is always fine.
|
// Thus, when bypassing TLD state checks, a post-sunrise state is always fine.
|
||||||
if (registry.getTldStateTransitions().headMap(now).containsValue(START_DATE_SUNRISE)) {
|
if (tld.getTldStateTransitions().headMap(now).containsValue(START_DATE_SUNRISE)) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// If sunrise hasn't happened yet, trademarked domains are unavailable
|
// If sunrise hasn't happened yet, trademarked domains are unavailable
|
||||||
|
@ -559,23 +558,22 @@ public final class DomainCreateFlow implements TransactionalFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
private DomainHistory buildDomainHistory(
|
private DomainHistory buildDomainHistory(
|
||||||
Domain domain, Registry registry, DateTime now, Period period, Duration addGracePeriod) {
|
Domain domain, Tld tld, DateTime now, Period period, Duration addGracePeriod) {
|
||||||
// We ignore prober transactions
|
// We ignore prober transactions
|
||||||
if (registry.getTldType() == TldType.REAL) {
|
if (tld.getTldType() == TldType.REAL) {
|
||||||
historyBuilder
|
historyBuilder.setDomainTransactionRecords(
|
||||||
.setDomainTransactionRecords(
|
ImmutableSet.of(
|
||||||
ImmutableSet.of(
|
DomainTransactionRecord.create(
|
||||||
DomainTransactionRecord.create(
|
tld.getTldStr(),
|
||||||
registry.getTldStr(),
|
now.plus(addGracePeriod),
|
||||||
now.plus(addGracePeriod),
|
TransactionReportField.netAddsFieldFromYears(period.getValue()),
|
||||||
TransactionReportField.netAddsFieldFromYears(period.getValue()),
|
1)));
|
||||||
1)));
|
|
||||||
}
|
}
|
||||||
return historyBuilder.setType(DOMAIN_CREATE).setPeriod(period).setDomain(domain).build();
|
return historyBuilder.setType(DOMAIN_CREATE).setPeriod(period).setDomain(domain).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private BillingEvent.OneTime createOneTimeBillingEvent(
|
private BillingEvent.OneTime createOneTimeBillingEvent(
|
||||||
Registry registry,
|
Tld tld,
|
||||||
boolean isAnchorTenant,
|
boolean isAnchorTenant,
|
||||||
boolean isSunriseCreate,
|
boolean isSunriseCreate,
|
||||||
boolean isReserved,
|
boolean isReserved,
|
||||||
|
@ -607,8 +605,8 @@ public final class DomainCreateFlow implements TransactionalFlow {
|
||||||
.setBillingTime(
|
.setBillingTime(
|
||||||
now.plus(
|
now.plus(
|
||||||
isAnchorTenant
|
isAnchorTenant
|
||||||
? registry.getAnchorTenantAddGracePeriodLength()
|
? tld.getAnchorTenantAddGracePeriodLength()
|
||||||
: registry.getAddGracePeriodLength()))
|
: tld.getAddGracePeriodLength()))
|
||||||
.setFlags(flagsBuilder.build())
|
.setFlags(flagsBuilder.build())
|
||||||
.setDomainHistoryId(domainHistoryId)
|
.setDomainHistoryId(domainHistoryId)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -88,8 +88,8 @@ import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -146,8 +146,8 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
||||||
DateTime now = tm().getTransactionTime();
|
DateTime now = tm().getTransactionTime();
|
||||||
// Loads the target resource if it exists
|
// Loads the target resource if it exists
|
||||||
Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now);
|
Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now);
|
||||||
Registry registry = Registry.get(existingDomain.getTld());
|
Tld tld = Tld.get(existingDomain.getTld());
|
||||||
verifyDeleteAllowed(existingDomain, registry, now);
|
verifyDeleteAllowed(existingDomain, tld, now);
|
||||||
flowCustomLogic.afterValidation(
|
flowCustomLogic.afterValidation(
|
||||||
AfterValidationParameters.newBuilder().setExistingDomain(existingDomain).build());
|
AfterValidationParameters.newBuilder().setExistingDomain(existingDomain).build());
|
||||||
ImmutableSet.Builder<ImmutableObject> entitiesToSave = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<ImmutableObject> entitiesToSave = new ImmutableSet.Builder<>();
|
||||||
|
@ -160,8 +160,8 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
||||||
builder = existingDomain.asBuilder();
|
builder = existingDomain.asBuilder();
|
||||||
}
|
}
|
||||||
builder.setLastEppUpdateTime(now).setLastEppUpdateRegistrarId(registrarId);
|
builder.setLastEppUpdateTime(now).setLastEppUpdateRegistrarId(registrarId);
|
||||||
Duration redemptionGracePeriodLength = registry.getRedemptionGracePeriodLength();
|
Duration redemptionGracePeriodLength = tld.getRedemptionGracePeriodLength();
|
||||||
Duration pendingDeleteLength = registry.getPendingDeleteLength();
|
Duration pendingDeleteLength = tld.getPendingDeleteLength();
|
||||||
Optional<DomainDeleteSuperuserExtension> domainDeleteSuperuserExtension =
|
Optional<DomainDeleteSuperuserExtension> domainDeleteSuperuserExtension =
|
||||||
eppInput.getSingleExtension(DomainDeleteSuperuserExtension.class);
|
eppInput.getSingleExtension(DomainDeleteSuperuserExtension.class);
|
||||||
if (domainDeleteSuperuserExtension.isPresent()) {
|
if (domainDeleteSuperuserExtension.isPresent()) {
|
||||||
|
@ -249,7 +249,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
||||||
|
|
||||||
Domain newDomain = builder.build();
|
Domain newDomain = builder.build();
|
||||||
DomainHistory domainHistory =
|
DomainHistory domainHistory =
|
||||||
buildDomainHistory(newDomain, registry, now, durationUntilDelete, inAddGracePeriod);
|
buildDomainHistory(newDomain, tld, now, durationUntilDelete, inAddGracePeriod);
|
||||||
handlePendingTransferOnDelete(existingDomain, newDomain, now, domainHistory);
|
handlePendingTransferOnDelete(existingDomain, newDomain, now, domainHistory);
|
||||||
// Close the autorenew billing event and poll message. This may delete the poll message. Store
|
// Close the autorenew billing event and poll message. This may delete the poll message. Store
|
||||||
// the updated recurring billing event, we'll need it later and can't reload it.
|
// the updated recurring billing event, we'll need it later and can't reload it.
|
||||||
|
@ -289,14 +289,14 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyDeleteAllowed(Domain existingDomain, Registry registry, DateTime now)
|
private void verifyDeleteAllowed(Domain existingDomain, Tld tld, DateTime now)
|
||||||
throws EppException {
|
throws EppException {
|
||||||
verifyNoDisallowedStatuses(existingDomain, DISALLOWED_STATUSES);
|
verifyNoDisallowedStatuses(existingDomain, DISALLOWED_STATUSES);
|
||||||
verifyOptionalAuthInfo(authInfo, existingDomain);
|
verifyOptionalAuthInfo(authInfo, existingDomain);
|
||||||
if (!isSuperuser) {
|
if (!isSuperuser) {
|
||||||
verifyResourceOwnership(registrarId, existingDomain);
|
verifyResourceOwnership(registrarId, existingDomain);
|
||||||
verifyNotInPredelegation(registry, now);
|
verifyNotInPredelegation(tld, now);
|
||||||
checkAllowedAccessToTld(registrarId, registry.getTld().toString());
|
checkAllowedAccessToTld(registrarId, tld.getTld().toString());
|
||||||
}
|
}
|
||||||
if (!existingDomain.getSubordinateHosts().isEmpty()) {
|
if (!existingDomain.getSubordinateHosts().isEmpty()) {
|
||||||
throw new DomainToDeleteHasHostsException();
|
throw new DomainToDeleteHasHostsException();
|
||||||
|
@ -305,17 +305,18 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
||||||
|
|
||||||
private DomainHistory buildDomainHistory(
|
private DomainHistory buildDomainHistory(
|
||||||
Domain domain,
|
Domain domain,
|
||||||
Registry registry,
|
Tld tld,
|
||||||
DateTime now,
|
DateTime now,
|
||||||
Duration durationUntilDelete,
|
Duration durationUntilDelete,
|
||||||
boolean inAddGracePeriod) {
|
boolean inAddGracePeriod) {
|
||||||
// We ignore prober transactions
|
// We ignore prober transactions
|
||||||
if (registry.getTldType() == TldType.REAL) {
|
if (tld.getTldType() == TldType.REAL) {
|
||||||
Duration maxGracePeriod = Collections.max(
|
Duration maxGracePeriod =
|
||||||
ImmutableSet.of(
|
Collections.max(
|
||||||
registry.getAddGracePeriodLength(),
|
ImmutableSet.of(
|
||||||
registry.getAutoRenewGracePeriodLength(),
|
tld.getAddGracePeriodLength(),
|
||||||
registry.getRenewGracePeriodLength()));
|
tld.getAutoRenewGracePeriodLength(),
|
||||||
|
tld.getRenewGracePeriodLength()));
|
||||||
ImmutableSet<DomainTransactionRecord> cancelledRecords =
|
ImmutableSet<DomainTransactionRecord> cancelledRecords =
|
||||||
createCancelingRecords(
|
createCancelingRecords(
|
||||||
domain,
|
domain,
|
||||||
|
|
|
@ -28,10 +28,10 @@ import static com.google.common.collect.Sets.union;
|
||||||
import static google.registry.model.domain.Domain.MAX_REGISTRATION_YEARS;
|
import static google.registry.model.domain.Domain.MAX_REGISTRATION_YEARS;
|
||||||
import static google.registry.model.tld.Registries.findTldForName;
|
import static google.registry.model.tld.Registries.findTldForName;
|
||||||
import static google.registry.model.tld.Registries.getTlds;
|
import static google.registry.model.tld.Registries.getTlds;
|
||||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||||
import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD;
|
import static google.registry.model.tld.Tld.TldState.QUIET_PERIOD;
|
||||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||||
import static google.registry.model.tld.label.ReservationType.ALLOWED_IN_SUNRISE;
|
import static google.registry.model.tld.label.ReservationType.ALLOWED_IN_SUNRISE;
|
||||||
import static google.registry.model.tld.label.ReservationType.FULLY_BLOCKED;
|
import static google.registry.model.tld.label.ReservationType.FULLY_BLOCKED;
|
||||||
import static google.registry.model.tld.label.ReservationType.NAME_COLLISION;
|
import static google.registry.model.tld.label.ReservationType.NAME_COLLISION;
|
||||||
|
@ -124,9 +124,9 @@ import google.registry.model.registrar.Registrar.State;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.model.tld.label.ReservationType;
|
import google.registry.model.tld.label.ReservationType;
|
||||||
import google.registry.model.tld.label.ReservedList;
|
import google.registry.model.tld.label.ReservedList;
|
||||||
import google.registry.model.tmch.ClaimsList;
|
import google.registry.model.tmch.ClaimsList;
|
||||||
|
@ -302,17 +302,17 @@ public class DomainFlowUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if the registrar has the correct billing account map configured. */
|
/** Check if the registrar has the correct billing account map configured. */
|
||||||
public static void checkHasBillingAccount(String registrarId, String tld) throws EppException {
|
public static void checkHasBillingAccount(String registrarId, String tldStr) throws EppException {
|
||||||
Registry registry = Registry.get(tld);
|
Tld tld = Tld.get(tldStr);
|
||||||
// Don't enforce the billing account check on test (i.e. prober/OT&E) TLDs.
|
// Don't enforce the billing account check on test (i.e. prober/OT&E) TLDs.
|
||||||
if (registry.getTldType() == TldType.TEST) {
|
if (tld.getTldType() == TldType.TEST) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Registrar.loadByRegistrarIdCached(registrarId)
|
if (!Registrar.loadByRegistrarIdCached(registrarId)
|
||||||
.get()
|
.get()
|
||||||
.getBillingAccountMap()
|
.getBillingAccountMap()
|
||||||
.containsKey(registry.getCurrency())) {
|
.containsKey(tld.getCurrency())) {
|
||||||
throw new DomainFlowUtils.MissingBillingAccountMapException(registry.getCurrency());
|
throw new DomainFlowUtils.MissingBillingAccountMapException(tld.getCurrency());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,8 +412,7 @@ public class DomainFlowUtils {
|
||||||
static void validateNameserversCountForTld(String tld, InternetDomainName domainName, int count)
|
static void validateNameserversCountForTld(String tld, InternetDomainName domainName, int count)
|
||||||
throws EppException {
|
throws EppException {
|
||||||
// For TLDs with a nameserver allow list, all domains must have at least 1 nameserver.
|
// For TLDs with a nameserver allow list, all domains must have at least 1 nameserver.
|
||||||
ImmutableSet<String> tldNameserversAllowList =
|
ImmutableSet<String> tldNameserversAllowList = Tld.get(tld).getAllowedFullyQualifiedHostNames();
|
||||||
Registry.get(tld).getAllowedFullyQualifiedHostNames();
|
|
||||||
if (!tldNameserversAllowList.isEmpty() && count == 0) {
|
if (!tldNameserversAllowList.isEmpty() && count == 0) {
|
||||||
throw new NameserversNotSpecifiedForTldWithNameserverAllowListException(
|
throw new NameserversNotSpecifiedForTldWithNameserverAllowListException(
|
||||||
domainName.toString());
|
domainName.toString());
|
||||||
|
@ -470,7 +469,7 @@ public class DomainFlowUtils {
|
||||||
|
|
||||||
static void validateRegistrantAllowedOnTld(String tld, String registrantContactId)
|
static void validateRegistrantAllowedOnTld(String tld, String registrantContactId)
|
||||||
throws RegistrantNotAllowedException {
|
throws RegistrantNotAllowedException {
|
||||||
ImmutableSet<String> allowedRegistrants = Registry.get(tld).getAllowedRegistrantContactIds();
|
ImmutableSet<String> allowedRegistrants = Tld.get(tld).getAllowedRegistrantContactIds();
|
||||||
// Empty allow list or null registrantContactId are ignored.
|
// Empty allow list or null registrantContactId are ignored.
|
||||||
if (registrantContactId != null
|
if (registrantContactId != null
|
||||||
&& !allowedRegistrants.isEmpty()
|
&& !allowedRegistrants.isEmpty()
|
||||||
|
@ -481,7 +480,7 @@ public class DomainFlowUtils {
|
||||||
|
|
||||||
static void validateNameserversAllowedOnTld(String tld, Set<String> fullyQualifiedHostNames)
|
static void validateNameserversAllowedOnTld(String tld, Set<String> fullyQualifiedHostNames)
|
||||||
throws EppException {
|
throws EppException {
|
||||||
ImmutableSet<String> allowedHostNames = Registry.get(tld).getAllowedFullyQualifiedHostNames();
|
ImmutableSet<String> allowedHostNames = Tld.get(tld).getAllowedFullyQualifiedHostNames();
|
||||||
Set<String> hostnames = nullToEmpty(fullyQualifiedHostNames);
|
Set<String> hostnames = nullToEmpty(fullyQualifiedHostNames);
|
||||||
if (!allowedHostNames.isEmpty()) { // Empty allow list is ignored.
|
if (!allowedHostNames.isEmpty()) { // Empty allow list is ignored.
|
||||||
Set<String> disallowedNameservers = difference(hostnames, allowedHostNames);
|
Set<String> disallowedNameservers = difference(hostnames, allowedHostNames);
|
||||||
|
@ -514,13 +513,13 @@ public class DomainFlowUtils {
|
||||||
domainName.parts().get(0), domainName.parent().toString());
|
domainName.parts().get(0), domainName.parent().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Verifies that a launch extension's specified phase matches the specified registry's phase. */
|
/** Verifies that a launch extension's specified phase matches the specified tld's phase. */
|
||||||
static void verifyLaunchPhaseMatchesRegistryPhase(
|
static void verifyLaunchPhaseMatchesRegistryPhase(
|
||||||
Registry registry, LaunchExtension launchExtension, DateTime now) throws EppException {
|
Tld tld, LaunchExtension launchExtension, DateTime now) throws EppException {
|
||||||
if (!LAUNCH_PHASE_TO_TLD_STATES.containsKey(launchExtension.getPhase())
|
if (!LAUNCH_PHASE_TO_TLD_STATES.containsKey(launchExtension.getPhase())
|
||||||
|| !LAUNCH_PHASE_TO_TLD_STATES
|
|| !LAUNCH_PHASE_TO_TLD_STATES
|
||||||
.get(launchExtension.getPhase())
|
.get(launchExtension.getPhase())
|
||||||
.contains(registry.getTldState(now))) {
|
.contains(tld.getTldState(now))) {
|
||||||
// No launch operations are allowed during the quiet period or predelegation.
|
// No launch operations are allowed during the quiet period or predelegation.
|
||||||
throw new LaunchPhaseMismatchException();
|
throw new LaunchPhaseMismatchException();
|
||||||
}
|
}
|
||||||
|
@ -652,9 +651,9 @@ public class DomainFlowUtils {
|
||||||
builder.setEffectiveDateIfSupported(now);
|
builder.setEffectiveDateIfSupported(now);
|
||||||
}
|
}
|
||||||
String domainNameString = domainName.toString();
|
String domainNameString = domainName.toString();
|
||||||
Registry registry = Registry.get(domainName.parent().toString());
|
Tld tld = Tld.get(domainName.parent().toString());
|
||||||
int years = verifyUnitIsYears(feeRequest.getPeriod()).getValue();
|
int years = verifyUnitIsYears(feeRequest.getPeriod()).getValue();
|
||||||
boolean isSunrise = (registry.getTldState(now) == START_DATE_SUNRISE);
|
boolean isSunrise = (tld.getTldState(now) == START_DATE_SUNRISE);
|
||||||
|
|
||||||
if (feeRequest.getPhase() != null || feeRequest.getSubphase() != null) {
|
if (feeRequest.getPhase() != null || feeRequest.getSubphase() != null) {
|
||||||
throw new FeeChecksDontSupportPhasesException();
|
throw new FeeChecksDontSupportPhasesException();
|
||||||
|
@ -662,13 +661,13 @@ public class DomainFlowUtils {
|
||||||
|
|
||||||
CurrencyUnit currency =
|
CurrencyUnit currency =
|
||||||
feeRequest.getCurrency() != null ? feeRequest.getCurrency() : topLevelCurrency;
|
feeRequest.getCurrency() != null ? feeRequest.getCurrency() : topLevelCurrency;
|
||||||
if ((currency != null) && !currency.equals(registry.getCurrency())) {
|
if ((currency != null) && !currency.equals(tld.getCurrency())) {
|
||||||
throw new CurrencyUnitMismatchException();
|
throw new CurrencyUnitMismatchException();
|
||||||
}
|
}
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.setCommand(feeRequest.getCommandName(), feeRequest.getPhase(), feeRequest.getSubphase())
|
.setCommand(feeRequest.getCommandName(), feeRequest.getPhase(), feeRequest.getSubphase())
|
||||||
.setCurrencyIfSupported(registry.getCurrency())
|
.setCurrencyIfSupported(tld.getCurrency())
|
||||||
.setPeriod(feeRequest.getPeriod());
|
.setPeriod(feeRequest.getPeriod());
|
||||||
|
|
||||||
String feeClass = null;
|
String feeClass = null;
|
||||||
|
@ -685,7 +684,7 @@ public class DomainFlowUtils {
|
||||||
fees =
|
fees =
|
||||||
pricingLogic
|
pricingLogic
|
||||||
.getCreatePrice(
|
.getCreatePrice(
|
||||||
registry,
|
tld,
|
||||||
domainNameString,
|
domainNameString,
|
||||||
now,
|
now,
|
||||||
years,
|
years,
|
||||||
|
@ -699,7 +698,7 @@ public class DomainFlowUtils {
|
||||||
fees =
|
fees =
|
||||||
pricingLogic
|
pricingLogic
|
||||||
.getRenewPrice(
|
.getRenewPrice(
|
||||||
registry, domainNameString, now, years, recurringBillingEvent, allocationToken)
|
tld, domainNameString, now, years, recurringBillingEvent, allocationToken)
|
||||||
.getFees();
|
.getFees();
|
||||||
break;
|
break;
|
||||||
case RESTORE:
|
case RESTORE:
|
||||||
|
@ -717,7 +716,7 @@ public class DomainFlowUtils {
|
||||||
// restore because they can't be restored in the first place.
|
// restore because they can't be restored in the first place.
|
||||||
boolean isExpired =
|
boolean isExpired =
|
||||||
domain.isPresent() && domain.get().getRegistrationExpirationTime().isBefore(now);
|
domain.isPresent() && domain.get().getRegistrationExpirationTime().isBefore(now);
|
||||||
fees = pricingLogic.getRestorePrice(registry, domainNameString, now, isExpired).getFees();
|
fees = pricingLogic.getRestorePrice(tld, domainNameString, now, isExpired).getFees();
|
||||||
break;
|
break;
|
||||||
case TRANSFER:
|
case TRANSFER:
|
||||||
if (years != 1) {
|
if (years != 1) {
|
||||||
|
@ -726,12 +725,12 @@ public class DomainFlowUtils {
|
||||||
builder.setAvailIfSupported(true);
|
builder.setAvailIfSupported(true);
|
||||||
fees =
|
fees =
|
||||||
pricingLogic
|
pricingLogic
|
||||||
.getTransferPrice(registry, domainNameString, now, recurringBillingEvent)
|
.getTransferPrice(tld, domainNameString, now, recurringBillingEvent)
|
||||||
.getFees();
|
.getFees();
|
||||||
break;
|
break;
|
||||||
case UPDATE:
|
case UPDATE:
|
||||||
builder.setAvailIfSupported(true);
|
builder.setAvailIfSupported(true);
|
||||||
fees = pricingLogic.getUpdatePrice(registry, domainNameString, now).getFees();
|
fees = pricingLogic.getUpdatePrice(tld, domainNameString, now).getFees();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new UnknownFeeCommandException(feeRequest.getUnparsedCommandName());
|
throw new UnknownFeeCommandException(feeRequest.getUnparsedCommandName());
|
||||||
|
@ -742,7 +741,7 @@ public class DomainFlowUtils {
|
||||||
// are returning any premium fees, but only if the fee class isn't already set (i.e. because
|
// are returning any premium fees, but only if the fee class isn't already set (i.e. because
|
||||||
// the domain is reserved, which overrides any other classes).
|
// the domain is reserved, which overrides any other classes).
|
||||||
boolean isNameCollisionInSunrise =
|
boolean isNameCollisionInSunrise =
|
||||||
registry.getTldState(now).equals(START_DATE_SUNRISE)
|
tld.getTldState(now).equals(START_DATE_SUNRISE)
|
||||||
&& getReservationTypes(domainName).contains(NAME_COLLISION);
|
&& getReservationTypes(domainName).contains(NAME_COLLISION);
|
||||||
boolean isPremium = fees.stream().anyMatch(BaseFee::isPremium);
|
boolean isPremium = fees.stream().anyMatch(BaseFee::isPremium);
|
||||||
feeClass =
|
feeClass =
|
||||||
|
@ -993,7 +992,7 @@ public class DomainFlowUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that the registry phase is not predelegation, during which some flows are forbidden. */
|
/** Check that the registry phase is not predelegation, during which some flows are forbidden. */
|
||||||
public static void verifyNotInPredelegation(Registry registry, DateTime now)
|
public static void verifyNotInPredelegation(Tld registry, DateTime now)
|
||||||
throws BadCommandForRegistryPhaseException {
|
throws BadCommandForRegistryPhaseException {
|
||||||
if (registry.getTldState(now) == PREDELEGATION) {
|
if (registry.getTldState(now) == PREDELEGATION) {
|
||||||
throw new BadCommandForRegistryPhaseException();
|
throw new BadCommandForRegistryPhaseException();
|
||||||
|
@ -1002,17 +1001,17 @@ public class DomainFlowUtils {
|
||||||
|
|
||||||
/** Validate the contacts and nameservers specified in a domain create command. */
|
/** Validate the contacts and nameservers specified in a domain create command. */
|
||||||
static void validateCreateCommandContactsAndNameservers(
|
static void validateCreateCommandContactsAndNameservers(
|
||||||
Create command, Registry registry, InternetDomainName domainName) throws EppException {
|
Create command, Tld tld, InternetDomainName domainName) throws EppException {
|
||||||
verifyNotInPendingDelete(
|
verifyNotInPendingDelete(
|
||||||
command.getContacts(), command.getRegistrant(), command.getNameservers());
|
command.getContacts(), command.getRegistrant(), command.getNameservers());
|
||||||
validateContactsHaveTypes(command.getContacts());
|
validateContactsHaveTypes(command.getContacts());
|
||||||
String tld = registry.getTldStr();
|
String tldStr = tld.getTldStr();
|
||||||
validateRegistrantAllowedOnTld(tld, command.getRegistrantContactId());
|
validateRegistrantAllowedOnTld(tldStr, command.getRegistrantContactId());
|
||||||
validateNoDuplicateContacts(command.getContacts());
|
validateNoDuplicateContacts(command.getContacts());
|
||||||
validateRequiredContactsPresent(command.getRegistrant(), command.getContacts());
|
validateRequiredContactsPresent(command.getRegistrant(), command.getContacts());
|
||||||
ImmutableSet<String> hostNames = command.getNameserverHostNames();
|
ImmutableSet<String> hostNames = command.getNameserverHostNames();
|
||||||
validateNameserversCountForTld(tld, domainName, hostNames.size());
|
validateNameserversCountForTld(tldStr, domainName, hostNames.size());
|
||||||
validateNameserversAllowedOnTld(tld, hostNames);
|
validateNameserversAllowedOnTld(tldStr, hostNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Validate the secDNS extension, if present. */
|
/** Validate the secDNS extension, if present. */
|
||||||
|
@ -1061,10 +1060,9 @@ public class DomainFlowUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that the claims period hasn't ended. */
|
/** Check that the claims period hasn't ended. */
|
||||||
static void verifyClaimsPeriodNotEnded(Registry registry, DateTime now)
|
static void verifyClaimsPeriodNotEnded(Tld tld, DateTime now) throws ClaimsPeriodEndedException {
|
||||||
throws ClaimsPeriodEndedException {
|
if (isAtOrAfter(now, tld.getClaimsPeriodEnd())) {
|
||||||
if (isAtOrAfter(now, registry.getClaimsPeriodEnd())) {
|
throw new ClaimsPeriodEndedException(tld.getTldStr());
|
||||||
throw new ClaimsPeriodEndedException(registry.getTldStr());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1202,19 +1200,15 @@ public class DomainFlowUtils {
|
||||||
* token found on the TLD's default token list will be returned.
|
* token found on the TLD's default token list will be returned.
|
||||||
*/
|
*/
|
||||||
public static Optional<AllocationToken> checkForDefaultToken(
|
public static Optional<AllocationToken> checkForDefaultToken(
|
||||||
Registry registry,
|
Tld tld, String domainName, CommandName commandName, String registrarId, DateTime now)
|
||||||
String domainName,
|
|
||||||
CommandName commandName,
|
|
||||||
String registrarId,
|
|
||||||
DateTime now)
|
|
||||||
throws EppException {
|
throws EppException {
|
||||||
if (isNullOrEmpty(registry.getDefaultPromoTokens())) {
|
if (isNullOrEmpty(tld.getDefaultPromoTokens())) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
Map<VKey<AllocationToken>, Optional<AllocationToken>> tokens =
|
Map<VKey<AllocationToken>, Optional<AllocationToken>> tokens =
|
||||||
AllocationToken.getAll(registry.getDefaultPromoTokens());
|
AllocationToken.getAll(tld.getDefaultPromoTokens());
|
||||||
ImmutableList<Optional<AllocationToken>> tokenList =
|
ImmutableList<Optional<AllocationToken>> tokenList =
|
||||||
registry.getDefaultPromoTokens().stream()
|
tld.getDefaultPromoTokens().stream()
|
||||||
.map(tokens::get)
|
.map(tokens::get)
|
||||||
.filter(Optional::isPresent)
|
.filter(Optional::isPresent)
|
||||||
.collect(toImmutableList());
|
.collect(toImmutableList());
|
||||||
|
|
|
@ -36,7 +36,7 @@ import google.registry.model.domain.fee.Fee;
|
||||||
import google.registry.model.domain.token.AllocationToken;
|
import google.registry.model.domain.token.AllocationToken;
|
||||||
import google.registry.model.domain.token.AllocationToken.TokenBehavior;
|
import google.registry.model.domain.token.AllocationToken.TokenBehavior;
|
||||||
import google.registry.model.pricing.PremiumPricingEngine.DomainPrices;
|
import google.registry.model.pricing.PremiumPricingEngine.DomainPrices;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -66,14 +66,14 @@ public final class DomainPricingLogic {
|
||||||
* applied to the first year.
|
* applied to the first year.
|
||||||
*/
|
*/
|
||||||
FeesAndCredits getCreatePrice(
|
FeesAndCredits getCreatePrice(
|
||||||
Registry registry,
|
Tld tld,
|
||||||
String domainName,
|
String domainName,
|
||||||
DateTime dateTime,
|
DateTime dateTime,
|
||||||
int years,
|
int years,
|
||||||
boolean isAnchorTenant,
|
boolean isAnchorTenant,
|
||||||
Optional<AllocationToken> allocationToken)
|
Optional<AllocationToken> allocationToken)
|
||||||
throws EppException {
|
throws EppException {
|
||||||
CurrencyUnit currency = registry.getCurrency();
|
CurrencyUnit currency = tld.getCurrency();
|
||||||
|
|
||||||
BaseFee createFeeOrCredit;
|
BaseFee createFeeOrCredit;
|
||||||
// Domain create cost is always zero for anchor tenants
|
// Domain create cost is always zero for anchor tenants
|
||||||
|
@ -88,7 +88,7 @@ public final class DomainPricingLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create fees for the cost and the EAP fee, if any.
|
// Create fees for the cost and the EAP fee, if any.
|
||||||
Fee eapFee = registry.getEapFeeFor(dateTime);
|
Fee eapFee = tld.getEapFeeFor(dateTime);
|
||||||
FeesAndCredits.Builder feesBuilder =
|
FeesAndCredits.Builder feesBuilder =
|
||||||
new FeesAndCredits.Builder().setCurrency(currency).addFeeOrCredit(createFeeOrCredit);
|
new FeesAndCredits.Builder().setCurrency(currency).addFeeOrCredit(createFeeOrCredit);
|
||||||
// Don't charge anchor tenants EAP fees.
|
// Don't charge anchor tenants EAP fees.
|
||||||
|
@ -100,7 +100,7 @@ public final class DomainPricingLogic {
|
||||||
return customLogic.customizeCreatePrice(
|
return customLogic.customizeCreatePrice(
|
||||||
CreatePriceParameters.newBuilder()
|
CreatePriceParameters.newBuilder()
|
||||||
.setFeesAndCredits(feesBuilder.build())
|
.setFeesAndCredits(feesBuilder.build())
|
||||||
.setRegistry(registry)
|
.setTld(tld)
|
||||||
.setDomainName(InternetDomainName.from(domainName))
|
.setDomainName(InternetDomainName.from(domainName))
|
||||||
.setAsOfDate(dateTime)
|
.setAsOfDate(dateTime)
|
||||||
.setYears(years)
|
.setYears(years)
|
||||||
|
@ -109,7 +109,7 @@ public final class DomainPricingLogic {
|
||||||
|
|
||||||
/** Returns a new renewal cost for the pricer. */
|
/** Returns a new renewal cost for the pricer. */
|
||||||
public FeesAndCredits getRenewPrice(
|
public FeesAndCredits getRenewPrice(
|
||||||
Registry registry,
|
Tld tld,
|
||||||
String domainName,
|
String domainName,
|
||||||
DateTime dateTime,
|
DateTime dateTime,
|
||||||
int years,
|
int years,
|
||||||
|
@ -150,7 +150,7 @@ public final class DomainPricingLogic {
|
||||||
false,
|
false,
|
||||||
years,
|
years,
|
||||||
allocationToken,
|
allocationToken,
|
||||||
Registry.get(getTldFromDomainName(domainName)).getStandardRenewCost(dateTime));
|
Tld.get(getTldFromDomainName(domainName)).getStandardRenewCost(dateTime));
|
||||||
isRenewCostPremiumPrice = false;
|
isRenewCostPremiumPrice = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -168,7 +168,7 @@ public final class DomainPricingLogic {
|
||||||
.addFeeOrCredit(
|
.addFeeOrCredit(
|
||||||
Fee.create(renewCost.getAmount(), FeeType.RENEW, isRenewCostPremiumPrice))
|
Fee.create(renewCost.getAmount(), FeeType.RENEW, isRenewCostPremiumPrice))
|
||||||
.build())
|
.build())
|
||||||
.setRegistry(registry)
|
.setTld(tld)
|
||||||
.setDomainName(InternetDomainName.from(domainName))
|
.setDomainName(InternetDomainName.from(domainName))
|
||||||
.setAsOfDate(dateTime)
|
.setAsOfDate(dateTime)
|
||||||
.setYears(years)
|
.setYears(years)
|
||||||
|
@ -176,15 +176,14 @@ public final class DomainPricingLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a new restore price for the pricer. */
|
/** Returns a new restore price for the pricer. */
|
||||||
FeesAndCredits getRestorePrice(
|
FeesAndCredits getRestorePrice(Tld tld, String domainName, DateTime dateTime, boolean isExpired)
|
||||||
Registry registry, String domainName, DateTime dateTime, boolean isExpired)
|
|
||||||
throws EppException {
|
throws EppException {
|
||||||
DomainPrices domainPrices = getPricesForDomainName(domainName, dateTime);
|
DomainPrices domainPrices = getPricesForDomainName(domainName, dateTime);
|
||||||
FeesAndCredits.Builder feesAndCredits =
|
FeesAndCredits.Builder feesAndCredits =
|
||||||
new FeesAndCredits.Builder()
|
new FeesAndCredits.Builder()
|
||||||
.setCurrency(registry.getCurrency())
|
.setCurrency(tld.getCurrency())
|
||||||
.addFeeOrCredit(
|
.addFeeOrCredit(
|
||||||
Fee.create(registry.getStandardRestoreCost().getAmount(), FeeType.RESTORE, false));
|
Fee.create(tld.getStandardRestoreCost().getAmount(), FeeType.RESTORE, false));
|
||||||
if (isExpired) {
|
if (isExpired) {
|
||||||
feesAndCredits.addFeeOrCredit(
|
feesAndCredits.addFeeOrCredit(
|
||||||
Fee.create(
|
Fee.create(
|
||||||
|
@ -193,7 +192,7 @@ public final class DomainPricingLogic {
|
||||||
return customLogic.customizeRestorePrice(
|
return customLogic.customizeRestorePrice(
|
||||||
RestorePriceParameters.newBuilder()
|
RestorePriceParameters.newBuilder()
|
||||||
.setFeesAndCredits(feesAndCredits.build())
|
.setFeesAndCredits(feesAndCredits.build())
|
||||||
.setRegistry(registry)
|
.setTld(tld)
|
||||||
.setDomainName(InternetDomainName.from(domainName))
|
.setDomainName(InternetDomainName.from(domainName))
|
||||||
.setAsOfDate(dateTime)
|
.setAsOfDate(dateTime)
|
||||||
.build());
|
.build());
|
||||||
|
@ -201,34 +200,30 @@ public final class DomainPricingLogic {
|
||||||
|
|
||||||
/** Returns a new transfer price for the pricer. */
|
/** Returns a new transfer price for the pricer. */
|
||||||
FeesAndCredits getTransferPrice(
|
FeesAndCredits getTransferPrice(
|
||||||
Registry registry,
|
Tld tld, String domainName, DateTime dateTime, @Nullable Recurring recurringBillingEvent)
|
||||||
String domainName,
|
|
||||||
DateTime dateTime,
|
|
||||||
@Nullable Recurring recurringBillingEvent)
|
|
||||||
throws EppException {
|
throws EppException {
|
||||||
FeesAndCredits renewPrice =
|
FeesAndCredits renewPrice =
|
||||||
getRenewPrice(registry, domainName, dateTime, 1, recurringBillingEvent, Optional.empty());
|
getRenewPrice(tld, domainName, dateTime, 1, recurringBillingEvent, Optional.empty());
|
||||||
return customLogic.customizeTransferPrice(
|
return customLogic.customizeTransferPrice(
|
||||||
TransferPriceParameters.newBuilder()
|
TransferPriceParameters.newBuilder()
|
||||||
.setFeesAndCredits(
|
.setFeesAndCredits(
|
||||||
new FeesAndCredits.Builder()
|
new FeesAndCredits.Builder()
|
||||||
.setCurrency(registry.getCurrency())
|
.setCurrency(tld.getCurrency())
|
||||||
.addFeeOrCredit(
|
.addFeeOrCredit(
|
||||||
Fee.create(
|
Fee.create(
|
||||||
renewPrice.getRenewCost().getAmount(),
|
renewPrice.getRenewCost().getAmount(),
|
||||||
FeeType.RENEW,
|
FeeType.RENEW,
|
||||||
renewPrice.hasAnyPremiumFees()))
|
renewPrice.hasAnyPremiumFees()))
|
||||||
.build())
|
.build())
|
||||||
.setRegistry(registry)
|
.setTld(tld)
|
||||||
.setDomainName(InternetDomainName.from(domainName))
|
.setDomainName(InternetDomainName.from(domainName))
|
||||||
.setAsOfDate(dateTime)
|
.setAsOfDate(dateTime)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a new update price for the pricer. */
|
/** Returns a new update price for the pricer. */
|
||||||
FeesAndCredits getUpdatePrice(Registry registry, String domainName, DateTime dateTime)
|
FeesAndCredits getUpdatePrice(Tld tld, String domainName, DateTime dateTime) throws EppException {
|
||||||
throws EppException {
|
CurrencyUnit currency = tld.getCurrency();
|
||||||
CurrencyUnit currency = registry.getCurrency();
|
|
||||||
BaseFee feeOrCredit = Fee.create(zeroInCurrency(currency), FeeType.UPDATE, false);
|
BaseFee feeOrCredit = Fee.create(zeroInCurrency(currency), FeeType.UPDATE, false);
|
||||||
return customLogic.customizeUpdatePrice(
|
return customLogic.customizeUpdatePrice(
|
||||||
UpdatePriceParameters.newBuilder()
|
UpdatePriceParameters.newBuilder()
|
||||||
|
@ -237,7 +232,7 @@ public final class DomainPricingLogic {
|
||||||
.setCurrency(currency)
|
.setCurrency(currency)
|
||||||
.setFeesAndCredits(feeOrCredit)
|
.setFeesAndCredits(feeOrCredit)
|
||||||
.build())
|
.build())
|
||||||
.setRegistry(registry)
|
.setTld(tld)
|
||||||
.setDomainName(InternetDomainName.from(domainName))
|
.setDomainName(InternetDomainName.from(domainName))
|
||||||
.setAsOfDate(dateTime)
|
.setAsOfDate(dateTime)
|
||||||
.build());
|
.build());
|
||||||
|
|
|
@ -84,7 +84,7 @@ import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
|
@ -173,12 +173,12 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
||||||
Renew command = (Renew) resourceCommand;
|
Renew command = (Renew) resourceCommand;
|
||||||
// Loads the target resource if it exists
|
// Loads the target resource if it exists
|
||||||
Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now);
|
Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now);
|
||||||
String tld = existingDomain.getTld();
|
String tldStr = existingDomain.getTld();
|
||||||
Registry registry = Registry.get(tld);
|
Tld tld = Tld.get(tldStr);
|
||||||
Optional<AllocationToken> allocationToken =
|
Optional<AllocationToken> allocationToken =
|
||||||
allocationTokenFlowUtils.verifyAllocationTokenIfPresent(
|
allocationTokenFlowUtils.verifyAllocationTokenIfPresent(
|
||||||
existingDomain,
|
existingDomain,
|
||||||
registry,
|
tld,
|
||||||
registrarId,
|
registrarId,
|
||||||
now,
|
now,
|
||||||
CommandName.RENEW,
|
CommandName.RENEW,
|
||||||
|
@ -187,7 +187,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
||||||
if (!allocationToken.isPresent()) {
|
if (!allocationToken.isPresent()) {
|
||||||
allocationToken =
|
allocationToken =
|
||||||
DomainFlowUtils.checkForDefaultToken(
|
DomainFlowUtils.checkForDefaultToken(
|
||||||
registry, existingDomain.getDomainName(), CommandName.RENEW, registrarId, now);
|
tld, existingDomain.getDomainName(), CommandName.RENEW, registrarId, now);
|
||||||
if (allocationToken.isPresent()) {
|
if (allocationToken.isPresent()) {
|
||||||
defaultTokenUsed = true;
|
defaultTokenUsed = true;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
||||||
tm().loadByKey(existingDomain.getAutorenewBillingEvent());
|
tm().loadByKey(existingDomain.getAutorenewBillingEvent());
|
||||||
FeesAndCredits feesAndCredits =
|
FeesAndCredits feesAndCredits =
|
||||||
pricingLogic.getRenewPrice(
|
pricingLogic.getRenewPrice(
|
||||||
Registry.get(existingDomain.getTld()),
|
Tld.get(existingDomain.getTld()),
|
||||||
targetId,
|
targetId,
|
||||||
now,
|
now,
|
||||||
years,
|
years,
|
||||||
|
@ -225,7 +225,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
||||||
// Bill for this explicit renew itself.
|
// Bill for this explicit renew itself.
|
||||||
BillingEvent.OneTime explicitRenewEvent =
|
BillingEvent.OneTime explicitRenewEvent =
|
||||||
createRenewBillingEvent(
|
createRenewBillingEvent(
|
||||||
tld, feesAndCredits.getTotalCost(), years, domainHistoryId, allocationToken, now);
|
tldStr, feesAndCredits.getTotalCost(), years, domainHistoryId, allocationToken, now);
|
||||||
// Create a new autorenew billing event and poll message starting at the new expiration time.
|
// Create a new autorenew billing event and poll message starting at the new expiration time.
|
||||||
BillingEvent.Recurring newAutorenewEvent =
|
BillingEvent.Recurring newAutorenewEvent =
|
||||||
newAutorenewBillingEvent(existingDomain)
|
newAutorenewBillingEvent(existingDomain)
|
||||||
|
@ -255,8 +255,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
||||||
GracePeriodStatus.RENEW, existingDomain.getRepoId(), explicitRenewEvent))
|
GracePeriodStatus.RENEW, existingDomain.getRepoId(), explicitRenewEvent))
|
||||||
.build();
|
.build();
|
||||||
DomainHistory domainHistory =
|
DomainHistory domainHistory =
|
||||||
buildDomainHistory(
|
buildDomainHistory(newDomain, now, command.getPeriod(), tld.getRenewGracePeriodLength());
|
||||||
newDomain, now, command.getPeriod(), registry.getRenewGracePeriodLength());
|
|
||||||
ImmutableSet.Builder<ImmutableObject> entitiesToSave = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<ImmutableObject> entitiesToSave = new ImmutableSet.Builder<>();
|
||||||
entitiesToSave.add(
|
entitiesToSave.add(
|
||||||
newDomain, domainHistory, explicitRenewEvent, newAutorenewEvent, newAutorenewPollMessage);
|
newDomain, domainHistory, explicitRenewEvent, newAutorenewEvent, newAutorenewPollMessage);
|
||||||
|
@ -358,7 +357,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
||||||
.filter(t -> AllocationToken.TokenBehavior.DEFAULT.equals(t.getTokenBehavior()))
|
.filter(t -> AllocationToken.TokenBehavior.DEFAULT.equals(t.getTokenBehavior()))
|
||||||
.map(AllocationToken::createVKey)
|
.map(AllocationToken::createVKey)
|
||||||
.orElse(null))
|
.orElse(null))
|
||||||
.setBillingTime(now.plus(Registry.get(tld).getRenewGracePeriodLength()))
|
.setBillingTime(now.plus(Tld.get(tld).getRenewGracePeriodLength()))
|
||||||
.setDomainHistoryId(domainHistoryId)
|
.setDomainHistoryId(domainHistoryId)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
|
@ -141,8 +141,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
|
||||||
Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now);
|
Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now);
|
||||||
boolean isExpired = existingDomain.getRegistrationExpirationTime().isBefore(now);
|
boolean isExpired = existingDomain.getRegistrationExpirationTime().isBefore(now);
|
||||||
FeesAndCredits feesAndCredits =
|
FeesAndCredits feesAndCredits =
|
||||||
pricingLogic.getRestorePrice(
|
pricingLogic.getRestorePrice(Tld.get(existingDomain.getTld()), targetId, now, isExpired);
|
||||||
Registry.get(existingDomain.getTld()), targetId, now, isExpired);
|
|
||||||
Optional<FeeUpdateCommandExtension> feeUpdate =
|
Optional<FeeUpdateCommandExtension> feeUpdate =
|
||||||
eppInput.getSingleExtension(FeeUpdateCommandExtension.class);
|
eppInput.getSingleExtension(FeeUpdateCommandExtension.class);
|
||||||
verifyRestoreAllowed(command, existingDomain, feeUpdate, feesAndCredits, now);
|
verifyRestoreAllowed(command, existingDomain, feeUpdate, feesAndCredits, now);
|
||||||
|
|
|
@ -64,7 +64,7 @@ import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.DomainTransferData;
|
import google.registry.model.transfer.DomainTransferData;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -133,7 +133,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
||||||
Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now);
|
Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now);
|
||||||
allocationTokenFlowUtils.verifyAllocationTokenIfPresent(
|
allocationTokenFlowUtils.verifyAllocationTokenIfPresent(
|
||||||
existingDomain,
|
existingDomain,
|
||||||
Registry.get(existingDomain.getTld()),
|
Tld.get(existingDomain.getTld()),
|
||||||
registrarId,
|
registrarId,
|
||||||
now,
|
now,
|
||||||
CommandName.TRANSFER,
|
CommandName.TRANSFER,
|
||||||
|
@ -141,9 +141,9 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
||||||
verifyOptionalAuthInfo(authInfo, existingDomain);
|
verifyOptionalAuthInfo(authInfo, existingDomain);
|
||||||
verifyHasPendingTransfer(existingDomain);
|
verifyHasPendingTransfer(existingDomain);
|
||||||
verifyResourceOwnership(registrarId, existingDomain);
|
verifyResourceOwnership(registrarId, existingDomain);
|
||||||
String tld = existingDomain.getTld();
|
String tldStr = existingDomain.getTld();
|
||||||
if (!isSuperuser) {
|
if (!isSuperuser) {
|
||||||
checkAllowedAccessToTld(registrarId, tld);
|
checkAllowedAccessToTld(registrarId, tldStr);
|
||||||
}
|
}
|
||||||
DomainTransferData transferData = existingDomain.getTransferData();
|
DomainTransferData transferData = existingDomain.getTransferData();
|
||||||
String gainingRegistrarId = transferData.getGainingRegistrarId();
|
String gainingRegistrarId = transferData.getGainingRegistrarId();
|
||||||
|
@ -166,7 +166,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
||||||
.setCost(
|
.setCost(
|
||||||
pricingLogic
|
pricingLogic
|
||||||
.getTransferPrice(
|
.getTransferPrice(
|
||||||
Registry.get(tld),
|
Tld.get(tldStr),
|
||||||
targetId,
|
targetId,
|
||||||
transferData.getTransferRequestTime(),
|
transferData.getTransferRequestTime(),
|
||||||
// When removing a domain from a package it should return to the
|
// When removing a domain from a package it should return to the
|
||||||
|
@ -175,7 +175,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
||||||
hasPackageToken ? null : existingRecurring)
|
hasPackageToken ? null : existingRecurring)
|
||||||
.getRenewCost())
|
.getRenewCost())
|
||||||
.setEventTime(now)
|
.setEventTime(now)
|
||||||
.setBillingTime(now.plus(Registry.get(tld).getTransferGracePeriodLength()))
|
.setBillingTime(now.plus(Tld.get(tldStr).getTransferGracePeriodLength()))
|
||||||
.setDomainHistoryId(domainHistoryId)
|
.setDomainHistoryId(domainHistoryId)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
@ -262,8 +262,8 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
||||||
.setCurrentPackageToken(null)
|
.setCurrentPackageToken(null)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Registry registry = Registry.get(existingDomain.getTld());
|
Tld tld = Tld.get(existingDomain.getTld());
|
||||||
DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now, gainingRegistrarId);
|
DomainHistory domainHistory = buildDomainHistory(newDomain, tld, now, gainingRegistrarId);
|
||||||
// Create a poll message for the gaining client.
|
// Create a poll message for the gaining client.
|
||||||
PollMessage gainingClientPollMessage =
|
PollMessage gainingClientPollMessage =
|
||||||
createGainingTransferPollMessage(
|
createGainingTransferPollMessage(
|
||||||
|
@ -286,12 +286,12 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
private DomainHistory buildDomainHistory(
|
private DomainHistory buildDomainHistory(
|
||||||
Domain newDomain, Registry registry, DateTime now, String gainingRegistrarId) {
|
Domain newDomain, Tld tld, DateTime now, String gainingRegistrarId) {
|
||||||
ImmutableSet<DomainTransactionRecord> cancelingRecords =
|
ImmutableSet<DomainTransactionRecord> cancelingRecords =
|
||||||
createCancelingRecords(
|
createCancelingRecords(
|
||||||
newDomain,
|
newDomain,
|
||||||
now,
|
now,
|
||||||
registry.getAutomaticTransferLength().plus(registry.getTransferGracePeriodLength()),
|
tld.getAutomaticTransferLength().plus(tld.getTransferGracePeriodLength()),
|
||||||
ImmutableSet.of(TRANSFER_SUCCESSFUL));
|
ImmutableSet.of(TRANSFER_SUCCESSFUL));
|
||||||
return historyBuilder
|
return historyBuilder
|
||||||
.setType(DOMAIN_TRANSFER_APPROVE)
|
.setType(DOMAIN_TRANSFER_APPROVE)
|
||||||
|
@ -302,7 +302,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
||||||
cancelingRecords,
|
cancelingRecords,
|
||||||
DomainTransactionRecord.create(
|
DomainTransactionRecord.create(
|
||||||
newDomain.getTld(),
|
newDomain.getTld(),
|
||||||
now.plus(registry.getTransferGracePeriodLength()),
|
now.plus(tld.getTransferGracePeriodLength()),
|
||||||
TRANSFER_SUCCESSFUL,
|
TRANSFER_SUCCESSFUL,
|
||||||
1)))
|
1)))
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -48,7 +48,7 @@ import google.registry.model.eppoutput.EppResponse;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -100,7 +100,7 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
|
||||||
if (!isSuperuser) {
|
if (!isSuperuser) {
|
||||||
checkAllowedAccessToTld(registrarId, existingDomain.getTld());
|
checkAllowedAccessToTld(registrarId, existingDomain.getTld());
|
||||||
}
|
}
|
||||||
Registry registry = Registry.get(existingDomain.getTld());
|
Tld tld = Tld.get(existingDomain.getTld());
|
||||||
|
|
||||||
HistoryEntryId domainHistoryId = createHistoryEntryId(existingDomain);
|
HistoryEntryId domainHistoryId = createHistoryEntryId(existingDomain);
|
||||||
historyBuilder
|
historyBuilder
|
||||||
|
@ -109,7 +109,7 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
|
||||||
|
|
||||||
Domain newDomain =
|
Domain newDomain =
|
||||||
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_CANCELLED, now, registrarId);
|
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_CANCELLED, now, registrarId);
|
||||||
DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now);
|
DomainHistory domainHistory = buildDomainHistory(newDomain, tld, now);
|
||||||
tm().putAll(
|
tm().putAll(
|
||||||
newDomain,
|
newDomain,
|
||||||
domainHistory,
|
domainHistory,
|
||||||
|
@ -128,12 +128,12 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private DomainHistory buildDomainHistory(Domain newDomain, Registry registry, DateTime now) {
|
private DomainHistory buildDomainHistory(Domain newDomain, Tld tld, DateTime now) {
|
||||||
ImmutableSet<DomainTransactionRecord> cancelingRecords =
|
ImmutableSet<DomainTransactionRecord> cancelingRecords =
|
||||||
createCancelingRecords(
|
createCancelingRecords(
|
||||||
newDomain,
|
newDomain,
|
||||||
now,
|
now,
|
||||||
registry.getAutomaticTransferLength().plus(registry.getTransferGracePeriodLength()),
|
tld.getAutomaticTransferLength().plus(tld.getTransferGracePeriodLength()),
|
||||||
ImmutableSet.of(TRANSFER_SUCCESSFUL));
|
ImmutableSet.of(TRANSFER_SUCCESSFUL));
|
||||||
return historyBuilder
|
return historyBuilder
|
||||||
.setType(DOMAIN_TRANSFER_CANCEL)
|
.setType(DOMAIN_TRANSFER_CANCEL)
|
||||||
|
|
|
@ -50,7 +50,7 @@ import google.registry.model.eppoutput.EppResponse;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -94,7 +94,7 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
|
||||||
extensionManager.validate();
|
extensionManager.validate();
|
||||||
DateTime now = tm().getTransactionTime();
|
DateTime now = tm().getTransactionTime();
|
||||||
Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now);
|
Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now);
|
||||||
Registry registry = Registry.get(existingDomain.getTld());
|
Tld tld = Tld.get(existingDomain.getTld());
|
||||||
HistoryEntryId domainHistoryId = createHistoryEntryId(existingDomain);
|
HistoryEntryId domainHistoryId = createHistoryEntryId(existingDomain);
|
||||||
historyBuilder
|
historyBuilder
|
||||||
.setRevisionId(domainHistoryId.getRevisionId())
|
.setRevisionId(domainHistoryId.getRevisionId())
|
||||||
|
@ -108,7 +108,7 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
|
||||||
}
|
}
|
||||||
Domain newDomain =
|
Domain newDomain =
|
||||||
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_REJECTED, now, registrarId);
|
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_REJECTED, now, registrarId);
|
||||||
DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now);
|
DomainHistory domainHistory = buildDomainHistory(newDomain, tld, now);
|
||||||
tm().putAll(
|
tm().putAll(
|
||||||
newDomain,
|
newDomain,
|
||||||
domainHistory,
|
domainHistory,
|
||||||
|
@ -127,12 +127,12 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private DomainHistory buildDomainHistory(Domain newDomain, Registry registry, DateTime now) {
|
private DomainHistory buildDomainHistory(Domain newDomain, Tld tld, DateTime now) {
|
||||||
ImmutableSet<DomainTransactionRecord> cancelingRecords =
|
ImmutableSet<DomainTransactionRecord> cancelingRecords =
|
||||||
createCancelingRecords(
|
createCancelingRecords(
|
||||||
newDomain,
|
newDomain,
|
||||||
now,
|
now,
|
||||||
registry.getAutomaticTransferLength().plus(registry.getTransferGracePeriodLength()),
|
tld.getAutomaticTransferLength().plus(tld.getTransferGracePeriodLength()),
|
||||||
ImmutableSet.of(TRANSFER_SUCCESSFUL));
|
ImmutableSet.of(TRANSFER_SUCCESSFUL));
|
||||||
return historyBuilder
|
return historyBuilder
|
||||||
.setType(DOMAIN_TRANSFER_REJECT)
|
.setType(DOMAIN_TRANSFER_REJECT)
|
||||||
|
|
|
@ -74,7 +74,7 @@ import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.DomainTransferData;
|
import google.registry.model.transfer.DomainTransferData;
|
||||||
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
|
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
|
||||||
import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
|
import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
|
||||||
|
@ -171,7 +171,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
||||||
Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now);
|
Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now);
|
||||||
allocationTokenFlowUtils.verifyAllocationTokenIfPresent(
|
allocationTokenFlowUtils.verifyAllocationTokenIfPresent(
|
||||||
existingDomain,
|
existingDomain,
|
||||||
Registry.get(existingDomain.getTld()),
|
Tld.get(existingDomain.getTld()),
|
||||||
gainingClientId,
|
gainingClientId,
|
||||||
now,
|
now,
|
||||||
CommandName.TRANSFER,
|
CommandName.TRANSFER,
|
||||||
|
@ -184,8 +184,8 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
||||||
: ((Transfer) resourceCommand).getPeriod();
|
: ((Transfer) resourceCommand).getPeriod();
|
||||||
verifyTransferAllowed(existingDomain, period, now, superuserExtension);
|
verifyTransferAllowed(existingDomain, period, now, superuserExtension);
|
||||||
|
|
||||||
String tld = existingDomain.getTld();
|
String tldStr = existingDomain.getTld();
|
||||||
Registry registry = Registry.get(tld);
|
Tld tld = Tld.get(tldStr);
|
||||||
// An optional extension from the client specifying what they think the transfer should cost.
|
// An optional extension from the client specifying what they think the transfer should cost.
|
||||||
Optional<FeeTransferCommandExtension> feeTransfer =
|
Optional<FeeTransferCommandExtension> feeTransfer =
|
||||||
eppInput.getSingleExtension(FeeTransferCommandExtension.class);
|
eppInput.getSingleExtension(FeeTransferCommandExtension.class);
|
||||||
|
@ -201,14 +201,14 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
||||||
feesAndCredits = Optional.empty();
|
feesAndCredits = Optional.empty();
|
||||||
} else if (!existingDomain.getCurrentPackageToken().isPresent()) {
|
} else if (!existingDomain.getCurrentPackageToken().isPresent()) {
|
||||||
feesAndCredits =
|
feesAndCredits =
|
||||||
Optional.of(pricingLogic.getTransferPrice(registry, targetId, now, existingRecurring));
|
Optional.of(pricingLogic.getTransferPrice(tld, targetId, now, existingRecurring));
|
||||||
} else {
|
} else {
|
||||||
// If existing domain is in a package, calculate the transfer price with default renewal price
|
// If existing domain is in a package, calculate the transfer price with default renewal price
|
||||||
// behavior
|
// behavior
|
||||||
feesAndCredits =
|
feesAndCredits =
|
||||||
period.getValue() == 0
|
period.getValue() == 0
|
||||||
? Optional.empty()
|
? Optional.empty()
|
||||||
: Optional.of(pricingLogic.getTransferPrice(registry, targetId, now, null));
|
: Optional.of(pricingLogic.getTransferPrice(tld, targetId, now, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (feesAndCredits.isPresent()) {
|
if (feesAndCredits.isPresent()) {
|
||||||
|
@ -224,7 +224,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
||||||
domainTransferRequestSuperuserExtension ->
|
domainTransferRequestSuperuserExtension ->
|
||||||
now.plusDays(
|
now.plusDays(
|
||||||
domainTransferRequestSuperuserExtension.getAutomaticTransferLength()))
|
domainTransferRequestSuperuserExtension.getAutomaticTransferLength()))
|
||||||
.orElseGet(() -> now.plus(registry.getAutomaticTransferLength()));
|
.orElseGet(() -> now.plus(tld.getAutomaticTransferLength()));
|
||||||
// If the domain will be in the auto-renew grace period at the moment of transfer, the transfer
|
// If the domain will be in the auto-renew grace period at the moment of transfer, the transfer
|
||||||
// will subsume the autorenew, so we don't add the normal extra year from the transfer.
|
// will subsume the autorenew, so we don't add the normal extra year from the transfer.
|
||||||
// The gaining registrar is still billed for the extra year; the losing registrar will get a
|
// The gaining registrar is still billed for the extra year; the losing registrar will get a
|
||||||
|
@ -283,7 +283,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
||||||
.setLastEppUpdateTime(now)
|
.setLastEppUpdateTime(now)
|
||||||
.setLastEppUpdateRegistrarId(gainingClientId)
|
.setLastEppUpdateRegistrarId(gainingClientId)
|
||||||
.build();
|
.build();
|
||||||
DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now, period);
|
DomainHistory domainHistory = buildDomainHistory(newDomain, tld, now, period);
|
||||||
|
|
||||||
asyncTaskEnqueuer.enqueueAsyncResave(newDomain.createVKey(), now, automaticTransferTime);
|
asyncTaskEnqueuer.enqueueAsyncResave(newDomain.createVKey(), now, automaticTransferTime);
|
||||||
tm().putAll(
|
tm().putAll(
|
||||||
|
@ -363,8 +363,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DomainHistory buildDomainHistory(
|
private DomainHistory buildDomainHistory(Domain newDomain, Tld tld, DateTime now, Period period) {
|
||||||
Domain newDomain, Registry registry, DateTime now, Period period) {
|
|
||||||
return historyBuilder
|
return historyBuilder
|
||||||
.setType(DOMAIN_TRANSFER_REQUEST)
|
.setType(DOMAIN_TRANSFER_REQUEST)
|
||||||
.setPeriod(period)
|
.setPeriod(period)
|
||||||
|
@ -372,9 +371,9 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
||||||
.setDomainTransactionRecords(
|
.setDomainTransactionRecords(
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(
|
||||||
DomainTransactionRecord.create(
|
DomainTransactionRecord.create(
|
||||||
registry.getTldStr(),
|
tld.getTldStr(),
|
||||||
now.plus(registry.getAutomaticTransferLength())
|
now.plus(tld.getAutomaticTransferLength())
|
||||||
.plus(registry.getTransferGracePeriodLength()),
|
.plus(tld.getTransferGracePeriodLength()),
|
||||||
TransactionReportField.TRANSFER_SUCCESSFUL,
|
TransactionReportField.TRANSFER_SUCCESSFUL,
|
||||||
1)))
|
1)))
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -33,7 +33,7 @@ import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.DomainTransferData;
|
import google.registry.model.transfer.DomainTransferData;
|
||||||
import google.registry.model.transfer.TransferData;
|
import google.registry.model.transfer.TransferData;
|
||||||
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
|
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
|
||||||
|
@ -127,7 +127,7 @@ public final class DomainTransferUtils {
|
||||||
.setTransferredRegistrationExpirationTime(serverApproveNewExpirationTime)
|
.setTransferredRegistrationExpirationTime(serverApproveNewExpirationTime)
|
||||||
.setTransferStatus(TransferStatus.SERVER_APPROVED)
|
.setTransferStatus(TransferStatus.SERVER_APPROVED)
|
||||||
.build();
|
.build();
|
||||||
Registry registry = Registry.get(existingDomain.getTld());
|
Tld tld = Tld.get(existingDomain.getTld());
|
||||||
ImmutableSet.Builder<TransferServerApproveEntity> builder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<TransferServerApproveEntity> builder = new ImmutableSet.Builder<>();
|
||||||
transferCost.ifPresent(
|
transferCost.ifPresent(
|
||||||
cost ->
|
cost ->
|
||||||
|
@ -137,7 +137,7 @@ public final class DomainTransferUtils {
|
||||||
domainHistoryId,
|
domainHistoryId,
|
||||||
targetId,
|
targetId,
|
||||||
gainingRegistrarId,
|
gainingRegistrarId,
|
||||||
registry,
|
tld,
|
||||||
cost)));
|
cost)));
|
||||||
createOptionalAutorenewCancellation(
|
createOptionalAutorenewCancellation(
|
||||||
automaticTransferTime, now, domainHistoryId, targetId, existingDomain, transferCost)
|
automaticTransferTime, now, domainHistoryId, targetId, existingDomain, transferCost)
|
||||||
|
@ -308,7 +308,7 @@ public final class DomainTransferUtils {
|
||||||
HistoryEntryId domainHistoryId,
|
HistoryEntryId domainHistoryId,
|
||||||
String targetId,
|
String targetId,
|
||||||
String gainingRegistrarId,
|
String gainingRegistrarId,
|
||||||
Registry registry,
|
Tld registry,
|
||||||
Money transferCost) {
|
Money transferCost) {
|
||||||
return new BillingEvent.OneTime.Builder()
|
return new BillingEvent.OneTime.Builder()
|
||||||
.setReason(Reason.TRANSFER)
|
.setReason(Reason.TRANSFER)
|
||||||
|
|
|
@ -86,7 +86,7 @@ import google.registry.model.eppoutput.EppResponse;
|
||||||
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -219,18 +219,18 @@ public final class DomainUpdateFlow implements TransactionalFlow {
|
||||||
verifyOptionalAuthInfo(authInfo, existingDomain);
|
verifyOptionalAuthInfo(authInfo, existingDomain);
|
||||||
AddRemove add = command.getInnerAdd();
|
AddRemove add = command.getInnerAdd();
|
||||||
AddRemove remove = command.getInnerRemove();
|
AddRemove remove = command.getInnerRemove();
|
||||||
String tld = existingDomain.getTld();
|
String tldStr = existingDomain.getTld();
|
||||||
if (!isSuperuser) {
|
if (!isSuperuser) {
|
||||||
verifyNoDisallowedStatuses(existingDomain, UPDATE_DISALLOWED_STATUSES);
|
verifyNoDisallowedStatuses(existingDomain, UPDATE_DISALLOWED_STATUSES);
|
||||||
verifyResourceOwnership(registrarId, existingDomain);
|
verifyResourceOwnership(registrarId, existingDomain);
|
||||||
verifyClientUpdateNotProhibited(command, existingDomain);
|
verifyClientUpdateNotProhibited(command, existingDomain);
|
||||||
verifyAllStatusesAreClientSettable(union(add.getStatusValues(), remove.getStatusValues()));
|
verifyAllStatusesAreClientSettable(union(add.getStatusValues(), remove.getStatusValues()));
|
||||||
checkAllowedAccessToTld(registrarId, tld);
|
checkAllowedAccessToTld(registrarId, tldStr);
|
||||||
}
|
}
|
||||||
Registry registry = Registry.get(tld);
|
Tld tld = Tld.get(tldStr);
|
||||||
Optional<FeeUpdateCommandExtension> feeUpdate =
|
Optional<FeeUpdateCommandExtension> feeUpdate =
|
||||||
eppInput.getSingleExtension(FeeUpdateCommandExtension.class);
|
eppInput.getSingleExtension(FeeUpdateCommandExtension.class);
|
||||||
FeesAndCredits feesAndCredits = pricingLogic.getUpdatePrice(registry, targetId, now);
|
FeesAndCredits feesAndCredits = pricingLogic.getUpdatePrice(tld, targetId, now);
|
||||||
validateFeesAckedIfPresent(feeUpdate, feesAndCredits, false);
|
validateFeesAckedIfPresent(feeUpdate, feesAndCredits, false);
|
||||||
verifyNotInPendingDelete(
|
verifyNotInPendingDelete(
|
||||||
add.getContacts(),
|
add.getContacts(),
|
||||||
|
@ -238,8 +238,8 @@ public final class DomainUpdateFlow implements TransactionalFlow {
|
||||||
add.getNameservers());
|
add.getNameservers());
|
||||||
validateContactsHaveTypes(add.getContacts());
|
validateContactsHaveTypes(add.getContacts());
|
||||||
validateContactsHaveTypes(remove.getContacts());
|
validateContactsHaveTypes(remove.getContacts());
|
||||||
validateRegistrantAllowedOnTld(tld, command.getInnerChange().getRegistrantContactId());
|
validateRegistrantAllowedOnTld(tldStr, command.getInnerChange().getRegistrantContactId());
|
||||||
validateNameserversAllowedOnTld(tld, add.getNameserverHostNames());
|
validateNameserversAllowedOnTld(tldStr, add.getNameserverHostNames());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Domain performUpdate(Update command, Domain domain, DateTime now) throws EppException {
|
private Domain performUpdate(Update command, Domain domain, DateTime now) throws EppException {
|
||||||
|
@ -338,7 +338,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
|
||||||
.setReason(Reason.SERVER_STATUS)
|
.setReason(Reason.SERVER_STATUS)
|
||||||
.setTargetId(targetId)
|
.setTargetId(targetId)
|
||||||
.setRegistrarId(registrarId)
|
.setRegistrarId(registrarId)
|
||||||
.setCost(Registry.get(existingDomain.getTld()).getServerStatusChangeCost())
|
.setCost(Tld.get(existingDomain.getTld()).getServerStatusChangeCost())
|
||||||
.setEventTime(now)
|
.setEventTime(now)
|
||||||
.setBillingTime(now)
|
.setBillingTime(now)
|
||||||
.setDomainHistory(historyEntry)
|
.setDomainHistory(historyEntry)
|
||||||
|
|
|
@ -22,7 +22,7 @@ import google.registry.flows.EppException;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainCommand;
|
import google.registry.model.domain.DomainCommand;
|
||||||
import google.registry.model.domain.token.AllocationToken;
|
import google.registry.model.domain.token.AllocationToken;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +36,7 @@ public class AllocationTokenCustomLogic {
|
||||||
public AllocationToken validateToken(
|
public AllocationToken validateToken(
|
||||||
DomainCommand.Create command,
|
DomainCommand.Create command,
|
||||||
AllocationToken token,
|
AllocationToken token,
|
||||||
Registry registry,
|
Tld tld,
|
||||||
String registrarId,
|
String registrarId,
|
||||||
DateTime now)
|
DateTime now)
|
||||||
throws EppException {
|
throws EppException {
|
||||||
|
@ -46,7 +46,7 @@ public class AllocationTokenCustomLogic {
|
||||||
|
|
||||||
/** Performs additional custom logic for validating a token on an existing domain. */
|
/** Performs additional custom logic for validating a token on an existing domain. */
|
||||||
public AllocationToken validateToken(
|
public AllocationToken validateToken(
|
||||||
Domain domain, AllocationToken token, Registry registry, String registrarId, DateTime now)
|
Domain domain, AllocationToken token, Tld tld, String registrarId, DateTime now)
|
||||||
throws EppException {
|
throws EppException {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
return token;
|
return token;
|
||||||
|
|
|
@ -37,7 +37,7 @@ import google.registry.model.domain.token.AllocationToken.TokenStatus;
|
||||||
import google.registry.model.domain.token.AllocationToken.TokenType;
|
import google.registry.model.domain.token.AllocationToken.TokenType;
|
||||||
import google.registry.model.domain.token.AllocationTokenExtension;
|
import google.registry.model.domain.token.AllocationTokenExtension;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -173,7 +173,7 @@ public class AllocationTokenFlowUtils {
|
||||||
/** Verifies and returns the allocation token if one is specified, otherwise does nothing. */
|
/** Verifies and returns the allocation token if one is specified, otherwise does nothing. */
|
||||||
public Optional<AllocationToken> verifyAllocationTokenCreateIfPresent(
|
public Optional<AllocationToken> verifyAllocationTokenCreateIfPresent(
|
||||||
DomainCommand.Create command,
|
DomainCommand.Create command,
|
||||||
Registry registry,
|
Tld tld,
|
||||||
String registrarId,
|
String registrarId,
|
||||||
DateTime now,
|
DateTime now,
|
||||||
Optional<AllocationTokenExtension> extension)
|
Optional<AllocationTokenExtension> extension)
|
||||||
|
@ -188,14 +188,13 @@ public class AllocationTokenFlowUtils {
|
||||||
CommandName.CREATE,
|
CommandName.CREATE,
|
||||||
registrarId,
|
registrarId,
|
||||||
now);
|
now);
|
||||||
return Optional.of(
|
return Optional.of(tokenCustomLogic.validateToken(command, tokenEntity, tld, registrarId, now));
|
||||||
tokenCustomLogic.validateToken(command, tokenEntity, registry, registrarId, now));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Verifies and returns the allocation token if one is specified, otherwise does nothing. */
|
/** Verifies and returns the allocation token if one is specified, otherwise does nothing. */
|
||||||
public Optional<AllocationToken> verifyAllocationTokenIfPresent(
|
public Optional<AllocationToken> verifyAllocationTokenIfPresent(
|
||||||
Domain existingDomain,
|
Domain existingDomain,
|
||||||
Registry registry,
|
Tld tld,
|
||||||
String registrarId,
|
String registrarId,
|
||||||
DateTime now,
|
DateTime now,
|
||||||
CommandName commandName,
|
CommandName commandName,
|
||||||
|
@ -212,7 +211,7 @@ public class AllocationTokenFlowUtils {
|
||||||
registrarId,
|
registrarId,
|
||||||
now);
|
now);
|
||||||
return Optional.of(
|
return Optional.of(
|
||||||
tokenCustomLogic.validateToken(existingDomain, tokenEntity, registry, registrarId, now));
|
tokenCustomLogic.validateToken(existingDomain, tokenEntity, tld, registrarId, now));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyTokenAllowedOnDomain(
|
public static void verifyTokenAllowedOnDomain(
|
||||||
|
|
|
@ -35,7 +35,7 @@ import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.Host;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.reporting.HistoryEntryDao;
|
import google.registry.model.reporting.HistoryEntryDao;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.DomainTransferData;
|
import google.registry.model.transfer.DomainTransferData;
|
||||||
import google.registry.model.transfer.TransferData;
|
import google.registry.model.transfer.TransferData;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
|
@ -73,7 +73,7 @@ public final class EppResourceUtils {
|
||||||
|
|
||||||
/** Returns the full domain repoId in the format HEX-TLD for the specified long id and 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) {
|
public static String createDomainRepoId(long repoId, String tld) {
|
||||||
return createRepoId(repoId, Registry.get(tld).getRoidSuffix());
|
return createRepoId(repoId, Tld.get(tld).getRoidSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the full repoId in the format HEX-TLD for the specified long id and ROID suffix. */
|
/** Returns the full repoId in the format HEX-TLD for the specified long id and ROID suffix. */
|
||||||
|
|
|
@ -17,8 +17,8 @@ package google.registry.model;
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ 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.registrar.RegistrarAddress;
|
||||||
import google.registry.model.registrar.RegistrarPoc;
|
import google.registry.model.registrar.RegistrarPoc;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.model.tld.label.PremiumList;
|
import google.registry.model.tld.label.PremiumList;
|
||||||
import google.registry.model.tld.label.PremiumListDao;
|
import google.registry.model.tld.label.PremiumListDao;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
|
@ -121,9 +121,9 @@ public final class OteAccountBuilder {
|
||||||
ImmutableMap.of(CurrencyUnit.USD, "123", CurrencyUnit.JPY, "456");
|
ImmutableMap.of(CurrencyUnit.USD, "123", CurrencyUnit.JPY, "456");
|
||||||
|
|
||||||
private final ImmutableMap<String, String> registrarIdToTld;
|
private final ImmutableMap<String, String> registrarIdToTld;
|
||||||
private final Registry sunriseTld;
|
private final Tld sunriseTld;
|
||||||
private final Registry gaTld;
|
private final Tld gaTld;
|
||||||
private final Registry eapTld;
|
private final Tld eapTld;
|
||||||
private final ImmutableList.Builder<RegistrarPoc> contactsBuilder = new ImmutableList.Builder<>();
|
private final ImmutableList.Builder<RegistrarPoc> contactsBuilder = new ImmutableList.Builder<>();
|
||||||
|
|
||||||
private ImmutableList<Registrar> registrars;
|
private ImmutableList<Registrar> registrars;
|
||||||
|
@ -247,7 +247,7 @@ public final class OteAccountBuilder {
|
||||||
/** Saves all the OT&E entities we created. */
|
/** Saves all the OT&E entities we created. */
|
||||||
private void saveAllEntities() {
|
private void saveAllEntities() {
|
||||||
// use ImmutableObject instead of Registry so that the Key generation doesn't break
|
// use ImmutableObject instead of Registry so that the Key generation doesn't break
|
||||||
ImmutableList<Registry> registries = ImmutableList.of(sunriseTld, gaTld, eapTld);
|
ImmutableList<Tld> registries = ImmutableList.of(sunriseTld, gaTld, eapTld);
|
||||||
ImmutableList<RegistrarPoc> contacts = contactsBuilder.build();
|
ImmutableList<RegistrarPoc> contacts = contactsBuilder.build();
|
||||||
|
|
||||||
tm().transact(
|
tm().transact(
|
||||||
|
@ -255,8 +255,7 @@ public final class OteAccountBuilder {
|
||||||
if (!replaceExisting) {
|
if (!replaceExisting) {
|
||||||
ImmutableList<VKey<? extends ImmutableObject>> keys =
|
ImmutableList<VKey<? extends ImmutableObject>> keys =
|
||||||
Streams.concat(
|
Streams.concat(
|
||||||
registries.stream()
|
registries.stream().map(tld -> Tld.createVKey(tld.getTldStr())),
|
||||||
.map(registry -> Registry.createVKey(registry.getTldStr())),
|
|
||||||
registrars.stream().map(Registrar::createVKey),
|
registrars.stream().map(Registrar::createVKey),
|
||||||
contacts.stream().map(RegistrarPoc::createVKey))
|
contacts.stream().map(RegistrarPoc::createVKey))
|
||||||
.collect(toImmutableList());
|
.collect(toImmutableList());
|
||||||
|
@ -291,16 +290,13 @@ public final class OteAccountBuilder {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Registry createTld(
|
private static Tld createTld(
|
||||||
String tldName,
|
String tldName, TldState initialTldState, boolean isEarlyAccess, int roidSuffix) {
|
||||||
TldState initialTldState,
|
|
||||||
boolean isEarlyAccess,
|
|
||||||
int roidSuffix) {
|
|
||||||
String tldNameAlphaNumerical = tldName.replaceAll("[^a-z\\d]", "");
|
String tldNameAlphaNumerical = tldName.replaceAll("[^a-z\\d]", "");
|
||||||
Optional<PremiumList> premiumList = PremiumListDao.getLatestRevision(DEFAULT_PREMIUM_LIST);
|
Optional<PremiumList> premiumList = PremiumListDao.getLatestRevision(DEFAULT_PREMIUM_LIST);
|
||||||
checkState(premiumList.isPresent(), "Couldn't find premium list %s.", DEFAULT_PREMIUM_LIST);
|
checkState(premiumList.isPresent(), "Couldn't find premium list %s.", DEFAULT_PREMIUM_LIST);
|
||||||
Registry.Builder builder =
|
Tld.Builder builder =
|
||||||
new Registry.Builder()
|
new Tld.Builder()
|
||||||
.setTldStr(tldName)
|
.setTldStr(tldName)
|
||||||
.setPremiumPricingEngine(StaticPremiumListPricingEngine.NAME)
|
.setPremiumPricingEngine(StaticPremiumListPricingEngine.NAME)
|
||||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, initialTldState))
|
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, initialTldState))
|
||||||
|
|
|
@ -22,7 +22,7 @@ import google.registry.model.ImmutableObject;
|
||||||
import google.registry.model.UnsafeSerializable;
|
import google.registry.model.UnsafeSerializable;
|
||||||
import google.registry.model.UpdateAutoTimestampEntity;
|
import google.registry.model.UpdateAutoTimestampEntity;
|
||||||
import google.registry.model.common.Cursor.CursorId;
|
import google.registry.model.common.Cursor.CursorId;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.persistence.AttributeOverride;
|
import javax.persistence.AttributeOverride;
|
||||||
|
@ -134,7 +134,7 @@ public class Cursor extends UpdateAutoTimestampEntity {
|
||||||
return createVKey(type, GLOBAL);
|
return createVKey(type, GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VKey<Cursor> createScopedVKey(CursorType type, Registry tld) {
|
public static VKey<Cursor> createScopedVKey(CursorType type, Tld tld) {
|
||||||
return createVKey(type, tld.getTldStr());
|
return createVKey(type, tld.getTldStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,8 +172,8 @@ public class Cursor extends UpdateAutoTimestampEntity {
|
||||||
return create(cursorType, cursorTime, GLOBAL);
|
return create(cursorType, cursorTime, GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates a new cursor instance with a given {@link Registry} scope. */
|
/** Creates a new cursor instance with a given {@link Tld} scope. */
|
||||||
public static Cursor createScoped(CursorType cursorType, DateTime cursorTime, Registry scope) {
|
public static Cursor createScoped(CursorType cursorType, DateTime cursorTime, Tld scope) {
|
||||||
checkNotNull(scope, "Cursor scope cannot be null");
|
checkNotNull(scope, "Cursor scope cannot be null");
|
||||||
return create(cursorType, cursorTime, scope.getTldStr());
|
return create(cursorType, cursorTime, scope.getTldStr());
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ import google.registry.model.host.Host;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.poll.PollMessage.Autorenew;
|
import google.registry.model.poll.PollMessage.Autorenew;
|
||||||
import google.registry.model.poll.PollMessage.OneTime;
|
import google.registry.model.poll.PollMessage.OneTime;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.DomainTransferData;
|
import google.registry.model.transfer.DomainTransferData;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
|
@ -488,7 +488,7 @@ public class DomainBase extends EppResource
|
||||||
GracePeriodStatus.TRANSFER,
|
GracePeriodStatus.TRANSFER,
|
||||||
domain.getRepoId(),
|
domain.getRepoId(),
|
||||||
transferExpirationTime.plus(
|
transferExpirationTime.plus(
|
||||||
Registry.get(domain.getTld()).getTransferGracePeriodLength()),
|
Tld.get(domain.getTld()).getTransferGracePeriodLength()),
|
||||||
transferData.getGainingRegistrarId(),
|
transferData.getGainingRegistrarId(),
|
||||||
transferData.getServerApproveBillingEvent())));
|
transferData.getServerApproveBillingEvent())));
|
||||||
} else {
|
} else {
|
||||||
|
@ -523,8 +523,7 @@ public class DomainBase extends EppResource
|
||||||
GracePeriod.createForRecurring(
|
GracePeriod.createForRecurring(
|
||||||
GracePeriodStatus.AUTO_RENEW,
|
GracePeriodStatus.AUTO_RENEW,
|
||||||
domain.getRepoId(),
|
domain.getRepoId(),
|
||||||
lastAutorenewTime.plus(
|
lastAutorenewTime.plus(Tld.get(domain.getTld()).getAutoRenewGracePeriodLength()),
|
||||||
Registry.get(domain.getTld()).getAutoRenewGracePeriodLength()),
|
|
||||||
domain.getCurrentSponsorRegistrarId(),
|
domain.getCurrentSponsorRegistrarId(),
|
||||||
domain.getAutorenewBillingEvent()));
|
domain.getAutorenewBillingEvent()));
|
||||||
newLastEppUpdateTime = Optional.of(lastAutorenewTime);
|
newLastEppUpdateTime = Optional.of(lastAutorenewTime);
|
||||||
|
|
|
@ -18,7 +18,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static google.registry.util.DomainNameUtils.getTldFromDomainName;
|
import static google.registry.util.DomainNameUtils.getTldFromDomainName;
|
||||||
|
|
||||||
import com.google.common.net.InternetDomainName;
|
import com.google.common.net.InternetDomainName;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.label.PremiumListDao;
|
import google.registry.model.tld.label.PremiumListDao;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -35,14 +35,14 @@ public final class StaticPremiumListPricingEngine implements PremiumPricingEngin
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DomainPrices getDomainPrices(String domainName, DateTime priceTime) {
|
public DomainPrices getDomainPrices(String domainName, DateTime priceTime) {
|
||||||
String tld = getTldFromDomainName(domainName);
|
String tldStr = getTldFromDomainName(domainName);
|
||||||
String label = InternetDomainName.from(domainName).parts().get(0);
|
String label = InternetDomainName.from(domainName).parts().get(0);
|
||||||
Registry registry = Registry.get(checkNotNull(tld, "tld"));
|
Tld tld = Tld.get(checkNotNull(tldStr, "tld"));
|
||||||
Optional<Money> premiumPrice =
|
Optional<Money> premiumPrice =
|
||||||
registry.getPremiumListName().flatMap(pl -> PremiumListDao.getPremiumPrice(pl, label));
|
tld.getPremiumListName().flatMap(pl -> PremiumListDao.getPremiumPrice(pl, label));
|
||||||
return DomainPrices.create(
|
return DomainPrices.create(
|
||||||
premiumPrice.isPresent(),
|
premiumPrice.isPresent(),
|
||||||
premiumPrice.orElse(registry.getStandardCreateCost()),
|
premiumPrice.orElse(tld.getStandardCreateCost()),
|
||||||
premiumPrice.orElse(registry.getStandardRenewCost(priceTime)));
|
premiumPrice.orElse(tld.getStandardRenewCost(priceTime)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,8 @@ import google.registry.model.JsonMapBuilder;
|
||||||
import google.registry.model.Jsonifiable;
|
import google.registry.model.Jsonifiable;
|
||||||
import google.registry.model.UpdateAutoTimestamp;
|
import google.registry.model.UpdateAutoTimestamp;
|
||||||
import google.registry.model.UpdateAutoTimestampEntity;
|
import google.registry.model.UpdateAutoTimestampEntity;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.util.CidrAddressBlock;
|
import google.registry.util.CidrAddressBlock;
|
||||||
import java.security.cert.CertificateParsingException;
|
import java.security.cert.CertificateParsingException;
|
||||||
|
@ -723,11 +723,11 @@ public class Registrar extends UpdateAutoTimestampEntity implements Buildable, J
|
||||||
* to set the allowed TLDs.
|
* to set the allowed TLDs.
|
||||||
*/
|
*/
|
||||||
public Builder setAllowedTldsUncached(Set<String> allowedTlds) {
|
public Builder setAllowedTldsUncached(Set<String> allowedTlds) {
|
||||||
ImmutableSet<VKey<Registry>> newTldKeys =
|
ImmutableSet<VKey<Tld>> newTldKeys =
|
||||||
Sets.difference(allowedTlds, getInstance().getAllowedTlds()).stream()
|
Sets.difference(allowedTlds, getInstance().getAllowedTlds()).stream()
|
||||||
.map(Registry::createVKey)
|
.map(Tld::createVKey)
|
||||||
.collect(toImmutableSet());
|
.collect(toImmutableSet());
|
||||||
Set<VKey<Registry>> missingTldKeys =
|
Set<VKey<Tld>> missingTldKeys =
|
||||||
Sets.difference(
|
Sets.difference(
|
||||||
newTldKeys, tm().transact(() -> tm().loadByKeysIfPresent(newTldKeys)).keySet());
|
newTldKeys, tm().transact(() -> tm().loadByKeysIfPresent(newTldKeys)).keySet());
|
||||||
checkArgument(missingTldKeys.isEmpty(), "Trying to set nonexistent TLDs: %s", missingTldKeys);
|
checkArgument(missingTldKeys.isEmpty(), "Trying to set nonexistent TLDs: %s", missingTldKeys);
|
||||||
|
@ -903,10 +903,10 @@ public class Registrar extends UpdateAutoTimestampEntity implements Buildable, J
|
||||||
// In order to grant access to real TLDs, the registrar must have a corresponding billing
|
// In order to grant access to real TLDs, the registrar must have a corresponding billing
|
||||||
// account ID for that TLD's billing currency.
|
// account ID for that TLD's billing currency.
|
||||||
ImmutableSet<String> nonBillableTlds =
|
ImmutableSet<String> nonBillableTlds =
|
||||||
Registry.get(getInstance().getAllowedTlds()).stream()
|
Tld.get(getInstance().getAllowedTlds()).stream()
|
||||||
.filter(r -> r.getTldType() == TldType.REAL)
|
.filter(r -> r.getTldType() == TldType.REAL)
|
||||||
.filter(r -> !getInstance().getBillingAccountMap().containsKey(r.getCurrency()))
|
.filter(r -> !getInstance().getBillingAccountMap().containsKey(r.getCurrency()))
|
||||||
.map(Registry::getTldStr)
|
.map(Tld::getTldStr)
|
||||||
.collect(toImmutableSet());
|
.collect(toImmutableSet());
|
||||||
checkArgument(
|
checkArgument(
|
||||||
nonBillableTlds.isEmpty(),
|
nonBillableTlds.isEmpty(),
|
||||||
|
|
|
@ -32,14 +32,14 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Streams;
|
import com.google.common.collect.Streams;
|
||||||
import com.google.common.net.InternetDomainName;
|
import com.google.common.net.InternetDomainName;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.util.DomainNameUtils;
|
import google.registry.util.DomainNameUtils;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
|
||||||
/** Utilities for finding and listing {@link Registry} entities. */
|
/** Utilities for finding and listing {@link Tld} entities. */
|
||||||
public final class Registries {
|
public final class Registries {
|
||||||
|
|
||||||
private Registries() {}
|
private Registries() {}
|
||||||
|
@ -85,8 +85,8 @@ public final class Registries {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the Registry entities themselves of the given type loaded fresh from the database. */
|
/** Returns the Registry entities themselves of the given type loaded fresh from the database. */
|
||||||
public static ImmutableSet<Registry> getTldEntitiesOfType(TldType type) {
|
public static ImmutableSet<Tld> getTldEntitiesOfType(TldType type) {
|
||||||
return Registry.get(filterValues(cache.get(), equalTo(type)).keySet());
|
return Tld.get(filterValues(cache.get(), equalTo(type)).keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Pass-through check that the specified TLD exists, otherwise throw an IAE. */
|
/** Pass-through check that the specified TLD exists, otherwise throw an IAE. */
|
||||||
|
|
|
@ -76,12 +76,12 @@ import org.joda.time.DateTime;
|
||||||
import org.joda.time.Duration;
|
import org.joda.time.Duration;
|
||||||
|
|
||||||
/** Persisted per-TLD configuration data. */
|
/** Persisted per-TLD configuration data. */
|
||||||
@Entity(name = "Tld")
|
@Entity
|
||||||
public class Registry extends ImmutableObject implements Buildable, UnsafeSerializable {
|
public class Tld extends ImmutableObject implements Buildable, UnsafeSerializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The canonical string representation of the TLD associated with this {@link Registry}, which is
|
* The canonical string representation of the TLD associated with this {@link Tld}, which is the
|
||||||
* the standard ASCII for regular TLDs and punycoded ASCII for IDN TLDs.
|
* standard ASCII for regular TLDs and punycoded ASCII for IDN TLDs.
|
||||||
*/
|
*/
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "tld_name", nullable = false)
|
@Column(name = "tld_name", nullable = false)
|
||||||
|
@ -132,7 +132,7 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
*/
|
*/
|
||||||
public enum TldState {
|
public enum TldState {
|
||||||
|
|
||||||
/** The state of not yet being delegated to this registry in the root zone by IANA. */
|
/** The state of not yet being delegated to this TLD in the root zone by IANA. */
|
||||||
PREDELEGATION,
|
PREDELEGATION,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,19 +158,19 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
PDT
|
PDT
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the registry for a given TLD, throwing if none exists. */
|
/** Returns the TLD for a given TLD, throwing if none exists. */
|
||||||
public static Registry get(String tld) {
|
public static Tld get(String tld) {
|
||||||
Registry maybeRegistry = CACHE.get(tld);
|
Tld maybeTld = CACHE.get(tld);
|
||||||
if (maybeRegistry == null) {
|
if (maybeTld == null) {
|
||||||
throw new RegistryNotFoundException(tld);
|
throw new TldNotFoundException(tld);
|
||||||
} else {
|
} else {
|
||||||
return maybeRegistry;
|
return maybeTld;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the registry entities for the given TLD strings, throwing if any don't exist. */
|
/** Returns the TLD entities for the given TLD strings, throwing if any don't exist. */
|
||||||
public static ImmutableSet<Registry> get(Set<String> tlds) {
|
public static ImmutableSet<Tld> get(Set<String> tlds) {
|
||||||
Map<String, Registry> registries = CACHE.getAll(tlds);
|
Map<String, Tld> registries = CACHE.getAll(tlds);
|
||||||
ImmutableSet<String> missingRegistries =
|
ImmutableSet<String> missingRegistries =
|
||||||
registries.entrySet().stream()
|
registries.entrySet().stream()
|
||||||
.filter(e -> e.getValue() == null)
|
.filter(e -> e.getValue() == null)
|
||||||
|
@ -179,48 +179,48 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
if (missingRegistries.isEmpty()) {
|
if (missingRegistries.isEmpty()) {
|
||||||
return registries.values().stream().collect(toImmutableSet());
|
return registries.values().stream().collect(toImmutableSet());
|
||||||
} else {
|
} else {
|
||||||
throw new RegistryNotFoundException(missingRegistries);
|
throw new TldNotFoundException(missingRegistries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invalidates the cache entry.
|
* Invalidates the cache entry.
|
||||||
*
|
*
|
||||||
* <p>This is called automatically when the registry is saved. One should also call it when a
|
* <p>This is called automatically when the tld is saved. One should also call it when a tld is
|
||||||
* registry is deleted.
|
* deleted.
|
||||||
*/
|
*/
|
||||||
@PostPersist
|
@PostPersist
|
||||||
public void invalidateInCache() {
|
public void invalidateInCache() {
|
||||||
CACHE.invalidate(tldStr);
|
CACHE.invalidate(tldStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A cache that loads the {@link Registry} for a given tld. */
|
/** A cache that loads the {@link Tld} for a given tld. */
|
||||||
private static final LoadingCache<String, Registry> CACHE =
|
private static final LoadingCache<String, Tld> CACHE =
|
||||||
CacheUtils.newCacheBuilder(getSingletonCacheRefreshDuration())
|
CacheUtils.newCacheBuilder(getSingletonCacheRefreshDuration())
|
||||||
.build(
|
.build(
|
||||||
new CacheLoader<String, Registry>() {
|
new CacheLoader<String, Tld>() {
|
||||||
@Override
|
@Override
|
||||||
public Registry load(final String tld) {
|
public Tld load(final String tld) {
|
||||||
return tm().transact(() -> tm().loadByKeyIfPresent(createVKey(tld))).orElse(null);
|
return tm().transact(() -> tm().loadByKeyIfPresent(createVKey(tld))).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Registry> loadAll(Iterable<? extends String> tlds) {
|
public Map<String, Tld> loadAll(Iterable<? extends String> tlds) {
|
||||||
ImmutableMap<String, VKey<Registry>> keysMap =
|
ImmutableMap<String, VKey<Tld>> keysMap =
|
||||||
toMap(ImmutableSet.copyOf(tlds), Registry::createVKey);
|
toMap(ImmutableSet.copyOf(tlds), Tld::createVKey);
|
||||||
Map<VKey<? extends Registry>, Registry> entities =
|
Map<VKey<? extends Tld>, Tld> entities =
|
||||||
tm().transact(() -> tm().loadByKeysIfPresent(keysMap.values()));
|
tm().transact(() -> tm().loadByKeysIfPresent(keysMap.values()));
|
||||||
return Maps.transformEntries(keysMap, (k, v) -> entities.getOrDefault(v, null));
|
return Maps.transformEntries(keysMap, (k, v) -> entities.getOrDefault(v, null));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
public static VKey<Registry> createVKey(String tld) {
|
public static VKey<Tld> createVKey(String tld) {
|
||||||
return VKey.create(Registry.class, tld);
|
return VKey.create(Tld.class, tld);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VKey<Registry> createVKey() {
|
public VKey<Tld> createVKey() {
|
||||||
return VKey.create(Registry.class, tldStr);
|
return VKey.create(Tld.class, tldStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -248,7 +248,7 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
/**
|
/**
|
||||||
* The number of locks we allow at once for {@link google.registry.dns.PublishDnsUpdatesAction}.
|
* The number of locks we allow at once for {@link google.registry.dns.PublishDnsUpdatesAction}.
|
||||||
*
|
*
|
||||||
* <p>This should always be a positive integer -- use 1 for TLD-wide locks. All {@link Registry}
|
* <p>This should always be a positive integer -- use 1 for TLD-wide locks. All {@link Tld}
|
||||||
* objects have this value default to 1.
|
* objects have this value default to 1.
|
||||||
*
|
*
|
||||||
* <p>WARNING: changing this parameter changes the lock name for subsequent DNS updates, and thus
|
* <p>WARNING: changing this parameter changes the lock name for subsequent DNS updates, and thus
|
||||||
|
@ -259,7 +259,7 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
* <ol>
|
* <ol>
|
||||||
* <li>Pause the DNS queue via {@link google.registry.tools.UpdateTldCommand}
|
* <li>Pause the DNS queue via {@link google.registry.tools.UpdateTldCommand}
|
||||||
* <li>Change this number
|
* <li>Change this number
|
||||||
* <li>Let the Registry caches expire (currently 5 minutes) and drain the DNS publish queue
|
* <li>Let the Tld caches expire (currently 5 minutes) and drain the DNS publish queue
|
||||||
* <li>Unpause the DNS queue
|
* <li>Unpause the DNS queue
|
||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
|
@ -297,7 +297,7 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
*/
|
*/
|
||||||
Duration dnsDsTtl;
|
Duration dnsDsTtl;
|
||||||
/**
|
/**
|
||||||
* The unicode-aware representation of the TLD associated with this {@link Registry}.
|
* The unicode-aware representation of the TLD associated with this {@link Tld}.
|
||||||
*
|
*
|
||||||
* <p>This will be equal to {@link #tldStr} for ASCII TLDs, but will be non-ASCII for IDN TLDs. We
|
* <p>This will be equal to {@link #tldStr} for ASCII TLDs, but will be non-ASCII for IDN TLDs. We
|
||||||
* store this in a field so that it will be retained upon import into BigQuery.
|
* store this in a field so that it will be retained upon import into BigQuery.
|
||||||
|
@ -335,7 +335,7 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
CreateAutoTimestamp creationTime = CreateAutoTimestamp.create(null);
|
CreateAutoTimestamp creationTime = CreateAutoTimestamp.create(null);
|
||||||
|
|
||||||
/** The set of reserved list names that are applicable to this registry. */
|
/** The set of reserved list names that are applicable to this tld. */
|
||||||
@Column(name = "reserved_list_names")
|
@Column(name = "reserved_list_names")
|
||||||
Set<String> reservedListNames;
|
Set<String> reservedListNames;
|
||||||
|
|
||||||
|
@ -344,8 +344,8 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
*
|
*
|
||||||
* <p>This set contains only the names of the list and not a reference to the lists. Updates to a
|
* <p>This set contains only the names of the list and not a reference to the lists. Updates to a
|
||||||
* reserved list in Cloud SQL are saved as a new ReservedList entity. When using the ReservedList
|
* reserved list in Cloud SQL are saved as a new ReservedList entity. When using the ReservedList
|
||||||
* for a registry, the database should be queried for the entity with this name that has the
|
* for a tld, the database should be queried for the entity with this name that has the largest
|
||||||
* largest revision ID.
|
* revision ID.
|
||||||
*/
|
*/
|
||||||
public ImmutableSet<String> getReservedListNames() {
|
public ImmutableSet<String> getReservedListNames() {
|
||||||
return nullToEmptyImmutableCopy(reservedListNames);
|
return nullToEmptyImmutableCopy(reservedListNames);
|
||||||
|
@ -355,9 +355,8 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
* The name of the {@link PremiumList} for this TLD, if there is one.
|
* The name of the {@link PremiumList} for this TLD, if there is one.
|
||||||
*
|
*
|
||||||
* <p>This is only the name of the list and not a reference to the list. Updates to the premium
|
* <p>This is only the name of the list and not a reference to the list. Updates to the premium
|
||||||
* list in Cloud SQL are saved as a new PremiumList entity. When using the PremiumList for a
|
* list in Cloud SQL are saved as a new PremiumList entity. When using the PremiumList for a tld,
|
||||||
* registry, the database should be queried for the entity with this name that has the largest
|
* the database should be queried for the entity with this name that has the largest revision ID.
|
||||||
* revision ID.
|
|
||||||
*/
|
*/
|
||||||
@Column(name = "premium_list_name")
|
@Column(name = "premium_list_name")
|
||||||
String premiumListName;
|
String premiumListName;
|
||||||
|
@ -591,8 +590,8 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the add-on cost of a domain restore (the flat registry-wide fee charged in addition to
|
* Returns the add-on cost of a domain restore (the flat tld-wide fee charged in addition to one
|
||||||
* one year of renewal for that name).
|
* year of renewal for that name).
|
||||||
*/
|
*/
|
||||||
public Money getStandardRestoreCost() {
|
public Money getStandardRestoreCost() {
|
||||||
return restoreBillingCost;
|
return restoreBillingCost;
|
||||||
|
@ -625,7 +624,7 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
return renewBillingCostTransitions.toValueMap();
|
return renewBillingCostTransitions.toValueMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the EAP fee for the registry at the given time. */
|
/** Returns the EAP fee for the tld at the given time. */
|
||||||
public Fee getEapFeeFor(DateTime now) {
|
public Fee getEapFeeFor(DateTime now) {
|
||||||
ImmutableSortedMap<DateTime, Money> valueMap = getEapFeeScheduleAsMap();
|
ImmutableSortedMap<DateTime, Money> valueMap = getEapFeeScheduleAsMap();
|
||||||
DateTime periodStart = valueMap.floorKey(now);
|
DateTime periodStart = valueMap.floorKey(now);
|
||||||
|
@ -707,11 +706,11 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
return new Builder(clone(this));
|
return new Builder(clone(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A builder for constructing {@link Registry} objects, since they are immutable. */
|
/** A builder for constructing {@link Tld} objects, since they are immutable. */
|
||||||
public static class Builder extends Buildable.Builder<Registry> {
|
public static class Builder extends Buildable.Builder<Tld> {
|
||||||
public Builder() {}
|
public Builder() {}
|
||||||
|
|
||||||
private Builder(Registry instance) {
|
private Builder(Tld instance) {
|
||||||
super(instance);
|
super(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1006,8 +1005,8 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Registry build() {
|
public Tld build() {
|
||||||
final Registry instance = getInstance();
|
final Tld instance = getInstance();
|
||||||
// Pick up the name of the associated TLD from the instance object.
|
// Pick up the name of the associated TLD from the instance object.
|
||||||
String tldName = instance.tldStr;
|
String tldName = instance.tldStr;
|
||||||
checkArgument(tldName != null, "No registry TLD specified");
|
checkArgument(tldName != null, "No registry TLD specified");
|
||||||
|
@ -1019,7 +1018,7 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
// Check the validity of all TimedTransitionProperties to ensure that they have values for
|
// Check the validity of all TimedTransitionProperties to ensure that they have values for
|
||||||
// START_OF_TIME. The setters above have already checked this for new values, but also check
|
// START_OF_TIME. The setters above have already checked this for new values, but also check
|
||||||
// here to catch cases where we loaded an invalid TimedTransitionProperty from the database
|
// here to catch cases where we loaded an invalid TimedTransitionProperty from the database
|
||||||
// and cloned it into a new builder, to block re-building a Registry in an invalid state.
|
// and cloned it into a new builder, to block re-building a Tld in an invalid state.
|
||||||
instance.tldStateTransitions.checkValidity();
|
instance.tldStateTransitions.checkValidity();
|
||||||
instance.renewBillingCostTransitions.checkValidity();
|
instance.renewBillingCostTransitions.checkValidity();
|
||||||
instance.eapFeeSchedule.checkValidity();
|
instance.eapFeeSchedule.checkValidity();
|
||||||
|
@ -1027,24 +1026,24 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
checkArgumentNotNull(instance.getCurrency(), "Currency must be set");
|
checkArgumentNotNull(instance.getCurrency(), "Currency must be set");
|
||||||
checkArgument(
|
checkArgument(
|
||||||
instance.getStandardCreateCost().getCurrencyUnit().equals(instance.currency),
|
instance.getStandardCreateCost().getCurrencyUnit().equals(instance.currency),
|
||||||
"Create cost must be in the registry's currency");
|
"Create cost must be in the tld's currency");
|
||||||
checkArgument(
|
checkArgument(
|
||||||
instance.getStandardRestoreCost().getCurrencyUnit().equals(instance.currency),
|
instance.getStandardRestoreCost().getCurrencyUnit().equals(instance.currency),
|
||||||
"Restore cost must be in the registry's currency");
|
"Restore cost must be in the TLD's currency");
|
||||||
checkArgument(
|
checkArgument(
|
||||||
instance.getServerStatusChangeCost().getCurrencyUnit().equals(instance.currency),
|
instance.getServerStatusChangeCost().getCurrencyUnit().equals(instance.currency),
|
||||||
"Server status change cost must be in the registry's currency");
|
"Server status change cost must be in the TLD's currency");
|
||||||
checkArgument(
|
checkArgument(
|
||||||
instance.getRegistryLockOrUnlockBillingCost().getCurrencyUnit().equals(instance.currency),
|
instance.getRegistryLockOrUnlockBillingCost().getCurrencyUnit().equals(instance.currency),
|
||||||
"Registry lock/unlock cost must be in the registry's currency");
|
"Registry lock/unlock cost must be in the TLD's currency");
|
||||||
Predicate<Money> currencyCheck =
|
Predicate<Money> currencyCheck =
|
||||||
(Money money) -> money.getCurrencyUnit().equals(instance.currency);
|
(Money money) -> money.getCurrencyUnit().equals(instance.currency);
|
||||||
checkArgument(
|
checkArgument(
|
||||||
instance.getRenewBillingCostTransitions().values().stream().allMatch(currencyCheck),
|
instance.getRenewBillingCostTransitions().values().stream().allMatch(currencyCheck),
|
||||||
"Renew cost must be in the registry's currency");
|
"Renew cost must be in the TLD's currency");
|
||||||
checkArgument(
|
checkArgument(
|
||||||
instance.eapFeeSchedule.toValueMap().values().stream().allMatch(currencyCheck),
|
instance.eapFeeSchedule.toValueMap().values().stream().allMatch(currencyCheck),
|
||||||
"All EAP fees must be in the registry's currency");
|
"All EAP fees must be in the TLD's currency");
|
||||||
checkArgumentNotNull(
|
checkArgumentNotNull(
|
||||||
instance.pricingEngineClassName, "All registries must have a configured pricing engine");
|
instance.pricingEngineClassName, "All registries must have a configured pricing engine");
|
||||||
checkArgument(
|
checkArgument(
|
||||||
|
@ -1062,14 +1061,14 @@ public class Registry extends ImmutableObject implements Buildable, UnsafeSerial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Exception to throw when no Registry entity is found for given TLD string(s). */
|
/** Exception to throw when no Tld entity is found for given TLD string(s). */
|
||||||
public static class RegistryNotFoundException extends RuntimeException {
|
public static class TldNotFoundException extends RuntimeException {
|
||||||
|
|
||||||
RegistryNotFoundException(ImmutableSet<String> tlds) {
|
TldNotFoundException(ImmutableSet<String> tlds) {
|
||||||
super("No registry object(s) found for " + Joiner.on(", ").join(tlds));
|
super("No TLD object(s) found for " + Joiner.on(", ").join(tlds));
|
||||||
}
|
}
|
||||||
|
|
||||||
RegistryNotFoundException(String tld) {
|
TldNotFoundException(String tld) {
|
||||||
this(ImmutableSet.of(tld));
|
this(ImmutableSet.of(tld));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,7 +27,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Multiset;
|
import com.google.common.collect.Multiset;
|
||||||
import google.registry.model.Buildable;
|
import google.registry.model.Buildable;
|
||||||
import google.registry.model.ImmutableObject;
|
import google.registry.model.ImmutableObject;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -138,11 +138,11 @@ public abstract class BaseDomainLabelList<T extends Comparable<?>, R extends Dom
|
||||||
/** Gets the names of the tlds that reference this list. */
|
/** Gets the names of the tlds that reference this list. */
|
||||||
public final ImmutableSet<String> getReferencingTlds() {
|
public final ImmutableSet<String> getReferencingTlds() {
|
||||||
return getTlds().stream()
|
return getTlds().stream()
|
||||||
.filter((tld) -> refersToList(Registry.get(tld), name))
|
.filter((tld) -> refersToList(Tld.get(tld), name))
|
||||||
.collect(toImmutableSet());
|
.collect(toImmutableSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract boolean refersToList(Registry registry, String name);
|
protected abstract boolean refersToList(Tld tld, String name);
|
||||||
|
|
||||||
/** Base builder for derived classes of {@link BaseDomainLabelList}. */
|
/** Base builder for derived classes of {@link BaseDomainLabelList}. */
|
||||||
public abstract static class Builder<T extends BaseDomainLabelList<?, ?>, B extends Builder<T, ?>>
|
public abstract static class Builder<T extends BaseDomainLabelList<?, ?>, B extends Builder<T, ?>>
|
||||||
|
|
|
@ -23,7 +23,7 @@ import com.google.common.base.Splitter;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.hash.BloomFilter;
|
import com.google.common.hash.BloomFilter;
|
||||||
import google.registry.model.Buildable;
|
import google.registry.model.Buildable;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.label.PremiumList.PremiumEntry;
|
import google.registry.model.tld.label.PremiumList.PremiumEntry;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -200,8 +200,8 @@ public final class PremiumList extends BaseDomainLabelList<BigDecimal, PremiumEn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean refersToList(Registry registry, String name) {
|
public boolean refersToList(Tld tld, String name) {
|
||||||
return Objects.equals(registry.getPremiumListName().orElse(null), name);
|
return Objects.equals(tld.getPremiumListName().orElse(null), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,7 +33,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||||
import google.registry.model.Buildable;
|
import google.registry.model.Buildable;
|
||||||
import google.registry.model.CacheUtils;
|
import google.registry.model.CacheUtils;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.label.DomainLabelMetrics.MetricsReservedListMatch;
|
import google.registry.model.tld.label.DomainLabelMetrics.MetricsReservedListMatch;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -173,8 +173,8 @@ public final class ReservedList
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean refersToList(Registry registry, String name) {
|
protected boolean refersToList(Tld tld, String name) {
|
||||||
return registry.getReservedListNames().contains(name);
|
return tld.getReservedListNames().contains(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Determines whether the ReservedList is in use on any Registry */
|
/** Determines whether the ReservedList is in use on any Registry */
|
||||||
|
@ -243,15 +243,16 @@ public final class ReservedList
|
||||||
* Helper function to retrieve the entries associated with this label and TLD, or an empty set if
|
* Helper function to retrieve the entries associated with this label and TLD, or an empty set if
|
||||||
* no such entry exists.
|
* no such entry exists.
|
||||||
*/
|
*/
|
||||||
private static ImmutableSet<ReservedListEntry> getReservedListEntries(String label, String tld) {
|
private static ImmutableSet<ReservedListEntry> getReservedListEntries(
|
||||||
|
String label, String tldStr) {
|
||||||
DateTime startTime = DateTime.now(UTC);
|
DateTime startTime = DateTime.now(UTC);
|
||||||
Registry registry = Registry.get(checkNotNull(tld, "tld must not be null"));
|
Tld tld = Tld.get(checkNotNull(tldStr, "tld must not be null"));
|
||||||
ImmutableSet.Builder<ReservedListEntry> entriesBuilder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<ReservedListEntry> entriesBuilder = new ImmutableSet.Builder<>();
|
||||||
ImmutableSet.Builder<MetricsReservedListMatch> metricMatchesBuilder =
|
ImmutableSet.Builder<MetricsReservedListMatch> metricMatchesBuilder =
|
||||||
new ImmutableSet.Builder<>();
|
new ImmutableSet.Builder<>();
|
||||||
|
|
||||||
// Loop through all reservation lists and add each of them.
|
// Loop through all reservation lists and add each of them.
|
||||||
for (ReservedList rl : loadReservedLists(registry.getReservedListNames())) {
|
for (ReservedList rl : loadReservedLists(tld.getReservedListNames())) {
|
||||||
if (rl.getReservedListEntries().containsKey(label)) {
|
if (rl.getReservedListEntries().containsKey(label)) {
|
||||||
ReservedListEntry entry = rl.getReservedListEntries().get(label);
|
ReservedListEntry entry = rl.getReservedListEntries().get(label);
|
||||||
entriesBuilder.add(entry);
|
entriesBuilder.add(entry);
|
||||||
|
@ -261,7 +262,9 @@ public final class ReservedList
|
||||||
}
|
}
|
||||||
ImmutableSet<ReservedListEntry> entries = entriesBuilder.build();
|
ImmutableSet<ReservedListEntry> entries = entriesBuilder.build();
|
||||||
DomainLabelMetrics.recordReservedListCheckOutcome(
|
DomainLabelMetrics.recordReservedListCheckOutcome(
|
||||||
tld, metricMatchesBuilder.build(), DateTime.now(UTC).getMillis() - startTime.getMillis());
|
tldStr,
|
||||||
|
metricMatchesBuilder.build(),
|
||||||
|
DateTime.now(UTC).getMillis() - startTime.getMillis());
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
package google.registry.persistence.converter;
|
package google.registry.persistence.converter;
|
||||||
|
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import javax.persistence.Converter;
|
import javax.persistence.Converter;
|
||||||
|
|
||||||
/** JPA converter for storing/retrieving {@code TimedTransitionProperty<TldState>} objects. */
|
/** JPA converter for storing/retrieving {@code TimedTransitionProperty<TldState>} objects. */
|
||||||
|
|
|
@ -20,7 +20,7 @@ import static google.registry.util.DomainNameUtils.getTldFromDomainName;
|
||||||
|
|
||||||
import google.registry.model.pricing.PremiumPricingEngine;
|
import google.registry.model.pricing.PremiumPricingEngine;
|
||||||
import google.registry.model.pricing.PremiumPricingEngine.DomainPrices;
|
import google.registry.model.pricing.PremiumPricingEngine.DomainPrices;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
@ -58,7 +58,7 @@ public final class PricingEngineProxy {
|
||||||
*/
|
*/
|
||||||
public static DomainPrices getPricesForDomainName(String domainName, DateTime priceTime) {
|
public static DomainPrices getPricesForDomainName(String domainName, DateTime priceTime) {
|
||||||
String tld = getTldFromDomainName(domainName);
|
String tld = getTldFromDomainName(domainName);
|
||||||
String clazz = Registry.get(tld).getPremiumPricingEngineClassName();
|
String clazz = Tld.get(tld).getPremiumPricingEngineClassName();
|
||||||
PremiumPricingEngine engine = premiumPricingEngines.get(clazz);
|
PremiumPricingEngine engine = premiumPricingEngines.get(clazz);
|
||||||
checkState(engine != null, "Could not load pricing engine %s for TLD %s", clazz, tld);
|
checkState(engine != null, "Could not load pricing engine %s for TLD %s", clazz, tld);
|
||||||
return engine.getDomainPrices(domainName, priceTime);
|
return engine.getDomainPrices(domainName, priceTime);
|
||||||
|
|
|
@ -30,7 +30,7 @@ import google.registry.keyring.api.KeyModule.Key;
|
||||||
import google.registry.model.common.Cursor;
|
import google.registry.model.common.Cursor;
|
||||||
import google.registry.model.rde.RdeNamingUtils;
|
import google.registry.model.rde.RdeNamingUtils;
|
||||||
import google.registry.model.rde.RdeRevision;
|
import google.registry.model.rde.RdeRevision;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.HttpException.NoContentException;
|
import google.registry.request.HttpException.NoContentException;
|
||||||
import google.registry.request.Parameter;
|
import google.registry.request.Parameter;
|
||||||
|
@ -97,8 +97,7 @@ public final class BrdaCopyAction implements Runnable {
|
||||||
// TODO(b/217772483): consider guarding this action with a lock and check if there is work.
|
// TODO(b/217772483): consider guarding this action with a lock and check if there is work.
|
||||||
// Not urgent since file writes on GCS are atomic.
|
// Not urgent since file writes on GCS are atomic.
|
||||||
Optional<Cursor> cursor =
|
Optional<Cursor> cursor =
|
||||||
tm().transact(
|
tm().transact(() -> tm().loadByKeyIfPresent(Cursor.createScopedVKey(BRDA, Tld.get(tld))));
|
||||||
() -> tm().loadByKeyIfPresent(Cursor.createScopedVKey(BRDA, Registry.get(tld))));
|
|
||||||
DateTime brdaCursorTime = getCursorTimeOrStartOfTime(cursor);
|
DateTime brdaCursorTime = getCursorTimeOrStartOfTime(cursor);
|
||||||
if (isBeforeOrAt(brdaCursorTime, watermark)) {
|
if (isBeforeOrAt(brdaCursorTime, watermark)) {
|
||||||
throw new NoContentException(
|
throw new NoContentException(
|
||||||
|
|
|
@ -19,7 +19,7 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
|
||||||
import com.google.common.flogger.FluentLogger;
|
import com.google.common.flogger.FluentLogger;
|
||||||
import google.registry.model.common.Cursor;
|
import google.registry.model.common.Cursor;
|
||||||
import google.registry.model.common.Cursor.CursorType;
|
import google.registry.model.common.Cursor.CursorType;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.request.HttpException.NoContentException;
|
import google.registry.request.HttpException.NoContentException;
|
||||||
import google.registry.request.HttpException.ServiceUnavailableException;
|
import google.registry.request.HttpException.ServiceUnavailableException;
|
||||||
import google.registry.request.lock.LockHandler;
|
import google.registry.request.lock.LockHandler;
|
||||||
|
@ -74,24 +74,23 @@ class EscrowTaskRunner {
|
||||||
* Acquires lock, checks cursor, invokes {@code task}, and advances cursor.
|
* Acquires lock, checks cursor, invokes {@code task}, and advances cursor.
|
||||||
*
|
*
|
||||||
* @param task the task to run
|
* @param task the task to run
|
||||||
* @param registry the {@link Registry} that we are performing escrow for
|
* @param tld the {@link Tld} that we are performing escrow for
|
||||||
* @param timeout time when we assume failure, kill the task (and instance) and release the lock
|
* @param timeout time when we assume failure, kill the task (and instance) and release the lock
|
||||||
* @param cursorType the cursor to advance on success, indicating the next required runtime
|
* @param cursorType the cursor to advance on success, indicating the next required runtime
|
||||||
* @param interval how far to advance the cursor (e.g. a day for RDE, a week for BRDA)
|
* @param interval how far to advance the cursor (e.g. a day for RDE, a week for BRDA)
|
||||||
*/
|
*/
|
||||||
void lockRunAndRollForward(
|
void lockRunAndRollForward(
|
||||||
final EscrowTask task,
|
final EscrowTask task,
|
||||||
final Registry registry,
|
final Tld tld,
|
||||||
Duration timeout,
|
Duration timeout,
|
||||||
final CursorType cursorType,
|
final CursorType cursorType,
|
||||||
final Duration interval) {
|
final Duration interval) {
|
||||||
Callable<Void> lockRunner =
|
Callable<Void> lockRunner =
|
||||||
() -> {
|
() -> {
|
||||||
logger.atInfo().log("Performing escrow for TLD '%s'.", registry.getTld());
|
logger.atInfo().log("Performing escrow for TLD '%s'.", tld.getTld());
|
||||||
DateTime startOfToday = clock.nowUtc().withTimeAtStartOfDay();
|
DateTime startOfToday = clock.nowUtc().withTimeAtStartOfDay();
|
||||||
DateTime nextRequiredRun =
|
DateTime nextRequiredRun =
|
||||||
tm().transact(
|
tm().transact(() -> tm().loadByKeyIfPresent(Cursor.createScopedVKey(cursorType, tld)))
|
||||||
() -> tm().loadByKeyIfPresent(Cursor.createScopedVKey(cursorType, registry)))
|
|
||||||
.map(Cursor::getCursorTime)
|
.map(Cursor::getCursorTime)
|
||||||
.orElse(startOfToday);
|
.orElse(startOfToday);
|
||||||
if (nextRequiredRun.isAfter(startOfToday)) {
|
if (nextRequiredRun.isAfter(startOfToday)) {
|
||||||
|
@ -101,16 +100,16 @@ class EscrowTaskRunner {
|
||||||
task.runWithLock(nextRequiredRun);
|
task.runWithLock(nextRequiredRun);
|
||||||
DateTime nextRun = nextRequiredRun.plus(interval);
|
DateTime nextRun = nextRequiredRun.plus(interval);
|
||||||
logger.atInfo().log("Rolling cursor forward to %s.", nextRun);
|
logger.atInfo().log("Rolling cursor forward to %s.", nextRun);
|
||||||
tm().transact(() -> tm().put(Cursor.createScoped(cursorType, nextRun, registry)));
|
tm().transact(() -> tm().put(Cursor.createScoped(cursorType, nextRun, tld)));
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
String lockName = String.format("EscrowTaskRunner %s", task.getClass().getSimpleName());
|
String lockName = String.format("EscrowTaskRunner %s", task.getClass().getSimpleName());
|
||||||
if (!lockHandler.executeWithLocks(lockRunner, registry.getTldStr(), timeout, lockName)) {
|
if (!lockHandler.executeWithLocks(lockRunner, tld.getTldStr(), timeout, lockName)) {
|
||||||
// This will happen if either: a) the task is double-executed; b) the task takes a long time
|
// This will happen if either: a) the task is double-executed; b) the task takes a long time
|
||||||
// to run and the retry task got executed while the first one is still running. In both
|
// to run and the retry task got executed while the first one is still running. In both
|
||||||
// situations the safest thing to do is to just return 503 so the task gets retried later.
|
// situations the safest thing to do is to just return 503 so the task gets retried later.
|
||||||
throw new ServiceUnavailableException(
|
throw new ServiceUnavailableException(
|
||||||
String.format("Lock in use: %s for TLD: %s", lockName, registry.getTldStr()));
|
String.format("Lock in use: %s for TLD: %s", lockName, tld.getTldStr()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ import google.registry.model.common.Cursor;
|
||||||
import google.registry.model.common.Cursor.CursorType;
|
import google.registry.model.common.Cursor.CursorType;
|
||||||
import google.registry.model.rde.RdeMode;
|
import google.registry.model.rde.RdeMode;
|
||||||
import google.registry.model.tld.Registries;
|
import google.registry.model.tld.Registries;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.util.Clock;
|
import google.registry.util.Clock;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -83,23 +83,22 @@ public final class PendingDepositChecker {
|
||||||
ImmutableSetMultimap.Builder<String, PendingDeposit> builder =
|
ImmutableSetMultimap.Builder<String, PendingDeposit> builder =
|
||||||
new ImmutableSetMultimap.Builder<>();
|
new ImmutableSetMultimap.Builder<>();
|
||||||
DateTime now = clock.nowUtc();
|
DateTime now = clock.nowUtc();
|
||||||
for (String tld : Registries.getTldsOfType(TldType.REAL)) {
|
for (String tldStr : Registries.getTldsOfType(TldType.REAL)) {
|
||||||
Registry registry = Registry.get(tld);
|
Tld tld = Tld.get(tldStr);
|
||||||
if (!registry.getEscrowEnabled()) {
|
if (!tld.getEscrowEnabled()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Avoid creating a transaction unless absolutely necessary.
|
// Avoid creating a transaction unless absolutely necessary.
|
||||||
Optional<Cursor> maybeCursor =
|
Optional<Cursor> maybeCursor =
|
||||||
tm().transact(
|
tm().transact(() -> tm().loadByKeyIfPresent(Cursor.createScopedVKey(cursorType, tld)));
|
||||||
() -> tm().loadByKeyIfPresent(Cursor.createScopedVKey(cursorType, registry)));
|
|
||||||
DateTime cursorValue = maybeCursor.map(Cursor::getCursorTime).orElse(startingPoint);
|
DateTime cursorValue = maybeCursor.map(Cursor::getCursorTime).orElse(startingPoint);
|
||||||
if (isBeforeOrAt(cursorValue, now)) {
|
if (isBeforeOrAt(cursorValue, now)) {
|
||||||
DateTime watermark =
|
DateTime watermark =
|
||||||
maybeCursor
|
maybeCursor
|
||||||
.map(Cursor::getCursorTime)
|
.map(Cursor::getCursorTime)
|
||||||
.orElse(transactionallyInitializeCursor(registry, cursorType, startingPoint));
|
.orElse(transactionallyInitializeCursor(tld, cursorType, startingPoint));
|
||||||
if (isBeforeOrAt(watermark, now)) {
|
if (isBeforeOrAt(watermark, now)) {
|
||||||
builder.put(tld, PendingDeposit.create(tld, watermark, mode, cursorType, interval));
|
builder.put(tldStr, PendingDeposit.create(tldStr, watermark, mode, cursorType, interval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,15 +106,15 @@ public final class PendingDepositChecker {
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateTime transactionallyInitializeCursor(
|
private DateTime transactionallyInitializeCursor(
|
||||||
final Registry registry, final CursorType cursorType, final DateTime initialValue) {
|
final Tld tld, final CursorType cursorType, final DateTime initialValue) {
|
||||||
return tm().transact(
|
return tm().transact(
|
||||||
() -> {
|
() -> {
|
||||||
Optional<Cursor> maybeCursor =
|
Optional<Cursor> maybeCursor =
|
||||||
tm().loadByKeyIfPresent(Cursor.createScopedVKey(cursorType, registry));
|
tm().loadByKeyIfPresent(Cursor.createScopedVKey(cursorType, tld));
|
||||||
if (maybeCursor.isPresent()) {
|
if (maybeCursor.isPresent()) {
|
||||||
return maybeCursor.get().getCursorTime();
|
return maybeCursor.get().getCursorTime();
|
||||||
}
|
}
|
||||||
tm().put(Cursor.createScoped(cursorType, initialValue, registry));
|
tm().put(Cursor.createScoped(cursorType, initialValue, tld));
|
||||||
return initialValue;
|
return initialValue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import google.registry.model.common.Cursor;
|
||||||
import google.registry.model.common.Cursor.CursorType;
|
import google.registry.model.common.Cursor.CursorType;
|
||||||
import google.registry.model.rde.RdeNamingUtils;
|
import google.registry.model.rde.RdeNamingUtils;
|
||||||
import google.registry.model.rde.RdeRevision;
|
import google.registry.model.rde.RdeRevision;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.rde.EscrowTaskRunner.EscrowTask;
|
import google.registry.rde.EscrowTaskRunner.EscrowTask;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.HttpException.NoContentException;
|
import google.registry.request.HttpException.NoContentException;
|
||||||
|
@ -76,7 +76,7 @@ public final class RdeReportAction implements Runnable, EscrowTask {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
runner.lockRunAndRollForward(this, Registry.get(tld), timeout, CursorType.RDE_REPORT, interval);
|
runner.lockRunAndRollForward(this, Tld.get(tld), timeout, CursorType.RDE_REPORT, interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -85,7 +85,7 @@ public final class RdeReportAction implements Runnable, EscrowTask {
|
||||||
tm().transact(
|
tm().transact(
|
||||||
() ->
|
() ->
|
||||||
tm().loadByKeyIfPresent(
|
tm().loadByKeyIfPresent(
|
||||||
Cursor.createScopedVKey(CursorType.RDE_UPLOAD, Registry.get(tld))));
|
Cursor.createScopedVKey(CursorType.RDE_UPLOAD, Tld.get(tld))));
|
||||||
DateTime cursorTime = getCursorTimeOrStartOfTime(cursor);
|
DateTime cursorTime = getCursorTimeOrStartOfTime(cursor);
|
||||||
if (isBeforeOrAt(cursorTime, watermark)) {
|
if (isBeforeOrAt(cursorTime, watermark)) {
|
||||||
throw new NoContentException(
|
throw new NoContentException(
|
||||||
|
|
|
@ -46,7 +46,7 @@ import google.registry.model.common.Cursor;
|
||||||
import google.registry.model.common.Cursor.CursorType;
|
import google.registry.model.common.Cursor.CursorType;
|
||||||
import google.registry.model.rde.RdeNamingUtils;
|
import google.registry.model.rde.RdeNamingUtils;
|
||||||
import google.registry.model.rde.RdeRevision;
|
import google.registry.model.rde.RdeRevision;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.rde.EscrowTaskRunner.EscrowTask;
|
import google.registry.rde.EscrowTaskRunner.EscrowTask;
|
||||||
import google.registry.rde.JSchSshSession.JSchSshSessionFactory;
|
import google.registry.rde.JSchSshSession.JSchSshSessionFactory;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
|
@ -125,7 +125,7 @@ public final class RdeUploadAction implements Runnable, EscrowTask {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
logger.atInfo().log("Attempting to acquire RDE upload lock for TLD '%s'.", tld);
|
logger.atInfo().log("Attempting to acquire RDE upload lock for TLD '%s'.", tld);
|
||||||
runner.lockRunAndRollForward(this, Registry.get(tld), timeout, CursorType.RDE_UPLOAD, interval);
|
runner.lockRunAndRollForward(this, Tld.get(tld), timeout, CursorType.RDE_UPLOAD, interval);
|
||||||
HashMultimap<String, String> params = HashMultimap.create();
|
HashMultimap<String, String> params = HashMultimap.create();
|
||||||
params.put(RequestParameters.PARAM_TLD, tld);
|
params.put(RequestParameters.PARAM_TLD, tld);
|
||||||
prefix.ifPresent(s -> params.put(RdeModule.PARAM_PREFIX, s));
|
prefix.ifPresent(s -> params.put(RdeModule.PARAM_PREFIX, s));
|
||||||
|
@ -160,9 +160,7 @@ public final class RdeUploadAction implements Runnable, EscrowTask {
|
||||||
logger.atInfo().log("Verifying readiness to upload the RDE deposit.");
|
logger.atInfo().log("Verifying readiness to upload the RDE deposit.");
|
||||||
Optional<Cursor> cursor =
|
Optional<Cursor> cursor =
|
||||||
tm().transact(
|
tm().transact(
|
||||||
() ->
|
() -> tm().loadByKeyIfPresent(Cursor.createScopedVKey(RDE_STAGING, Tld.get(tld))));
|
||||||
tm().loadByKeyIfPresent(
|
|
||||||
Cursor.createScopedVKey(RDE_STAGING, Registry.get(tld))));
|
|
||||||
DateTime stagingCursorTime = getCursorTimeOrStartOfTime(cursor);
|
DateTime stagingCursorTime = getCursorTimeOrStartOfTime(cursor);
|
||||||
if (isBeforeOrAt(stagingCursorTime, watermark)) {
|
if (isBeforeOrAt(stagingCursorTime, watermark)) {
|
||||||
throw new NoContentException(
|
throw new NoContentException(
|
||||||
|
@ -174,8 +172,7 @@ public final class RdeUploadAction implements Runnable, EscrowTask {
|
||||||
DateTime sftpCursorTime =
|
DateTime sftpCursorTime =
|
||||||
tm().transact(
|
tm().transact(
|
||||||
() ->
|
() ->
|
||||||
tm().loadByKeyIfPresent(
|
tm().loadByKeyIfPresent(Cursor.createScopedVKey(RDE_UPLOAD_SFTP, Tld.get(tld))))
|
||||||
Cursor.createScopedVKey(RDE_UPLOAD_SFTP, Registry.get(tld))))
|
|
||||||
.map(Cursor::getCursorTime)
|
.map(Cursor::getCursorTime)
|
||||||
.orElse(START_OF_TIME);
|
.orElse(START_OF_TIME);
|
||||||
Duration timeSinceLastSftp = new Duration(sftpCursorTime, clock.nowUtc());
|
Duration timeSinceLastSftp = new Duration(sftpCursorTime, clock.nowUtc());
|
||||||
|
@ -214,7 +211,7 @@ public final class RdeUploadAction implements Runnable, EscrowTask {
|
||||||
() ->
|
() ->
|
||||||
tm().put(
|
tm().put(
|
||||||
Cursor.createScoped(
|
Cursor.createScoped(
|
||||||
RDE_UPLOAD_SFTP, tm().getTransactionTime(), Registry.get(tld))));
|
RDE_UPLOAD_SFTP, tm().getTransactionTime(), Tld.get(tld))));
|
||||||
response.setContentType(PLAIN_TEXT_UTF_8);
|
response.setContentType(PLAIN_TEXT_UTF_8);
|
||||||
response.setPayload(String.format("OK %s %s\n", tld, watermark));
|
response.setPayload(String.format("OK %s %s\n", tld, watermark));
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,8 @@ import google.registry.gcs.GcsUtils;
|
||||||
import google.registry.model.common.Cursor;
|
import google.registry.model.common.Cursor;
|
||||||
import google.registry.model.common.Cursor.CursorType;
|
import google.registry.model.common.Cursor.CursorType;
|
||||||
import google.registry.model.tld.Registries;
|
import google.registry.model.tld.Registries;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.HttpException.ServiceUnavailableException;
|
import google.registry.request.HttpException.ServiceUnavailableException;
|
||||||
|
@ -169,7 +169,7 @@ public final class IcannReportingUploadAction implements Runnable {
|
||||||
Cursor.createScoped(
|
Cursor.createScoped(
|
||||||
cursorType,
|
cursorType,
|
||||||
cursorTime.withTimeAtStartOfDay().withDayOfMonth(1).plusMonths(1),
|
cursorTime.withTimeAtStartOfDay().withDayOfMonth(1).plusMonths(1),
|
||||||
Registry.get(tldStr));
|
Tld.get(tldStr));
|
||||||
// In order to keep the transactions short-lived, we load all of the cursors in a single
|
// In order to keep the transactions short-lived, we load all of the cursors in a single
|
||||||
// transaction then later use per-cursor transactions when checking + saving the cursors. We
|
// transaction then later use per-cursor transactions when checking + saving the cursors. We
|
||||||
// run behind a lock so the cursors shouldn't be changed, but double check to be sure.
|
// run behind a lock so the cursors shouldn't be changed, but double check to be sure.
|
||||||
|
@ -203,11 +203,11 @@ public final class IcannReportingUploadAction implements Runnable {
|
||||||
/** Returns a map of each cursor to the tld. */
|
/** Returns a map of each cursor to the tld. */
|
||||||
private ImmutableMap<Cursor, String> loadCursors() {
|
private ImmutableMap<Cursor, String> loadCursors() {
|
||||||
|
|
||||||
ImmutableSet<Registry> registries = Registries.getTldEntitiesOfType(TldType.REAL);
|
ImmutableSet<Tld> registries = Registries.getTldEntitiesOfType(TldType.REAL);
|
||||||
|
|
||||||
ImmutableMap<VKey<? extends Cursor>, Registry> activityKeyMap =
|
ImmutableMap<VKey<? extends Cursor>, Tld> activityKeyMap =
|
||||||
loadKeyMap(registries, CursorType.ICANN_UPLOAD_ACTIVITY);
|
loadKeyMap(registries, CursorType.ICANN_UPLOAD_ACTIVITY);
|
||||||
ImmutableMap<VKey<? extends Cursor>, Registry> transactionKeyMap =
|
ImmutableMap<VKey<? extends Cursor>, Tld> transactionKeyMap =
|
||||||
loadKeyMap(registries, CursorType.ICANN_UPLOAD_TX);
|
loadKeyMap(registries, CursorType.ICANN_UPLOAD_TX);
|
||||||
|
|
||||||
ImmutableSet.Builder<VKey<? extends Cursor>> keys = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<VKey<? extends Cursor>> keys = new ImmutableSet.Builder<>();
|
||||||
|
@ -225,8 +225,8 @@ public final class IcannReportingUploadAction implements Runnable {
|
||||||
return cursors.build();
|
return cursors.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImmutableMap<VKey<? extends Cursor>, Registry> loadKeyMap(
|
private ImmutableMap<VKey<? extends Cursor>, Tld> loadKeyMap(
|
||||||
ImmutableSet<Registry> registries, CursorType type) {
|
ImmutableSet<Tld> registries, CursorType type) {
|
||||||
return Maps.uniqueIndex(registries, r -> Cursor.createScopedVKey(type, r));
|
return Maps.uniqueIndex(registries, r -> Cursor.createScopedVKey(type, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ public final class IcannReportingUploadAction implements Runnable {
|
||||||
* next month.
|
* next month.
|
||||||
*/
|
*/
|
||||||
private ImmutableMap<Cursor, String> defaultNullCursorsToNextMonthAndAddToMap(
|
private ImmutableMap<Cursor, String> defaultNullCursorsToNextMonthAndAddToMap(
|
||||||
Map<VKey<? extends Cursor>, Registry> keyMap,
|
Map<VKey<? extends Cursor>, Tld> keyMap,
|
||||||
CursorType type,
|
CursorType type,
|
||||||
Map<VKey<? extends Cursor>, Cursor> cursorMap) {
|
Map<VKey<? extends Cursor>, Cursor> cursorMap) {
|
||||||
ImmutableMap.Builder<Cursor, String> cursors = new ImmutableMap.Builder<>();
|
ImmutableMap.Builder<Cursor, String> cursors = new ImmutableMap.Builder<>();
|
||||||
|
|
|
@ -18,7 +18,7 @@ import static google.registry.tldconfig.idn.IdnTableEnum.EXTENDED_LATIN;
|
||||||
import static google.registry.tldconfig.idn.IdnTableEnum.JA;
|
import static google.registry.tldconfig.idn.IdnTableEnum.JA;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.util.Idn;
|
import google.registry.util.Idn;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public final class IdnLabelValidator {
|
||||||
*/
|
*/
|
||||||
public Optional<String> findValidIdnTableForTld(String label, String tldStr) {
|
public Optional<String> findValidIdnTableForTld(String label, String tldStr) {
|
||||||
String unicodeString = Idn.toUnicode(label);
|
String unicodeString = Idn.toUnicode(label);
|
||||||
Registry tld = Registry.get(tldStr); // uses the cache
|
Tld tld = Tld.get(tldStr); // uses the cache
|
||||||
ImmutableSet<IdnTableEnum> idnTablesForTld = tld.getIdnTables();
|
ImmutableSet<IdnTableEnum> idnTablesForTld = tld.getIdnTables();
|
||||||
ImmutableSet<IdnTableEnum> idnTables =
|
ImmutableSet<IdnTableEnum> idnTables =
|
||||||
idnTablesForTld.isEmpty() ? DEFAULT_IDN_TABLES : idnTablesForTld;
|
idnTablesForTld.isEmpty() ? DEFAULT_IDN_TABLES : idnTablesForTld;
|
||||||
|
|
|
@ -18,7 +18,7 @@ import static com.google.common.base.Verify.verifyNotNull;
|
||||||
|
|
||||||
import com.google.common.flogger.FluentLogger;
|
import com.google.common.flogger.FluentLogger;
|
||||||
import google.registry.keyring.api.KeyModule.Key;
|
import google.registry.keyring.api.KeyModule.Key;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.request.UrlConnectionUtils;
|
import google.registry.request.UrlConnectionUtils;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -45,8 +45,11 @@ final class LordnRequestInitializer {
|
||||||
/** Returns the username and password for the current TLD to login to the MarksDB server. */
|
/** Returns the username and password for the current TLD to login to the MarksDB server. */
|
||||||
private Optional<String> getMarksDbLordnCredentials(String tld) {
|
private Optional<String> getMarksDbLordnCredentials(String tld) {
|
||||||
if (marksdbLordnPassword.isPresent()) {
|
if (marksdbLordnPassword.isPresent()) {
|
||||||
String lordnUsername = verifyNotNull(Registry.get(tld).getLordnUsername(),
|
String lordnUsername =
|
||||||
"lordnUsername is not set for %s.", Registry.get(tld).getTld());
|
verifyNotNull(
|
||||||
|
Tld.get(tld).getLordnUsername(),
|
||||||
|
"lordnUsername is not set for %s.",
|
||||||
|
Tld.get(tld).getTld());
|
||||||
return Optional.of(String.format("%s:%s", lordnUsername, marksdbLordnPassword.get()));
|
return Optional.of(String.format("%s:%s", lordnUsername, marksdbLordnPassword.get()));
|
||||||
} else {
|
} else {
|
||||||
logger.atWarning().log(
|
logger.atWarning().log(
|
||||||
|
|
|
@ -30,9 +30,9 @@ import com.google.common.collect.ImmutableSortedSet;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import google.registry.model.pricing.StaticPremiumListPricingEngine;
|
import google.registry.model.pricing.StaticPremiumListPricingEngine;
|
||||||
import google.registry.model.tld.Registries;
|
import google.registry.model.tld.Registries;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.model.tld.label.PremiumList;
|
import google.registry.model.tld.label.PremiumList;
|
||||||
import google.registry.model.tld.label.PremiumListDao;
|
import google.registry.model.tld.label.PremiumListDao;
|
||||||
import google.registry.tldconfig.idn.IdnTableEnum;
|
import google.registry.tldconfig.idn.IdnTableEnum;
|
||||||
|
@ -274,20 +274,20 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
||||||
+ " IdnTableEnum values")
|
+ " IdnTableEnum values")
|
||||||
List<String> idnTables;
|
List<String> idnTables;
|
||||||
|
|
||||||
/** Returns the existing registry (for update) or null (for creates). */
|
/** Returns the existing tld (for update) or null (for creates). */
|
||||||
@Nullable
|
@Nullable
|
||||||
abstract Registry getOldRegistry(String tld);
|
abstract Tld getOldTld(String tld);
|
||||||
|
|
||||||
abstract ImmutableSet<String> getAllowedRegistrants(Registry oldRegistry);
|
abstract ImmutableSet<String> getAllowedRegistrants(Tld oldTld);
|
||||||
|
|
||||||
abstract ImmutableSet<String> getAllowedNameservers(Registry oldRegistry);
|
abstract ImmutableSet<String> getAllowedNameservers(Tld oldTld);
|
||||||
|
|
||||||
abstract ImmutableSet<String> getReservedLists(Registry oldRegistry);
|
abstract ImmutableSet<String> getReservedLists(Tld oldTld);
|
||||||
|
|
||||||
abstract Optional<Map.Entry<DateTime, TldState>> getTldStateTransitionToAdd();
|
abstract Optional<Map.Entry<DateTime, TldState>> getTldStateTransitionToAdd();
|
||||||
|
|
||||||
/** Subclasses can override this to set their own properties. */
|
/** Subclasses can override this to set their own properties. */
|
||||||
void setCommandSpecificProperties(@SuppressWarnings("unused") Registry.Builder builder) {}
|
void setCommandSpecificProperties(@SuppressWarnings("unused") Tld.Builder builder) {}
|
||||||
|
|
||||||
/** Subclasses can override this to assert that the command can be run in this environment. */
|
/** Subclasses can override this to assert that the command can be run in this environment. */
|
||||||
void assertAllowedEnvironment() {}
|
void assertAllowedEnvironment() {}
|
||||||
|
@ -312,14 +312,14 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
||||||
checkArgument(
|
checkArgument(
|
||||||
!Character.isDigit(tld.charAt(0)),
|
!Character.isDigit(tld.charAt(0)),
|
||||||
"TLDs cannot begin with a number");
|
"TLDs cannot begin with a number");
|
||||||
Registry oldRegistry = getOldRegistry(tld);
|
Tld oldTld = getOldTld(tld);
|
||||||
// TODO(b/26901539): Add a flag to set the pricing engine once we have more than one option.
|
// TODO(b/26901539): Add a flag to set the pricing engine once we have more than one option.
|
||||||
Registry.Builder builder =
|
Tld.Builder builder =
|
||||||
oldRegistry == null
|
oldTld == null
|
||||||
? new Registry.Builder()
|
? new Tld.Builder()
|
||||||
.setTldStr(tld)
|
.setTldStr(tld)
|
||||||
.setPremiumPricingEngine(StaticPremiumListPricingEngine.NAME)
|
.setPremiumPricingEngine(StaticPremiumListPricingEngine.NAME)
|
||||||
: oldRegistry.asBuilder();
|
: oldTld.asBuilder();
|
||||||
|
|
||||||
if (escrow != null) {
|
if (escrow != null) {
|
||||||
builder.setEscrowEnabled(escrow);
|
builder.setEscrowEnabled(escrow);
|
||||||
|
@ -336,14 +336,16 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
||||||
} else if (tldStateTransitionToAdd.isPresent()) {
|
} else if (tldStateTransitionToAdd.isPresent()) {
|
||||||
ImmutableSortedMap.Builder<DateTime, TldState> newTldStateTransitions =
|
ImmutableSortedMap.Builder<DateTime, TldState> newTldStateTransitions =
|
||||||
ImmutableSortedMap.naturalOrder();
|
ImmutableSortedMap.naturalOrder();
|
||||||
if (oldRegistry != null) {
|
if (oldTld != null) {
|
||||||
checkArgument(
|
checkArgument(
|
||||||
oldRegistry.getTldStateTransitions().lastKey().isBefore(
|
oldTld
|
||||||
tldStateTransitionToAdd.get().getKey()),
|
.getTldStateTransitions()
|
||||||
|
.lastKey()
|
||||||
|
.isBefore(tldStateTransitionToAdd.get().getKey()),
|
||||||
"Cannot add %s at %s when there is a later transition already scheduled",
|
"Cannot add %s at %s when there is a later transition already scheduled",
|
||||||
tldStateTransitionToAdd.get().getValue(),
|
tldStateTransitionToAdd.get().getValue(),
|
||||||
tldStateTransitionToAdd.get().getKey());
|
tldStateTransitionToAdd.get().getKey());
|
||||||
newTldStateTransitions.putAll(oldRegistry.getTldStateTransitions());
|
newTldStateTransitions.putAll(oldTld.getTldStateTransitions());
|
||||||
}
|
}
|
||||||
builder.setTldStateTransitions(
|
builder.setTldStateTransitions(
|
||||||
newTldStateTransitions.put(getTldStateTransitionToAdd().get()).build());
|
newTldStateTransitions.put(getTldStateTransitionToAdd().get()).build());
|
||||||
|
@ -410,13 +412,13 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
||||||
builder.setDnsWriters(dnsWritersSet);
|
builder.setDnsWriters(dnsWritersSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet<String> newReservedListNames = getReservedLists(oldRegistry);
|
ImmutableSet<String> newReservedListNames = getReservedLists(oldTld);
|
||||||
checkReservedListValidityForTld(tld, newReservedListNames);
|
checkReservedListValidityForTld(tld, newReservedListNames);
|
||||||
builder.setReservedListsByName(newReservedListNames);
|
builder.setReservedListsByName(newReservedListNames);
|
||||||
|
|
||||||
builder.setAllowedRegistrantContactIds(getAllowedRegistrants(oldRegistry));
|
builder.setAllowedRegistrantContactIds(getAllowedRegistrants(oldTld));
|
||||||
|
|
||||||
builder.setAllowedFullyQualifiedHostNames(getAllowedNameservers(oldRegistry));
|
builder.setAllowedFullyQualifiedHostNames(getAllowedNameservers(oldTld));
|
||||||
|
|
||||||
if (!isNullOrEmpty(defaultTokens)) {
|
if (!isNullOrEmpty(defaultTokens)) {
|
||||||
if (defaultTokens.equals(ImmutableList.of(""))) {
|
if (defaultTokens.equals(ImmutableList.of(""))) {
|
||||||
|
@ -444,7 +446,7 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
||||||
}
|
}
|
||||||
// Update the Registry object.
|
// Update the Registry object.
|
||||||
setCommandSpecificProperties(builder);
|
setCommandSpecificProperties(builder);
|
||||||
stageEntityChange(oldRegistry, builder.build());
|
stageEntityChange(oldTld, builder.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.ImmutableSortedMap;
|
import com.google.common.collect.ImmutableSortedMap;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -68,40 +68,39 @@ class CreateTldCommand extends CreateOrUpdateTldCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void setCommandSpecificProperties(Registry.Builder builder) {
|
void setCommandSpecificProperties(Tld.Builder builder) {
|
||||||
// Pick up the currency from the create cost. Since all costs must be in one currency, and that
|
// Pick up the currency from the create cost. Since all costs must be in one currency, and that
|
||||||
// condition is enforced by the builder, it doesn't matter which cost we choose it from.
|
// condition is enforced by the builder, it doesn't matter which cost we choose it from.
|
||||||
CurrencyUnit currency = createBillingCost != null
|
CurrencyUnit currency =
|
||||||
? createBillingCost.getCurrencyUnit()
|
createBillingCost != null ? createBillingCost.getCurrencyUnit() : Tld.DEFAULT_CURRENCY;
|
||||||
: Registry.DEFAULT_CURRENCY;
|
|
||||||
|
|
||||||
builder.setCurrency(currency);
|
builder.setCurrency(currency);
|
||||||
|
|
||||||
// If this is a non-default currency and the user hasn't specified an EAP fee schedule, set the
|
// If this is a non-default currency and the user hasn't specified an EAP fee schedule, set the
|
||||||
// EAP fee schedule to a matching currency.
|
// EAP fee schedule to a matching currency.
|
||||||
if (!currency.equals(Registry.DEFAULT_CURRENCY) && eapFeeSchedule.isEmpty()) {
|
if (!currency.equals(Tld.DEFAULT_CURRENCY) && eapFeeSchedule.isEmpty()) {
|
||||||
builder.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(currency)));
|
builder.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(currency)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Registry getOldRegistry(String tld) {
|
Tld getOldTld(String tld) {
|
||||||
checkState(!getTlds().contains(tld), "TLD '%s' already exists", tld);
|
checkState(!getTlds().contains(tld), "TLD '%s' already exists", tld);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
ImmutableSet<String> getAllowedRegistrants(Registry oldRegistry) {
|
ImmutableSet<String> getAllowedRegistrants(Tld oldTld) {
|
||||||
return ImmutableSet.copyOf(nullToEmpty(allowedRegistrants));
|
return ImmutableSet.copyOf(nullToEmpty(allowedRegistrants));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
ImmutableSet<String> getAllowedNameservers(Registry oldRegistry) {
|
ImmutableSet<String> getAllowedNameservers(Tld oldTld) {
|
||||||
return ImmutableSet.copyOf(nullToEmpty(allowedNameservers));
|
return ImmutableSet.copyOf(nullToEmpty(allowedNameservers));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
ImmutableSet<String> getReservedLists(Registry oldRegistry) {
|
ImmutableSet<String> getReservedLists(Tld oldTld) {
|
||||||
return ImmutableSet.copyOf(nullToEmpty(reservedListNames));
|
return ImmutableSet.copyOf(nullToEmpty(reservedListNames));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,25 +21,25 @@ import com.beust.jcommander.Parameter;
|
||||||
import com.beust.jcommander.Parameters;
|
import com.beust.jcommander.Parameters;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.persistence.transaction.QueryComposer.Comparator;
|
import google.registry.persistence.transaction.QueryComposer.Comparator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command to delete the {@link Registry} associated with the specified TLD in the database.
|
* Command to delete the {@link Tld} associated with the specified TLD in the database.
|
||||||
*
|
*
|
||||||
* <p>This command will fail if any domains are currently registered on the TLD.
|
* <p>This command will fail if any domains are currently registered on the TLD.
|
||||||
*/
|
*/
|
||||||
@Parameters(separators = " =", commandDescription = "Delete a TLD from the database.")
|
@Parameters(separators = " =", commandDescription = "Delete a TLD from the database.")
|
||||||
final class DeleteTldCommand extends ConfirmingCommand {
|
final class DeleteTldCommand extends ConfirmingCommand {
|
||||||
|
|
||||||
private Registry registry;
|
private Tld tld;
|
||||||
|
|
||||||
@Parameter(
|
@Parameter(
|
||||||
names = {"-t", "--tld"},
|
names = {"-t", "--tld"},
|
||||||
description = "The TLD to delete.",
|
description = "The TLD to delete.",
|
||||||
required = true)
|
required = true)
|
||||||
private String tld;
|
private String tldStr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform the command by deleting the TLD.
|
* Perform the command by deleting the TLD.
|
||||||
|
@ -52,28 +52,28 @@ final class DeleteTldCommand extends ConfirmingCommand {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
registry = Registry.get(tld);
|
tld = Tld.get(tldStr);
|
||||||
checkState(registry.getTldType().equals(TldType.TEST), "Cannot delete a real TLD");
|
checkState(tld.getTldType().equals(TldType.TEST), "Cannot delete a real TLD");
|
||||||
|
|
||||||
for (Registrar registrar : Registrar.loadAll()) {
|
for (Registrar registrar : Registrar.loadAll()) {
|
||||||
checkState(
|
checkState(
|
||||||
!registrar.getAllowedTlds().contains(tld),
|
!registrar.getAllowedTlds().contains(tldStr),
|
||||||
"Cannot delete TLD because registrar %s lists it as an allowed TLD",
|
"Cannot delete TLD because registrar %s lists it as an allowed TLD",
|
||||||
registrar.getRegistrarId());
|
registrar.getRegistrarId());
|
||||||
}
|
}
|
||||||
checkState(!tldContainsDomains(tld), "Cannot delete TLD because a domain is defined on it");
|
checkState(!tldContainsDomains(tldStr), "Cannot delete TLD because a domain is defined on it");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String prompt() {
|
protected String prompt() {
|
||||||
return "You are about to delete TLD: " + tld;
|
return "You are about to delete TLD: " + tldStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String execute() {
|
protected String execute() {
|
||||||
tm().transact(() -> tm().delete(registry));
|
tm().transact(() -> tm().delete(tld));
|
||||||
registry.invalidateInCache();
|
tld.invalidateInCache();
|
||||||
return String.format("Deleted TLD '%s'.\n", tld);
|
return String.format("Deleted TLD '%s'.\n", tldStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean tldContainsDomains(String tld) {
|
private boolean tldContainsDomains(String tld) {
|
||||||
|
|
|
@ -32,8 +32,8 @@ import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.domain.RegistryLock;
|
import google.registry.model.domain.RegistryLock;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
|
||||||
import google.registry.model.tld.RegistryLockDao;
|
import google.registry.model.tld.RegistryLockDao;
|
||||||
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.request.Action.Service;
|
import google.registry.request.Action.Service;
|
||||||
import google.registry.util.StringGenerator;
|
import google.registry.util.StringGenerator;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -402,7 +402,7 @@ public final class DomainLockUtils {
|
||||||
.setReason(Reason.SERVER_STATUS)
|
.setReason(Reason.SERVER_STATUS)
|
||||||
.setTargetId(domain.getForeignKey())
|
.setTargetId(domain.getForeignKey())
|
||||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||||
.setCost(Registry.get(domain.getTld()).getRegistryLockOrUnlockBillingCost())
|
.setCost(Tld.get(domain.getTld()).getRegistryLockOrUnlockBillingCost())
|
||||||
.setEventTime(now)
|
.setEventTime(now)
|
||||||
.setBillingTime(now)
|
.setBillingTime(now)
|
||||||
.setDomainHistory(domainHistory)
|
.setDomainHistory(domainHistory)
|
||||||
|
|
|
@ -18,7 +18,7 @@ import static google.registry.model.tld.Registries.assertTldsExist;
|
||||||
|
|
||||||
import com.beust.jcommander.Parameter;
|
import com.beust.jcommander.Parameter;
|
||||||
import com.beust.jcommander.Parameters;
|
import com.beust.jcommander.Parameters;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/** Command to show a TLD record. */
|
/** Command to show a TLD record. */
|
||||||
|
@ -33,7 +33,7 @@ final class GetTldCommand implements Command {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (String tld : assertTldsExist(mainParameters)) {
|
for (String tld : assertTldsExist(mainParameters)) {
|
||||||
System.out.println(Registry.get(tld));
|
System.out.println(Tld.get(tld));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ import com.google.common.collect.ImmutableMap;
|
||||||
import google.registry.model.common.Cursor;
|
import google.registry.model.common.Cursor;
|
||||||
import google.registry.model.common.Cursor.CursorType;
|
import google.registry.model.common.Cursor.CursorType;
|
||||||
import google.registry.model.tld.Registries;
|
import google.registry.model.tld.Registries;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -54,7 +54,7 @@ final class ListCursorsCommand implements Command {
|
||||||
Map<String, VKey<Cursor>> cursorKeys =
|
Map<String, VKey<Cursor>> cursorKeys =
|
||||||
cursorType.isScoped()
|
cursorType.isScoped()
|
||||||
? Registries.getTlds().stream()
|
? Registries.getTlds().stream()
|
||||||
.map(Registry::get)
|
.map(Tld::get)
|
||||||
.filter(r -> r.getTldType() == filterTldType)
|
.filter(r -> r.getTldType() == filterTldType)
|
||||||
.filter(r -> !filterEscrowEnabled || r.getEscrowEnabled())
|
.filter(r -> !filterEscrowEnabled || r.getEscrowEnabled())
|
||||||
.collect(
|
.collect(
|
||||||
|
|
|
@ -22,7 +22,7 @@ import com.beust.jcommander.Parameter;
|
||||||
import com.beust.jcommander.Parameters;
|
import com.beust.jcommander.Parameters;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.tools.server.ListDomainsAction;
|
import google.registry.tools.server.ListDomainsAction;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import com.beust.jcommander.Parameters;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import google.registry.model.common.Cursor;
|
import google.registry.model.common.Cursor;
|
||||||
import google.registry.model.common.Cursor.CursorType;
|
import google.registry.model.common.Cursor.CursorType;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.tools.params.DateTimeParameter;
|
import google.registry.tools.params.DateTimeParameter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
@ -52,9 +52,9 @@ final class UpdateCursorsCommand extends ConfirmingCommand implements Command {
|
||||||
if (isNullOrEmpty(tlds)) {
|
if (isNullOrEmpty(tlds)) {
|
||||||
result.add(Cursor.createGlobal(cursorType, newTimestamp));
|
result.add(Cursor.createGlobal(cursorType, newTimestamp));
|
||||||
} else {
|
} else {
|
||||||
for (String tld : tlds) {
|
for (String tldStr : tlds) {
|
||||||
Registry registry = Registry.get(tld);
|
Tld tld = Tld.get(tldStr);
|
||||||
result.add(Cursor.createScoped(cursorType, newTimestamp, registry));
|
result.add(Cursor.createScoped(cursorType, newTimestamp, tld));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cursorsToUpdate = result.build();
|
cursorsToUpdate = result.build();
|
||||||
|
|
|
@ -26,8 +26,8 @@ import com.beust.jcommander.Parameters;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import google.registry.config.RegistryEnvironment;
|
import google.registry.config.RegistryEnvironment;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -83,35 +83,35 @@ public class UpdateTldCommand extends CreateOrUpdateTldCommand {
|
||||||
TldState setCurrentTldState;
|
TldState setCurrentTldState;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Registry getOldRegistry(String tld) {
|
Tld getOldTld(String tld) {
|
||||||
return Registry.get(assertTldExists(tld));
|
return Tld.get(assertTldExists(tld));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
ImmutableSet<String> getAllowedRegistrants(Registry oldRegistry) {
|
ImmutableSet<String> getAllowedRegistrants(Tld oldTld) {
|
||||||
return formUpdatedList(
|
return formUpdatedList(
|
||||||
"allowed registrants",
|
"allowed registrants",
|
||||||
oldRegistry.getAllowedRegistrantContactIds(),
|
oldTld.getAllowedRegistrantContactIds(),
|
||||||
allowedRegistrants,
|
allowedRegistrants,
|
||||||
allowedRegistrantsAdd,
|
allowedRegistrantsAdd,
|
||||||
allowedRegistrantsRemove);
|
allowedRegistrantsRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
ImmutableSet<String> getAllowedNameservers(Registry oldRegistry) {
|
ImmutableSet<String> getAllowedNameservers(Tld oldTld) {
|
||||||
return formUpdatedList(
|
return formUpdatedList(
|
||||||
"allowed nameservers",
|
"allowed nameservers",
|
||||||
oldRegistry.getAllowedFullyQualifiedHostNames(),
|
oldTld.getAllowedFullyQualifiedHostNames(),
|
||||||
allowedNameservers,
|
allowedNameservers,
|
||||||
allowedNameserversAdd,
|
allowedNameserversAdd,
|
||||||
allowedNameserversRemove);
|
allowedNameserversRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
ImmutableSet<String> getReservedLists(Registry oldRegistry) {
|
ImmutableSet<String> getReservedLists(Tld oldTld) {
|
||||||
return formUpdatedList(
|
return formUpdatedList(
|
||||||
"reserved lists",
|
"reserved lists",
|
||||||
oldRegistry.getReservedListNames(),
|
oldTld.getReservedListNames(),
|
||||||
reservedListNames,
|
reservedListNames,
|
||||||
reservedListsAdd,
|
reservedListsAdd,
|
||||||
reservedListsRemove);
|
reservedListsRemove);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
package google.registry.tools.params;
|
package google.registry.tools.params;
|
||||||
|
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link TldState} CLI parameter converter/validator. Required to support multi-value
|
* {@link TldState} CLI parameter converter/validator. Required to support multi-value
|
||||||
|
|
|
@ -21,7 +21,7 @@ import com.google.common.collect.ImmutableSortedMap;
|
||||||
import com.google.common.collect.Ordering;
|
import com.google.common.collect.Ordering;
|
||||||
import google.registry.model.common.DatabaseMigrationStateSchedule.MigrationState;
|
import google.registry.model.common.DatabaseMigrationStateSchedule.MigrationState;
|
||||||
import google.registry.model.domain.token.AllocationToken.TokenStatus;
|
import google.registry.model.domain.token.AllocationToken.TokenStatus;
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import static google.registry.request.Action.Method.POST;
|
||||||
import com.google.common.collect.ImmutableBiMap;
|
import com.google.common.collect.ImmutableBiMap;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.auth.Auth;
|
import google.registry.request.auth.Auth;
|
||||||
import google.registry.util.Clock;
|
import google.registry.util.Clock;
|
||||||
|
@ -35,7 +35,7 @@ import org.joda.time.DateTime;
|
||||||
path = ListTldsAction.PATH,
|
path = ListTldsAction.PATH,
|
||||||
method = {GET, POST},
|
method = {GET, POST},
|
||||||
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
|
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
|
||||||
public final class ListTldsAction extends ListObjectsAction<Registry> {
|
public final class ListTldsAction extends ListObjectsAction<Tld> {
|
||||||
|
|
||||||
public static final String PATH = "/_dr/admin/list/tlds";
|
public static final String PATH = "/_dr/admin/list/tlds";
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ public final class ListTldsAction extends ListObjectsAction<Registry> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImmutableSet<Registry> loadObjects() {
|
public ImmutableSet<Tld> loadObjects() {
|
||||||
return getTlds().stream().map(Registry::get).collect(toImmutableSet());
|
return getTlds().stream().map(Tld::get).collect(toImmutableSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,15 +61,15 @@ public final class ListTldsAction extends ListObjectsAction<Registry> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImmutableMap<String, String> getFieldOverrides(Registry registry) {
|
public ImmutableMap<String, String> getFieldOverrides(Tld tld) {
|
||||||
final DateTime now = clock.nowUtc();
|
final DateTime now = clock.nowUtc();
|
||||||
return new ImmutableMap.Builder<String, String>()
|
return new ImmutableMap.Builder<String, String>()
|
||||||
.put("dnsPaused", registry.getDnsPaused() ? "paused" : "-")
|
.put("dnsPaused", tld.getDnsPaused() ? "paused" : "-")
|
||||||
.put("escrowEnabled", registry.getEscrowEnabled() ? "enabled" : "-")
|
.put("escrowEnabled", tld.getEscrowEnabled() ? "enabled" : "-")
|
||||||
.put("tldState", registry.isPdt(now) ? "PDT" : registry.getTldState(now).toString())
|
.put("tldState", tld.isPdt(now) ? "PDT" : tld.getTldState(now).toString())
|
||||||
.put("tldStateTransitions", registry.getTldStateTransitions().toString())
|
.put("tldStateTransitions", tld.getTldStateTransitions().toString())
|
||||||
.put("renewBillingCost", registry.getStandardRenewCost(now).toString())
|
.put("renewBillingCost", tld.getStandardRenewCost(now).toString())
|
||||||
.put("renewBillingCostTransitions", registry.getRenewBillingCostTransitions().toString())
|
.put("renewBillingCostTransitions", tld.getRenewBillingCostTransitions().toString())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
<class>google.registry.model.tld.label.PremiumList$PremiumEntry</class>
|
<class>google.registry.model.tld.label.PremiumList$PremiumEntry</class>
|
||||||
<class>google.registry.model.tld.label.ReservedList</class>
|
<class>google.registry.model.tld.label.ReservedList</class>
|
||||||
<class>google.registry.model.tld.label.ReservedList$ReservedListEntry</class>
|
<class>google.registry.model.tld.label.ReservedList$ReservedListEntry</class>
|
||||||
<class>google.registry.model.tld.Registry</class>
|
<class>google.registry.model.tld.Tld</class>
|
||||||
<class>google.registry.model.reporting.DomainTransactionRecord</class>
|
<class>google.registry.model.reporting.DomainTransactionRecord</class>
|
||||||
<class>google.registry.model.reporting.Spec11ThreatMatch</class>
|
<class>google.registry.model.reporting.Spec11ThreatMatch</class>
|
||||||
<class>google.registry.model.server.Lock</class>
|
<class>google.registry.model.server.Lock</class>
|
||||||
|
|
|
@ -42,8 +42,8 @@ import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
|
@ -82,7 +82,7 @@ class DeleteProberDataActionTest {
|
||||||
// Since "example" doesn't end with .test, its entities won't be deleted even though it is of
|
// Since "example" doesn't end with .test, its entities won't be deleted even though it is of
|
||||||
// TEST type.
|
// TEST type.
|
||||||
createTld("example", "EXAMPLE");
|
createTld("example", "EXAMPLE");
|
||||||
persistResource(Registry.get("example").asBuilder().setTldType(TldType.TEST).build());
|
persistResource(Tld.get("example").asBuilder().setTldType(TldType.TEST).build());
|
||||||
|
|
||||||
// Since "not-test.test" isn't of TEST type, its entities won't be deleted even though it ends
|
// Since "not-test.test" isn't of TEST type, its entities won't be deleted even though it ends
|
||||||
// with .test.
|
// with .test.
|
||||||
|
@ -90,9 +90,9 @@ class DeleteProberDataActionTest {
|
||||||
|
|
||||||
// Entities in these two should be deleted.
|
// Entities in these two should be deleted.
|
||||||
createTld("ib-any.test", "IBANYT");
|
createTld("ib-any.test", "IBANYT");
|
||||||
persistResource(Registry.get("ib-any.test").asBuilder().setTldType(TldType.TEST).build());
|
persistResource(Tld.get("ib-any.test").asBuilder().setTldType(TldType.TEST).build());
|
||||||
createTld("oa-canary.test", "OACANT");
|
createTld("oa-canary.test", "OACANT");
|
||||||
persistResource(Registry.get("oa-canary.test").asBuilder().setTldType(TldType.TEST).build());
|
persistResource(Tld.get("oa-canary.test").asBuilder().setTldType(TldType.TEST).build());
|
||||||
|
|
||||||
resetAction();
|
resetAction();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.domain.Period;
|
import google.registry.model.domain.Period;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
|
@ -313,7 +313,7 @@ public class ExpandRecurringBillingEventsPipelineTest {
|
||||||
void testSuccess_expandMultipleEvents_multipleDomains(int numOfThreads) {
|
void testSuccess_expandMultipleEvents_multipleDomains(int numOfThreads) {
|
||||||
createTld("test");
|
createTld("test");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("test")
|
Tld.get("test")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPremiumList(persistPremiumList("premium", USD, "other,USD 100"))
|
.setPremiumList(persistPremiumList("premium", USD, "other,USD 100"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -370,7 +370,7 @@ public class ExpandRecurringBillingEventsPipelineTest {
|
||||||
domain
|
domain
|
||||||
.getCreationTime()
|
.getCreationTime()
|
||||||
.plusYears(2)
|
.plusYears(2)
|
||||||
.plus(Registry.DEFAULT_AUTO_RENEW_GRACE_PERIOD),
|
.plus(Tld.DEFAULT_AUTO_RENEW_GRACE_PERIOD),
|
||||||
TransactionReportField.netRenewsFieldFromYears(1),
|
TransactionReportField.netRenewsFieldFromYears(1),
|
||||||
1)))
|
1)))
|
||||||
.build());
|
.build());
|
||||||
|
@ -394,10 +394,7 @@ public class ExpandRecurringBillingEventsPipelineTest {
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setEventTime(domain.getCreationTime().plusYears(2))
|
.setEventTime(domain.getCreationTime().plusYears(2))
|
||||||
.setBillingTime(
|
.setBillingTime(
|
||||||
domain
|
domain.getCreationTime().plusYears(2).plus(Tld.DEFAULT_AUTO_RENEW_GRACE_PERIOD))
|
||||||
.getCreationTime()
|
|
||||||
.plusYears(2)
|
|
||||||
.plus(Registry.DEFAULT_AUTO_RENEW_GRACE_PERIOD))
|
|
||||||
.build(),
|
.build(),
|
||||||
recurring
|
recurring
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
|
@ -455,10 +452,7 @@ public class ExpandRecurringBillingEventsPipelineTest {
|
||||||
DomainTransactionRecord.create(
|
DomainTransactionRecord.create(
|
||||||
domain.getTld(),
|
domain.getTld(),
|
||||||
// We report this when the autorenew grace period ends.
|
// We report this when the autorenew grace period ends.
|
||||||
domain
|
domain.getCreationTime().plusYears(1).plus(Tld.DEFAULT_AUTO_RENEW_GRACE_PERIOD),
|
||||||
.getCreationTime()
|
|
||||||
.plusYears(1)
|
|
||||||
.plus(Registry.DEFAULT_AUTO_RENEW_GRACE_PERIOD),
|
|
||||||
TransactionReportField.netRenewsFieldFromYears(1),
|
TransactionReportField.netRenewsFieldFromYears(1),
|
||||||
1)))
|
1)))
|
||||||
.build();
|
.build();
|
||||||
|
@ -472,7 +466,7 @@ public class ExpandRecurringBillingEventsPipelineTest {
|
||||||
Domain domain, DomainHistory history, Recurring recurring, int cost) {
|
Domain domain, DomainHistory history, Recurring recurring, int cost) {
|
||||||
return new BillingEvent.OneTime.Builder()
|
return new BillingEvent.OneTime.Builder()
|
||||||
.setBillingTime(
|
.setBillingTime(
|
||||||
domain.getCreationTime().plusYears(1).plus(Registry.DEFAULT_AUTO_RENEW_GRACE_PERIOD))
|
domain.getCreationTime().plusYears(1).plus(Tld.DEFAULT_AUTO_RENEW_GRACE_PERIOD))
|
||||||
.setRegistrarId("TheRegistrar")
|
.setRegistrarId("TheRegistrar")
|
||||||
.setCost(Money.of(USD, cost))
|
.setCost(Money.of(USD, cost))
|
||||||
.setEventTime(domain.getCreationTime().plusYears(1))
|
.setEventTime(domain.getCreationTime().plusYears(1))
|
||||||
|
|
|
@ -16,9 +16,9 @@ package google.registry.beam.billing;
|
||||||
|
|
||||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
import static google.registry.testing.DatabaseHelper.newTld;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||||
import static google.registry.testing.DatabaseHelper.persistNewRegistrar;
|
import static google.registry.testing.DatabaseHelper.persistNewRegistrar;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
|
@ -45,7 +45,7 @@ import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
import google.registry.testing.FakeClock;
|
import google.registry.testing.FakeClock;
|
||||||
|
@ -291,8 +291,8 @@ class InvoicingPipelineTest {
|
||||||
.setPoNumber(Optional.of("22446688"))
|
.setPoNumber(Optional.of("22446688"))
|
||||||
.build();
|
.build();
|
||||||
persistResource(registrar);
|
persistResource(registrar);
|
||||||
Registry test =
|
Tld test =
|
||||||
newRegistry("test", "_TEST", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
|
newTld("test", "_TEST", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setInvoicingEnabled(true)
|
.setInvoicingEnabled(true)
|
||||||
.build();
|
.build();
|
||||||
|
@ -395,14 +395,14 @@ class InvoicingPipelineTest {
|
||||||
registrar3 = registrar3.asBuilder().setBillingAccountMap(ImmutableMap.of(USD, "789")).build();
|
registrar3 = registrar3.asBuilder().setBillingAccountMap(ImmutableMap.of(USD, "789")).build();
|
||||||
persistResource(registrar3);
|
persistResource(registrar3);
|
||||||
|
|
||||||
Registry test =
|
Tld test =
|
||||||
newRegistry("test", "_TEST", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
|
newTld("test", "_TEST", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setInvoicingEnabled(true)
|
.setInvoicingEnabled(true)
|
||||||
.build();
|
.build();
|
||||||
persistResource(test);
|
persistResource(test);
|
||||||
Registry hello =
|
Tld hello =
|
||||||
newRegistry("hello", "_HELLO", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
|
newTld("hello", "_HELLO", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setInvoicingEnabled(true)
|
.setInvoicingEnabled(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -20,7 +20,7 @@ import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.truth.Truth;
|
import com.google.common.truth.Truth;
|
||||||
import google.registry.beam.TestPipelineExtension;
|
import google.registry.beam.TestPipelineExtension;
|
||||||
import google.registry.beam.common.RegistryJpaIO.Read;
|
import google.registry.beam.common.RegistryJpaIO.Read;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.NomulusPostgreSql;
|
import google.registry.persistence.NomulusPostgreSql;
|
||||||
import google.registry.persistence.PersistenceModule;
|
import google.registry.persistence.PersistenceModule;
|
||||||
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
||||||
|
@ -67,7 +67,7 @@ public class DatabaseSnapshotTest {
|
||||||
static JpaTransactionManager origJpa;
|
static JpaTransactionManager origJpa;
|
||||||
static JpaTransactionManager jpa;
|
static JpaTransactionManager jpa;
|
||||||
|
|
||||||
static Registry registry;
|
static Tld registry;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
static void setup() {
|
static void setup() {
|
||||||
|
@ -84,7 +84,7 @@ public class DatabaseSnapshotTest {
|
||||||
origJpa = tm();
|
origJpa = tm();
|
||||||
TransactionManagerFactory.setJpaTm(() -> jpa);
|
TransactionManagerFactory.setJpaTm(() -> jpa);
|
||||||
|
|
||||||
Registry tld = DatabaseHelper.newRegistry("tld", "TLD");
|
Tld tld = DatabaseHelper.newTld("tld", "TLD");
|
||||||
tm().transact(() -> tm().put(tld));
|
tm().transact(() -> tm().put(tld));
|
||||||
registry = tm().transact(() -> tm().loadByEntity(tld));
|
registry = tm().transact(() -> tm().loadByEntity(tld));
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ public class DatabaseSnapshotTest {
|
||||||
@Test
|
@Test
|
||||||
void readSnapshot() {
|
void readSnapshot() {
|
||||||
try (DatabaseSnapshot databaseSnapshot = DatabaseSnapshot.createSnapshot()) {
|
try (DatabaseSnapshot databaseSnapshot = DatabaseSnapshot.createSnapshot()) {
|
||||||
Registry snapshotRegistry =
|
Tld snapshotRegistry =
|
||||||
tm().transact(
|
tm().transact(
|
||||||
() ->
|
() ->
|
||||||
tm().setDatabaseSnapshot(databaseSnapshot.getSnapshotId())
|
tm().setDatabaseSnapshot(databaseSnapshot.getSnapshotId())
|
||||||
|
@ -124,17 +124,17 @@ public class DatabaseSnapshotTest {
|
||||||
@Test
|
@Test
|
||||||
void readSnapshot_withSubsequentChange() {
|
void readSnapshot_withSubsequentChange() {
|
||||||
try (DatabaseSnapshot databaseSnapshot = DatabaseSnapshot.createSnapshot()) {
|
try (DatabaseSnapshot databaseSnapshot = DatabaseSnapshot.createSnapshot()) {
|
||||||
Registry updated =
|
Tld updated =
|
||||||
registry
|
registry
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCreateBillingCost(registry.getStandardCreateCost().plus(1))
|
.setCreateBillingCost(registry.getStandardCreateCost().plus(1))
|
||||||
.build();
|
.build();
|
||||||
tm().transact(() -> tm().put(updated));
|
tm().transact(() -> tm().put(updated));
|
||||||
|
|
||||||
Registry persistedUpdate = tm().transact(() -> tm().loadByEntity(registry));
|
Tld persistedUpdate = tm().transact(() -> tm().loadByEntity(registry));
|
||||||
Truth.assertThat(persistedUpdate).isNotEqualTo(registry);
|
Truth.assertThat(persistedUpdate).isNotEqualTo(registry);
|
||||||
|
|
||||||
Registry snapshotRegistry =
|
Tld snapshotRegistry =
|
||||||
tm().transact(
|
tm().transact(
|
||||||
() ->
|
() ->
|
||||||
tm().setDatabaseSnapshot(databaseSnapshot.getSnapshotId())
|
tm().setDatabaseSnapshot(databaseSnapshot.getSnapshotId())
|
||||||
|
@ -149,18 +149,18 @@ public class DatabaseSnapshotTest {
|
||||||
@Test
|
@Test
|
||||||
void readWithRegistryJpaIO() {
|
void readWithRegistryJpaIO() {
|
||||||
try (DatabaseSnapshot databaseSnapshot = DatabaseSnapshot.createSnapshot()) {
|
try (DatabaseSnapshot databaseSnapshot = DatabaseSnapshot.createSnapshot()) {
|
||||||
Registry updated =
|
Tld updated =
|
||||||
registry
|
registry
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCreateBillingCost(registry.getStandardCreateCost().plus(1))
|
.setCreateBillingCost(registry.getStandardCreateCost().plus(1))
|
||||||
.build();
|
.build();
|
||||||
tm().transact(() -> tm().put(updated));
|
tm().transact(() -> tm().put(updated));
|
||||||
|
|
||||||
Read<Registry, Registry> read =
|
Read<Tld, Tld> read =
|
||||||
RegistryJpaIO.read(() -> CriteriaQueryBuilder.create(Registry.class).build(), x -> x)
|
RegistryJpaIO.read(() -> CriteriaQueryBuilder.create(Tld.class).build(), x -> x)
|
||||||
.withCoder(SerializableCoder.of(Registry.class))
|
.withCoder(SerializableCoder.of(Tld.class))
|
||||||
.withSnapshot(databaseSnapshot.getSnapshotId());
|
.withSnapshot(databaseSnapshot.getSnapshotId());
|
||||||
PCollection<Registry> registries = testPipeline.apply(read);
|
PCollection<Tld> registries = testPipeline.apply(read);
|
||||||
|
|
||||||
// This assertion depends on Registry being Serializable, which may change if the
|
// This assertion depends on Registry being Serializable, which may change if the
|
||||||
// UnsafeSerializable interface is removed after migration.
|
// UnsafeSerializable interface is removed after migration.
|
||||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.beam.common;
|
||||||
import static google.registry.persistence.transaction.JpaTransactionManagerExtension.makeRegistrar1;
|
import static google.registry.persistence.transaction.JpaTransactionManagerExtension.makeRegistrar1;
|
||||||
import static google.registry.testing.DatabaseHelper.insertInDb;
|
import static google.registry.testing.DatabaseHelper.insertInDb;
|
||||||
import static google.registry.testing.DatabaseHelper.newContact;
|
import static google.registry.testing.DatabaseHelper.newContact;
|
||||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
import static google.registry.testing.DatabaseHelper.newTld;
|
||||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import google.registry.model.domain.secdns.DomainDsData;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.ContactTransferData;
|
import google.registry.model.transfer.ContactTransferData;
|
||||||
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
|
@ -161,7 +161,7 @@ public class RegistryJpaReadTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupForJoinQuery() {
|
private void setupForJoinQuery() {
|
||||||
Registry registry = newRegistry("com", "ABCD_APP");
|
Tld registry = newTld("com", "ABCD_APP");
|
||||||
Registrar registrar =
|
Registrar registrar =
|
||||||
makeRegistrar1()
|
makeRegistrar1()
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
|
|
|
@ -73,7 +73,7 @@ import google.registry.model.registrar.Registrar.State;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
|
@ -247,8 +247,8 @@ public class RdePipelineTest {
|
||||||
|
|
||||||
tm().transact(
|
tm().transact(
|
||||||
() -> {
|
() -> {
|
||||||
tm().put(Cursor.createScoped(CursorType.BRDA, now, Registry.get("soy")));
|
tm().put(Cursor.createScoped(CursorType.BRDA, now, Tld.get("soy")));
|
||||||
tm().put(Cursor.createScoped(RDE_STAGING, now, Registry.get("soy")));
|
tm().put(Cursor.createScoped(RDE_STAGING, now, Tld.get("soy")));
|
||||||
RdeRevision.saveRevision("soy", now, THIN, 0);
|
RdeRevision.saveRevision("soy", now, THIN, 0);
|
||||||
RdeRevision.saveRevision("soy", now, FULL, 0);
|
RdeRevision.saveRevision("soy", now, FULL, 0);
|
||||||
});
|
});
|
||||||
|
@ -562,8 +562,7 @@ public class RdePipelineTest {
|
||||||
|
|
||||||
private static DateTime loadCursorTime(CursorType type) {
|
private static DateTime loadCursorTime(CursorType type) {
|
||||||
return tm().transact(
|
return tm().transact(
|
||||||
() ->
|
() -> tm().loadByKey(Cursor.createScopedVKey(type, Tld.get("soy"))).getCursorTime());
|
||||||
tm().loadByKey(Cursor.createScopedVKey(type, Registry.get("soy"))).getCursorTime());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Function<DepositFragment, String> getXmlElement(String pattern) {
|
private static Function<DepositFragment, String> getXmlElement(String pattern) {
|
||||||
|
|
|
@ -25,8 +25,8 @@ import com.google.cloud.tasks.v2.Task;
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.collect.ImmutableListMultimap;
|
import com.google.common.collect.ImmutableListMultimap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
import google.registry.testing.CloudTasksHelper;
|
import google.registry.testing.CloudTasksHelper;
|
||||||
|
@ -81,7 +81,7 @@ class TldFanoutActionTest {
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void beforeEach() {
|
void beforeEach() {
|
||||||
createTlds("com", "net", "org", "example");
|
createTlds("com", "net", "org", "example");
|
||||||
persistResource(Registry.get("example").asBuilder().setTldType(TldType.TEST).build());
|
persistResource(Tld.get("example").asBuilder().setTldType(TldType.TEST).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertTasks(String... tasks) {
|
private void assertTasks(String... tasks) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ import google.registry.dns.DnsMetrics.CommitStatus;
|
||||||
import google.registry.dns.DnsMetrics.PublishStatus;
|
import google.registry.dns.DnsMetrics.PublishStatus;
|
||||||
import google.registry.dns.writer.DnsWriter;
|
import google.registry.dns.writer.DnsWriter;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
import google.registry.request.HttpException.ServiceUnavailableException;
|
import google.registry.request.HttpException.ServiceUnavailableException;
|
||||||
|
@ -99,10 +99,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
registrySupportEmail = Lazies.of(new InternetAddress("registry@test.com"));
|
registrySupportEmail = Lazies.of(new InternetAddress("registry@test.com"));
|
||||||
registryCcEmail = Lazies.of(new InternetAddress("registry-cc@test.com"));
|
registryCcEmail = Lazies.of(new InternetAddress("registry-cc@test.com"));
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("xn--q9jyb4c")
|
Tld.get("xn--q9jyb4c").asBuilder().setDnsWriters(ImmutableSet.of("correctWriter")).build());
|
||||||
.asBuilder()
|
|
||||||
.setDnsWriters(ImmutableSet.of("correctWriter"))
|
|
||||||
.build());
|
|
||||||
Domain domain1 = persistActiveDomain("example.xn--q9jyb4c");
|
Domain domain1 = persistActiveDomain("example.xn--q9jyb4c");
|
||||||
persistActiveSubordinateHost("ns1.example.xn--q9jyb4c", domain1);
|
persistActiveSubordinateHost("ns1.example.xn--q9jyb4c", domain1);
|
||||||
persistActiveSubordinateHost("ns2.example.xn--q9jyb4c", domain1);
|
persistActiveSubordinateHost("ns2.example.xn--q9jyb4c", domain1);
|
||||||
|
@ -231,7 +228,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testAction_acquiresCorrectLock() {
|
void testAction_acquiresCorrectLock() {
|
||||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
||||||
LockHandler mockLockHandler = mock(LockHandler.class);
|
LockHandler mockLockHandler = mock(LockHandler.class);
|
||||||
when(mockLockHandler.executeWithLocks(any(), any(), any(), any())).thenReturn(true);
|
when(mockLockHandler.executeWithLocks(any(), any(), any(), any())).thenReturn(true);
|
||||||
action =
|
action =
|
||||||
|
@ -561,7 +558,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testParam_invalidLockIndex() {
|
void testParam_invalidLockIndex() {
|
||||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
||||||
action =
|
action =
|
||||||
createActionWithCustomLocks(
|
createActionWithCustomLocks(
|
||||||
"xn--q9jyb4c",
|
"xn--q9jyb4c",
|
||||||
|
@ -589,7 +586,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testRegistryParam_mismatchedMaxLocks() {
|
void testRegistryParam_mismatchedMaxLocks() {
|
||||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
||||||
action =
|
action =
|
||||||
createActionWithCustomLocks(
|
createActionWithCustomLocks(
|
||||||
"xn--q9jyb4c",
|
"xn--q9jyb4c",
|
||||||
|
|
|
@ -39,8 +39,8 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.hash.Hashing;
|
import com.google.common.hash.Hashing;
|
||||||
import com.google.common.net.InternetDomainName;
|
import com.google.common.net.InternetDomainName;
|
||||||
import google.registry.dns.DnsConstants.TargetType;
|
import google.registry.dns.DnsConstants.TargetType;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
import google.registry.testing.CloudTasksHelper;
|
import google.registry.testing.CloudTasksHelper;
|
||||||
|
@ -82,18 +82,16 @@ public class ReadDnsQueueActionTest {
|
||||||
// To make sure it's never in the past, we set the date far-far into the future
|
// To make sure it's never in the past, we set the date far-far into the future
|
||||||
clock.setTo(DateTime.parse("3000-01-01TZ"));
|
clock.setTo(DateTime.parse("3000-01-01TZ"));
|
||||||
createTlds("com", "net", "example", "multilock.uk");
|
createTlds("com", "net", "example", "multilock.uk");
|
||||||
|
persistResource(Tld.get("com").asBuilder().setDnsWriters(ImmutableSet.of("comWriter")).build());
|
||||||
|
persistResource(Tld.get("net").asBuilder().setDnsWriters(ImmutableSet.of("netWriter")).build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("com").asBuilder().setDnsWriters(ImmutableSet.of("comWriter")).build());
|
Tld.get("example")
|
||||||
persistResource(
|
|
||||||
Registry.get("net").asBuilder().setDnsWriters(ImmutableSet.of("netWriter")).build());
|
|
||||||
persistResource(
|
|
||||||
Registry.get("example")
|
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldType(TldType.TEST)
|
.setTldType(TldType.TEST)
|
||||||
.setDnsWriters(ImmutableSet.of("exampleWriter"))
|
.setDnsWriters(ImmutableSet.of("exampleWriter"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("multilock.uk")
|
Tld.get("multilock.uk")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setNumDnsPublishLocks(1000)
|
.setNumDnsPublishLocks(1000)
|
||||||
.setDnsWriters(ImmutableSet.of("multilockWriter"))
|
.setDnsWriters(ImmutableSet.of("multilockWriter"))
|
||||||
|
@ -217,7 +215,7 @@ public class ReadDnsQueueActionTest {
|
||||||
@RetryingTest(4)
|
@RetryingTest(4)
|
||||||
void testSuccess_twoDnsWriters() {
|
void testSuccess_twoDnsWriters() {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("com")
|
Tld.get("com")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDnsWriters(ImmutableSet.of("comWriter", "otherWriter"))
|
.setDnsWriters(ImmutableSet.of("comWriter", "otherWriter"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -256,7 +254,7 @@ public class ReadDnsQueueActionTest {
|
||||||
|
|
||||||
@RetryingTest(4)
|
@RetryingTest(4)
|
||||||
void testSuccess_oneTldPaused_returnedToQueue() {
|
void testSuccess_oneTldPaused_returnedToQueue() {
|
||||||
persistResource(Registry.get("net").asBuilder().setDnsPaused(true).build());
|
persistResource(Tld.get("net").asBuilder().setDnsPaused(true).build());
|
||||||
dnsQueue.addDomainRefreshTask("domain.com");
|
dnsQueue.addDomainRefreshTask("domain.com");
|
||||||
dnsQueue.addDomainRefreshTask("domain.net");
|
dnsQueue.addDomainRefreshTask("domain.net");
|
||||||
dnsQueue.addDomainRefreshTask("domain.example");
|
dnsQueue.addDomainRefreshTask("domain.example");
|
||||||
|
|
|
@ -43,7 +43,7 @@ import com.google.common.collect.Ordering;
|
||||||
import google.registry.dns.DnsConstants.TargetType;
|
import google.registry.dns.DnsConstants.TargetType;
|
||||||
import google.registry.model.common.DnsRefreshRequest;
|
import google.registry.model.common.DnsRefreshRequest;
|
||||||
import google.registry.model.common.DnsRefreshRequestTest;
|
import google.registry.model.common.DnsRefreshRequestTest;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
import google.registry.testing.CloudTasksHelper;
|
import google.registry.testing.CloudTasksHelper;
|
||||||
|
@ -151,7 +151,7 @@ public class ReadDnsRefreshRequestsActionTest {
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_runAction_twoBatches() {
|
void testSuccess_runAction_twoBatches() {
|
||||||
// Make the read batch size 2 * 1 = 2.
|
// Make the read batch size 2 * 1 = 2.
|
||||||
persistResource(Registry.get("tld").asBuilder().setNumDnsPublishLocks(1).build());
|
persistResource(Tld.get("tld").asBuilder().setNumDnsPublishLocks(1).build());
|
||||||
doReturn(1).when(action).getLockIndex(anyInt(), any(DnsRefreshRequest.class));
|
doReturn(1).when(action).getLockIndex(anyInt(), any(DnsRefreshRequest.class));
|
||||||
doAnswer(
|
doAnswer(
|
||||||
invocation -> {
|
invocation -> {
|
||||||
|
@ -181,7 +181,7 @@ public class ReadDnsRefreshRequestsActionTest {
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_runAction_timeOutAfterFirstRead() {
|
void testSuccess_runAction_timeOutAfterFirstRead() {
|
||||||
// Make the process batch size 2 * 1 = 2.
|
// Make the process batch size 2 * 1 = 2.
|
||||||
persistResource(Registry.get("tld").asBuilder().setNumDnsPublishLocks(1).build());
|
persistResource(Tld.get("tld").asBuilder().setNumDnsPublishLocks(1).build());
|
||||||
// Both requests in the first batch will be bucketed to the same bucket.
|
// Both requests in the first batch will be bucketed to the same bucket.
|
||||||
doReturn(1).when(action).getLockIndex(anyInt(), any(DnsRefreshRequest.class));
|
doReturn(1).when(action).getLockIndex(anyInt(), any(DnsRefreshRequest.class));
|
||||||
doAnswer(
|
doAnswer(
|
||||||
|
|
|
@ -33,8 +33,8 @@ import com.google.cloud.storage.contrib.nio.testing.LocalStorageHelper;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.net.MediaType;
|
import com.google.common.net.MediaType;
|
||||||
import google.registry.gcs.GcsUtils;
|
import google.registry.gcs.GcsUtils;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
import google.registry.storage.drive.DriveConnection;
|
import google.registry.storage.drive.DriveConnection;
|
||||||
|
@ -62,8 +62,8 @@ class ExportDomainListsActionTest {
|
||||||
void beforeEach() {
|
void beforeEach() {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
createTld("testtld");
|
createTld("testtld");
|
||||||
persistResource(Registry.get("tld").asBuilder().setDriveFolderId("brouhaha").build());
|
persistResource(Tld.get("tld").asBuilder().setDriveFolderId("brouhaha").build());
|
||||||
persistResource(Registry.get("testtld").asBuilder().setTldType(TldType.TEST).build());
|
persistResource(Tld.get("testtld").asBuilder().setTldType(TldType.TEST).build());
|
||||||
|
|
||||||
action = new ExportDomainListsAction();
|
action = new ExportDomainListsAction();
|
||||||
action.gcsBucket = "outputbucket";
|
action.gcsBucket = "outputbucket";
|
||||||
|
@ -118,7 +118,7 @@ class ExportDomainListsActionTest {
|
||||||
@Test
|
@Test
|
||||||
void test_outputsDomainsFromDifferentTldsToMultipleFiles() throws Exception {
|
void test_outputsDomainsFromDifferentTldsToMultipleFiles() throws Exception {
|
||||||
createTld("tldtwo");
|
createTld("tldtwo");
|
||||||
persistResource(Registry.get("tldtwo").asBuilder().setDriveFolderId("hooray").build());
|
persistResource(Tld.get("tldtwo").asBuilder().setDriveFolderId("hooray").build());
|
||||||
|
|
||||||
createTld("tldthree");
|
createTld("tldthree");
|
||||||
// You'd think this test was written around Christmas, but it wasn't.
|
// You'd think this test was written around Christmas, but it wasn't.
|
||||||
|
|
|
@ -36,7 +36,7 @@ import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.net.MediaType;
|
import com.google.common.net.MediaType;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.label.PremiumList;
|
import google.registry.model.tld.label.PremiumList;
|
||||||
import google.registry.model.tld.label.PremiumListDao;
|
import google.registry.model.tld.label.PremiumListDao;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
|
@ -70,7 +70,7 @@ public class ExportPremiumTermsActionTest {
|
||||||
action.response = response;
|
action.response = response;
|
||||||
action.driveConnection = driveConnection;
|
action.driveConnection = driveConnection;
|
||||||
action.exportDisclaimer = DISCLAIMER_WITH_NEWLINE;
|
action.exportDisclaimer = DISCLAIMER_WITH_NEWLINE;
|
||||||
action.tld = tld;
|
action.tldStr = tld;
|
||||||
action.run();
|
action.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class ExportPremiumTermsActionTest {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
PremiumList pl = PremiumListDao.save("pl-name", USD, PREMIUM_NAMES);
|
PremiumList pl = PremiumListDao.save("pl-name", USD, PREMIUM_NAMES);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld").asBuilder().setPremiumList(pl).setDriveFolderId("folder_id").build());
|
Tld.get("tld").asBuilder().setPremiumList(pl).setDriveFolderId("folder_id").build());
|
||||||
when(driveConnection.createOrUpdateFile(
|
when(driveConnection.createOrUpdateFile(
|
||||||
anyString(), any(MediaType.class), eq("folder_id"), any(byte[].class)))
|
anyString(), any(MediaType.class), eq("folder_id"), any(byte[].class)))
|
||||||
.thenReturn("file_id");
|
.thenReturn("file_id");
|
||||||
|
@ -108,7 +108,7 @@ public class ExportPremiumTermsActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void test_exportPremiumTerms_doNothing_listNotConfigured() {
|
void test_exportPremiumTerms_doNothing_listNotConfigured() {
|
||||||
persistResource(Registry.get("tld").asBuilder().setPremiumList(null).build());
|
persistResource(Tld.get("tld").asBuilder().setPremiumList(null).build());
|
||||||
runAction("tld");
|
runAction("tld");
|
||||||
|
|
||||||
verifyNoInteractions(driveConnection);
|
verifyNoInteractions(driveConnection);
|
||||||
|
@ -120,7 +120,7 @@ public class ExportPremiumTermsActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testExportPremiumTerms_doNothing_driveIdNotConfiguredInTld() {
|
void testExportPremiumTerms_doNothing_driveIdNotConfiguredInTld() {
|
||||||
persistResource(Registry.get("tld").asBuilder().setDriveFolderId(null).build());
|
persistResource(Tld.get("tld").asBuilder().setDriveFolderId(null).build());
|
||||||
runAction("tld");
|
runAction("tld");
|
||||||
|
|
||||||
verifyNoInteractions(driveConnection);
|
verifyNoInteractions(driveConnection);
|
||||||
|
@ -157,7 +157,7 @@ public class ExportPremiumTermsActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testExportPremiumTerms_failure_driveIdThrowsException() throws IOException {
|
void testExportPremiumTerms_failure_driveIdThrowsException() throws IOException {
|
||||||
persistResource(Registry.get("tld").asBuilder().setDriveFolderId("bad_folder_id").build());
|
persistResource(Tld.get("tld").asBuilder().setDriveFolderId("bad_folder_id").build());
|
||||||
assertThrows(RuntimeException.class, () -> runAction("tld"));
|
assertThrows(RuntimeException.class, () -> runAction("tld"));
|
||||||
|
|
||||||
verify(driveConnection)
|
verify(driveConnection)
|
||||||
|
|
|
@ -32,7 +32,7 @@ import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.net.MediaType;
|
import com.google.common.net.MediaType;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.label.ReservedList;
|
import google.registry.model.tld.label.ReservedList;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
|
@ -57,7 +57,7 @@ public class ExportReservedTermsActionTest {
|
||||||
action.response = response;
|
action.response = response;
|
||||||
action.driveConnection = driveConnection;
|
action.driveConnection = driveConnection;
|
||||||
action.exportUtils = new ExportUtils("# This is a disclaimer.");
|
action.exportUtils = new ExportUtils("# This is a disclaimer.");
|
||||||
action.tld = tld;
|
action.tldStr = tld;
|
||||||
action.run();
|
action.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,9 +68,8 @@ public class ExportReservedTermsActionTest {
|
||||||
"lol,FULLY_BLOCKED",
|
"lol,FULLY_BLOCKED",
|
||||||
"cat,FULLY_BLOCKED");
|
"cat,FULLY_BLOCKED");
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(Registry.get("tld").asBuilder()
|
persistResource(
|
||||||
.setReservedLists(rl)
|
Tld.get("tld").asBuilder().setReservedLists(rl).setDriveFolderId("brouhaha").build());
|
||||||
.setDriveFolderId("brouhaha").build());
|
|
||||||
when(driveConnection.createOrUpdateFile(
|
when(driveConnection.createOrUpdateFile(
|
||||||
anyString(),
|
anyString(),
|
||||||
any(MediaType.class),
|
any(MediaType.class),
|
||||||
|
@ -91,7 +90,7 @@ public class ExportReservedTermsActionTest {
|
||||||
@Test
|
@Test
|
||||||
void test_uploadFileToDrive_doesNothingIfReservedListsNotConfigured() {
|
void test_uploadFileToDrive_doesNothingIfReservedListsNotConfigured() {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(ImmutableSet.of())
|
.setReservedLists(ImmutableSet.of())
|
||||||
.setDriveFolderId(null)
|
.setDriveFolderId(null)
|
||||||
|
@ -103,7 +102,7 @@ public class ExportReservedTermsActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void test_uploadFileToDrive_doesNothingWhenDriveFolderIdIsNull() {
|
void test_uploadFileToDrive_doesNothingWhenDriveFolderIdIsNull() {
|
||||||
persistResource(Registry.get("tld").asBuilder().setDriveFolderId(null).build());
|
persistResource(Tld.get("tld").asBuilder().setDriveFolderId(null).build());
|
||||||
runAction("tld");
|
runAction("tld");
|
||||||
verify(response).setStatus(SC_OK);
|
verify(response).setStatus(SC_OK);
|
||||||
verify(response)
|
verify(response)
|
||||||
|
@ -129,6 +128,6 @@ public class ExportReservedTermsActionTest {
|
||||||
assertThat(thrown)
|
assertThat(thrown)
|
||||||
.hasCauseThat()
|
.hasCauseThat()
|
||||||
.hasMessageThat()
|
.hasMessageThat()
|
||||||
.isEqualTo("No registry object(s) found for fakeTld");
|
.isEqualTo("No TLD object(s) found for fakeTld");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.persistReservedList;
|
import static google.registry.testing.DatabaseHelper.persistReservedList;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
|
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.label.ReservedList;
|
import google.registry.model.tld.label.ReservedList;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
|
@ -48,9 +48,9 @@ class ExportUtilsTest {
|
||||||
false,
|
false,
|
||||||
"tine,FULLY_BLOCKED");
|
"tine,FULLY_BLOCKED");
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(rl1, rl2, rl3).build());
|
persistResource(Tld.get("tld").asBuilder().setReservedLists(rl1, rl2, rl3).build());
|
||||||
// Should not contain jimmy, tine, or oval.
|
// Should not contain jimmy, tine, or oval.
|
||||||
assertThat(new ExportUtils("# This is a disclaimer.").exportReservedTerms(Registry.get("tld")))
|
assertThat(new ExportUtils("# This is a disclaimer.").exportReservedTerms(Tld.get("tld")))
|
||||||
.isEqualTo("# This is a disclaimer.\ncat\nlol\nsnow\n");
|
.isEqualTo("# This is a disclaimer.\ncat\nlol\nsnow\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.flows;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.common.truth.Truth8.assertThat;
|
import static com.google.common.truth.Truth8.assertThat;
|
||||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||||
import static google.registry.monitoring.whitebox.CheckApiMetric.Availability.AVAILABLE;
|
import static google.registry.monitoring.whitebox.CheckApiMetric.Availability.AVAILABLE;
|
||||||
import static google.registry.monitoring.whitebox.CheckApiMetric.Availability.REGISTERED;
|
import static google.registry.monitoring.whitebox.CheckApiMetric.Availability.REGISTERED;
|
||||||
import static google.registry.monitoring.whitebox.CheckApiMetric.Availability.RESERVED;
|
import static google.registry.monitoring.whitebox.CheckApiMetric.Availability.RESERVED;
|
||||||
|
@ -28,7 +28,7 @@ import static google.registry.testing.DatabaseHelper.persistReservedList;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.monitoring.whitebox.CheckApiMetric;
|
import google.registry.monitoring.whitebox.CheckApiMetric;
|
||||||
import google.registry.monitoring.whitebox.CheckApiMetric.Availability;
|
import google.registry.monitoring.whitebox.CheckApiMetric.Availability;
|
||||||
import google.registry.monitoring.whitebox.CheckApiMetric.Status;
|
import google.registry.monitoring.whitebox.CheckApiMetric.Status;
|
||||||
|
@ -68,7 +68,7 @@ class CheckApiActionTest {
|
||||||
void beforeEach() {
|
void beforeEach() {
|
||||||
createTld("example");
|
createTld("example");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("example")
|
Tld.get("example")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(
|
.setReservedLists(
|
||||||
persistReservedList(
|
persistReservedList(
|
||||||
|
|
|
@ -18,9 +18,9 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
|
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
|
||||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS_AND_CLOSE;
|
import static google.registry.model.eppoutput.Result.Code.SUCCESS_AND_CLOSE;
|
||||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
|
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
|
||||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||||
import static google.registry.testing.DatabaseHelper.assertBillingEventsForResource;
|
import static google.registry.testing.DatabaseHelper.assertBillingEventsForResource;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||||
|
@ -44,8 +44,8 @@ import google.registry.model.billing.BillingEvent.Reason;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.reporting.HistoryEntry.Type;
|
import google.registry.model.reporting.HistoryEntry.Type;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
import google.registry.testing.TaskQueueExtension;
|
import google.registry.testing.TaskQueueExtension;
|
||||||
|
@ -512,13 +512,16 @@ class EppLifecycleDomainTest extends EppTestCase {
|
||||||
|
|
||||||
// Set the EAP schedule.
|
// Set the EAP schedule.
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setEapFeeSchedule(
|
.setEapFeeSchedule(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
START_OF_TIME, Money.of(USD, 0),
|
START_OF_TIME,
|
||||||
DateTime.parse("2000-06-01T00:00:00Z"), Money.of(USD, 100),
|
Money.of(USD, 0),
|
||||||
DateTime.parse("2000-06-02T00:00:00Z"), Money.of(USD, 0)))
|
DateTime.parse("2000-06-01T00:00:00Z"),
|
||||||
|
Money.of(USD, 100),
|
||||||
|
DateTime.parse("2000-06-02T00:00:00Z"),
|
||||||
|
Money.of(USD, 0)))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
// Create domain example.tld, which should have an EAP fee of USD 100.
|
// Create domain example.tld, which should have an EAP fee of USD 100.
|
||||||
|
@ -546,7 +549,7 @@ class EppLifecycleDomainTest extends EppTestCase {
|
||||||
.setPeriodYears(1)
|
.setPeriodYears(1)
|
||||||
.setCost(Money.parse("USD 100.00"))
|
.setCost(Money.parse("USD 100.00"))
|
||||||
.setEventTime(createTime)
|
.setEventTime(createTime)
|
||||||
.setBillingTime(createTime.plus(Registry.get("tld").getRenewGracePeriodLength()))
|
.setBillingTime(createTime.plus(Tld.get("tld").getRenewGracePeriodLength()))
|
||||||
.setDomainHistory(
|
.setDomainHistory(
|
||||||
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_CREATE, DomainHistory.class))
|
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_CREATE, DomainHistory.class))
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -36,7 +36,7 @@ import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.eppcommon.EppXmlTransformer;
|
import google.registry.model.eppcommon.EppXmlTransformer;
|
||||||
import google.registry.model.reporting.HistoryEntry.Type;
|
import google.registry.model.reporting.HistoryEntry.Type;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.monitoring.whitebox.EppMetric;
|
import google.registry.monitoring.whitebox.EppMetric;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.testing.FakeClock;
|
import google.registry.testing.FakeClock;
|
||||||
|
@ -310,7 +310,7 @@ public class EppTestCase {
|
||||||
.setCost(Money.parse("USD 26.00"))
|
.setCost(Money.parse("USD 26.00"))
|
||||||
.setPeriodYears(2)
|
.setPeriodYears(2)
|
||||||
.setEventTime(createTime)
|
.setEventTime(createTime)
|
||||||
.setBillingTime(createTime.plus(Registry.get(domain.getTld()).getAddGracePeriodLength()))
|
.setBillingTime(createTime.plus(Tld.get(domain.getTld()).getAddGracePeriodLength()))
|
||||||
.setDomainHistory(
|
.setDomainHistory(
|
||||||
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_CREATE, DomainHistory.class))
|
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_CREATE, DomainHistory.class))
|
||||||
.build();
|
.build();
|
||||||
|
@ -325,7 +325,7 @@ public class EppTestCase {
|
||||||
.setCost(Money.parse("USD 33.00"))
|
.setCost(Money.parse("USD 33.00"))
|
||||||
.setPeriodYears(3)
|
.setPeriodYears(3)
|
||||||
.setEventTime(renewTime)
|
.setEventTime(renewTime)
|
||||||
.setBillingTime(renewTime.plus(Registry.get(domain.getTld()).getRenewGracePeriodLength()))
|
.setBillingTime(renewTime.plus(Tld.get(domain.getTld()).getRenewGracePeriodLength()))
|
||||||
.setDomainHistory(getOnlyHistoryEntryOfType(domain, Type.DOMAIN_RENEW, DomainHistory.class))
|
.setDomainHistory(getOnlyHistoryEntryOfType(domain, Type.DOMAIN_RENEW, DomainHistory.class))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ public class EppTestCase {
|
||||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||||
.setEventTime(deleteTime)
|
.setEventTime(deleteTime)
|
||||||
.setOneTimeEventKey(findKeyToActualOneTimeBillingEvent(billingEventToCancel))
|
.setOneTimeEventKey(findKeyToActualOneTimeBillingEvent(billingEventToCancel))
|
||||||
.setBillingTime(createTime.plus(Registry.get(domain.getTld()).getAddGracePeriodLength()))
|
.setBillingTime(createTime.plus(Tld.get(domain.getTld()).getAddGracePeriodLength()))
|
||||||
.setReason(Reason.CREATE)
|
.setReason(Reason.CREATE)
|
||||||
.setDomainHistory(
|
.setDomainHistory(
|
||||||
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_DELETE, DomainHistory.class))
|
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_DELETE, DomainHistory.class))
|
||||||
|
@ -387,7 +387,7 @@ public class EppTestCase {
|
||||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||||
.setEventTime(deleteTime)
|
.setEventTime(deleteTime)
|
||||||
.setOneTimeEventKey(findKeyToActualOneTimeBillingEvent(billingEventToCancel))
|
.setOneTimeEventKey(findKeyToActualOneTimeBillingEvent(billingEventToCancel))
|
||||||
.setBillingTime(renewTime.plus(Registry.get(domain.getTld()).getRenewGracePeriodLength()))
|
.setBillingTime(renewTime.plus(Tld.get(domain.getTld()).getRenewGracePeriodLength()))
|
||||||
.setReason(Reason.RENEW)
|
.setReason(Reason.RENEW)
|
||||||
.setDomainHistory(
|
.setDomainHistory(
|
||||||
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_DELETE, DomainHistory.class))
|
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_DELETE, DomainHistory.class))
|
||||||
|
|
|
@ -44,7 +44,7 @@ import google.registry.model.poll.PendingActionNotificationResponse;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.reporting.HistoryEntry.Type;
|
import google.registry.model.reporting.HistoryEntry.Type;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.TransferData;
|
import google.registry.model.transfer.TransferData;
|
||||||
import google.registry.model.transfer.TransferResponse;
|
import google.registry.model.transfer.TransferResponse;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
|
@ -90,7 +90,7 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, Cont
|
||||||
persistContactWithPendingTransfer(
|
persistContactWithPendingTransfer(
|
||||||
persistActiveContact(getUniqueIdFromCommand()),
|
persistActiveContact(getUniqueIdFromCommand()),
|
||||||
transferRequestTime,
|
transferRequestTime,
|
||||||
transferRequestTime.plus(Registry.DEFAULT_TRANSFER_GRACE_PERIOD),
|
transferRequestTime.plus(Tld.DEFAULT_TRANSFER_GRACE_PERIOD),
|
||||||
clock.nowUtc())
|
clock.nowUtc())
|
||||||
.getTransferData();
|
.getTransferData();
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
|
|
@ -23,7 +23,7 @@ import google.registry.flows.Flow;
|
||||||
import google.registry.flows.ResourceFlowTestCase;
|
import google.registry.flows.ResourceFlowTestCase;
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.contact.Contact;
|
import google.registry.model.contact.Contact;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import google.registry.persistence.transaction.JpaTransactionManagerExtension;
|
import google.registry.persistence.transaction.JpaTransactionManagerExtension;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
@ -44,13 +44,13 @@ abstract class ContactTransferFlowTestCase<F extends Flow, R extends EppResource
|
||||||
|
|
||||||
private static final DateTime TRANSFER_REQUEST_TIME = DateTime.parse("2000-06-06T22:00:00.0Z");
|
private static final DateTime TRANSFER_REQUEST_TIME = DateTime.parse("2000-06-06T22:00:00.0Z");
|
||||||
private static final DateTime TRANSFER_EXPIRATION_TIME =
|
private static final DateTime TRANSFER_EXPIRATION_TIME =
|
||||||
TRANSFER_REQUEST_TIME.plus(Registry.DEFAULT_TRANSFER_GRACE_PERIOD);
|
TRANSFER_REQUEST_TIME.plus(Tld.DEFAULT_TRANSFER_GRACE_PERIOD);
|
||||||
private static final Duration TIME_SINCE_REQUEST = Duration.standardDays(3);
|
private static final Duration TIME_SINCE_REQUEST = Duration.standardDays(3);
|
||||||
|
|
||||||
protected Contact contact;
|
protected Contact contact;
|
||||||
|
|
||||||
ContactTransferFlowTestCase() {
|
ContactTransferFlowTestCase() {
|
||||||
checkState(!Registry.DEFAULT_TRANSFER_GRACE_PERIOD.isShorterThan(TIME_SINCE_REQUEST));
|
checkState(!Tld.DEFAULT_TRANSFER_GRACE_PERIOD.isShorterThan(TIME_SINCE_REQUEST));
|
||||||
clock.setTo(TRANSFER_REQUEST_TIME.plus(TIME_SINCE_REQUEST));
|
clock.setTo(TRANSFER_REQUEST_TIME.plus(TIME_SINCE_REQUEST));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ import static google.registry.model.domain.token.AllocationToken.TokenType.DEFAU
|
||||||
import static google.registry.model.domain.token.AllocationToken.TokenType.SINGLE_USE;
|
import static google.registry.model.domain.token.AllocationToken.TokenType.SINGLE_USE;
|
||||||
import static google.registry.model.domain.token.AllocationToken.TokenType.UNLIMITED_USE;
|
import static google.registry.model.domain.token.AllocationToken.TokenType.UNLIMITED_USE;
|
||||||
import static google.registry.model.eppoutput.CheckData.DomainCheck.create;
|
import static google.registry.model.eppoutput.CheckData.DomainCheck.create;
|
||||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||||
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
||||||
|
@ -81,8 +81,8 @@ import google.registry.model.domain.token.AllocationToken.TokenStatus;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import google.registry.model.tld.label.ReservedList;
|
import google.registry.model.tld.label.ReservedList;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -119,7 +119,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void initCheckTest() {
|
void initCheckTest() {
|
||||||
createTld("tld", TldState.QUIET_PERIOD);
|
createTld("tld", TldState.QUIET_PERIOD);
|
||||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(createReservedList()).build());
|
persistResource(Tld.get("tld").asBuilder().setReservedLists(createReservedList()).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -195,7 +195,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
void testSuccess_allocationToken_premiumAnchorTenant_noFee() throws Exception {
|
void testSuccess_allocationToken_premiumAnchorTenant_noFee() throws Exception {
|
||||||
createTld("example");
|
createTld("example");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPremiumList(persistPremiumList("example1", USD, "example1,USD 100"))
|
.setPremiumList(persistPremiumList("example1", USD, "example1,USD 100"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -509,7 +509,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_oneReservedInSunrise() throws Exception {
|
void testSuccess_oneReservedInSunrise() throws Exception {
|
||||||
createTld("tld", START_DATE_SUNRISE);
|
createTld("tld", START_DATE_SUNRISE);
|
||||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(createReservedList()).build());
|
persistResource(Tld.get("tld").asBuilder().setReservedLists(createReservedList()).build());
|
||||||
setEppInput("domain_check_one_tld_reserved.xml");
|
setEppInput("domain_check_one_tld_reserved.xml");
|
||||||
doCheckTest(
|
doCheckTest(
|
||||||
create(false, "reserved.tld", "Reserved"),
|
create(false, "reserved.tld", "Reserved"),
|
||||||
|
@ -531,7 +531,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_domainWithMultipleReservationType_useMostSevereMessage() throws Exception {
|
void testSuccess_domainWithMultipleReservationType_useMostSevereMessage() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(
|
.setReservedLists(
|
||||||
createReservedList(),
|
createReservedList(),
|
||||||
|
@ -567,7 +567,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
void testSuccess_multipartTld_oneReserved() throws Exception {
|
void testSuccess_multipartTld_oneReserved() throws Exception {
|
||||||
createTld("tld.foo");
|
createTld("tld.foo");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld.foo")
|
Tld.get("tld.foo")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(
|
.setReservedLists(
|
||||||
persistReservedList(
|
persistReservedList(
|
||||||
|
@ -643,7 +643,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testFailure_missingBillingAccount() {
|
void testFailure_missingBillingAccount() {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCurrency(JPY)
|
.setCurrency(JPY)
|
||||||
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
||||||
|
@ -797,7 +797,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
.setDiscountFraction(0.5)
|
.setDiscountFraction(0.5)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||||
.build());
|
.build());
|
||||||
|
@ -814,7 +814,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testFeeExtension_multipleReservations() throws Exception {
|
void testFeeExtension_multipleReservations() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(
|
.setReservedLists(
|
||||||
persistReservedList("example-sunrise", "allowedinsunrise,ALLOWED_IN_SUNRISE"))
|
persistReservedList("example-sunrise", "allowedinsunrise,ALLOWED_IN_SUNRISE"))
|
||||||
|
@ -940,7 +940,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
.setDiscountFraction(0.5)
|
.setDiscountFraction(0.5)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("example")
|
Tld.get("example")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||||
.build());
|
.build());
|
||||||
|
@ -962,7 +962,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
.setDiscountFraction(0.5)
|
.setDiscountFraction(0.5)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("example")
|
Tld.get("example")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||||
.build());
|
.build());
|
||||||
|
@ -984,7 +984,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
.setDiscountFraction(0.5)
|
.setDiscountFraction(0.5)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("example")
|
Tld.get("example")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1030,7 +1030,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
setEppInput("domain_check_fee_premium_v06.xml");
|
setEppInput("domain_check_fee_premium_v06.xml");
|
||||||
clock.setTo(DateTime.parse("2010-01-01T10:00:00Z"));
|
clock.setTo(DateTime.parse("2010-01-01T10:00:00Z"));
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("example")
|
Tld.get("example")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setEapFeeSchedule(
|
.setEapFeeSchedule(
|
||||||
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
||||||
|
@ -1059,7 +1059,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
persistPendingDeleteDomain("rich.example");
|
persistPendingDeleteDomain("rich.example");
|
||||||
setEppInput("domain_check_fee_premium_v06.xml");
|
setEppInput("domain_check_fee_premium_v06.xml");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("example")
|
Tld.get("example")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setEapFeeSchedule(
|
.setEapFeeSchedule(
|
||||||
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
||||||
|
@ -1136,8 +1136,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
// Note that the response xml expects to see "11.10" with two digits after the decimal point.
|
// Note that the response xml expects to see "11.10" with two digits after the decimal point.
|
||||||
// This works because Money.getAmount(), used in the flow, returns a BigDecimal that is set to
|
// This works because Money.getAmount(), used in the flow, returns a BigDecimal that is set to
|
||||||
// display the number of digits that is conventional for the given currency.
|
// display the number of digits that is conventional for the given currency.
|
||||||
persistResource(
|
persistResource(Tld.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 11.1)).build());
|
||||||
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 11.1)).build());
|
|
||||||
setEppInput("domain_check_fee_fractional.xml");
|
setEppInput("domain_check_fee_fractional.xml");
|
||||||
runFlowAssertResponse(loadFile("domain_check_fee_fractional_response.xml"));
|
runFlowAssertResponse(loadFile("domain_check_fee_fractional_response.xml"));
|
||||||
}
|
}
|
||||||
|
@ -1146,7 +1145,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testFeeExtension_reservedName_v06() throws Exception {
|
void testFeeExtension_reservedName_v06() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1158,7 +1157,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testFeeExtension_reservedName_restoreFeeWithDupes_v06() throws Exception {
|
void testFeeExtension_reservedName_restoreFeeWithDupes_v06() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1173,7 +1172,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testFeeExtension_reservedName_v11_create() throws Exception {
|
void testFeeExtension_reservedName_v11_create() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1185,7 +1184,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testFeeExtension_reservedName_v11_renew() throws Exception {
|
void testFeeExtension_reservedName_v11_renew() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1197,7 +1196,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testFeeExtension_reservedName_v11_transfer() throws Exception {
|
void testFeeExtension_reservedName_v11_transfer() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1209,7 +1208,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testFeeExtension_reservedName_v11_restore() throws Exception {
|
void testFeeExtension_reservedName_v11_restore() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1221,7 +1220,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testFeeExtension_reservedName_v11_restore_withRenewals() throws Exception {
|
void testFeeExtension_reservedName_v11_restore_withRenewals() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1238,7 +1237,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testFeeExtension_reservedName_v12() throws Exception {
|
void testFeeExtension_reservedName_v12() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1250,7 +1249,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
@Test
|
@Test
|
||||||
void testFeeExtension_reservedName_restoreFeeWithDupes_v12() throws Exception {
|
void testFeeExtension_reservedName_restoreFeeWithDupes_v12() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1265,7 +1264,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v06() throws Exception {
|
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v06() throws Exception {
|
||||||
createTld("tld", START_DATE_SUNRISE);
|
createTld("tld", START_DATE_SUNRISE);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1279,7 +1278,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
throws Exception {
|
throws Exception {
|
||||||
createTld("tld", START_DATE_SUNRISE);
|
createTld("tld", START_DATE_SUNRISE);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1297,7 +1296,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_create() throws Exception {
|
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_create() throws Exception {
|
||||||
createTld("tld", START_DATE_SUNRISE);
|
createTld("tld", START_DATE_SUNRISE);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1310,7 +1309,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_renew() throws Exception {
|
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_renew() throws Exception {
|
||||||
createTld("tld", START_DATE_SUNRISE);
|
createTld("tld", START_DATE_SUNRISE);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1323,7 +1322,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_transfer() throws Exception {
|
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_transfer() throws Exception {
|
||||||
createTld("tld", START_DATE_SUNRISE);
|
createTld("tld", START_DATE_SUNRISE);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1336,7 +1335,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_restore() throws Exception {
|
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_restore() throws Exception {
|
||||||
createTld("tld", START_DATE_SUNRISE);
|
createTld("tld", START_DATE_SUNRISE);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1349,7 +1348,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v12() throws Exception {
|
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v12() throws Exception {
|
||||||
createTld("tld", START_DATE_SUNRISE);
|
createTld("tld", START_DATE_SUNRISE);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(createReservedList())
|
.setReservedLists(createReservedList())
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||||
|
@ -1546,7 +1545,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||||
clock.setTo(DateTime.parse("2010-01-01T10:00:00Z"));
|
clock.setTo(DateTime.parse("2010-01-01T10:00:00Z"));
|
||||||
persistActiveDomain("example1.tld");
|
persistActiveDomain("example1.tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setEapFeeSchedule(
|
.setEapFeeSchedule(
|
||||||
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
package google.registry.flows.domain;
|
package google.registry.flows.domain;
|
||||||
|
|
||||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||||
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||||
|
@ -39,8 +39,8 @@ import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException
|
||||||
import google.registry.flows.domain.DomainFlowUtils.TldDoesNotExistException;
|
import google.registry.flows.domain.DomainFlowUtils.TldDoesNotExistException;
|
||||||
import google.registry.flows.exceptions.TooManyResourceChecksException;
|
import google.registry.flows.exceptions.TooManyResourceChecksException;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -131,7 +131,7 @@ public class DomainClaimsCheckFlowTest extends ResourceFlowTestCase<DomainClaims
|
||||||
@Test
|
@Test
|
||||||
void testFailure_missingBillingAccount() {
|
void testFailure_missingBillingAccount() {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCurrency(JPY)
|
.setCurrency(JPY)
|
||||||
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
||||||
|
@ -180,7 +180,7 @@ public class DomainClaimsCheckFlowTest extends ResourceFlowTestCase<DomainClaims
|
||||||
void testFailure_multipleTlds_oneHasEndedClaims() {
|
void testFailure_multipleTlds_oneHasEndedClaims() {
|
||||||
createTlds("tld1", "tld2");
|
createTlds("tld1", "tld2");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build());
|
Tld.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build());
|
||||||
setEppInput("domain_check_claims_multiple_tlds.xml");
|
setEppInput("domain_check_claims_multiple_tlds.xml");
|
||||||
EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
|
EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
|
|
|
@ -32,10 +32,10 @@ import static google.registry.model.domain.token.AllocationToken.TokenType.SINGL
|
||||||
import static google.registry.model.domain.token.AllocationToken.TokenType.UNLIMITED_USE;
|
import static google.registry.model.domain.token.AllocationToken.TokenType.UNLIMITED_USE;
|
||||||
import static google.registry.model.eppcommon.StatusValue.PENDING_DELETE;
|
import static google.registry.model.eppcommon.StatusValue.PENDING_DELETE;
|
||||||
import static google.registry.model.eppcommon.StatusValue.SERVER_HOLD;
|
import static google.registry.model.eppcommon.StatusValue.SERVER_HOLD;
|
||||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||||
import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD;
|
import static google.registry.model.tld.Tld.TldState.QUIET_PERIOD;
|
||||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
import static google.registry.pricing.PricingEngineProxy.isDomainPremium;
|
import static google.registry.pricing.PricingEngineProxy.isDomainPremium;
|
||||||
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
|
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
|
||||||
|
@ -168,9 +168,9 @@ import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldState;
|
import google.registry.model.tld.Tld.TldState;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.monitoring.whitebox.EppMetric;
|
import google.registry.monitoring.whitebox.EppMetric;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
|
@ -229,7 +229,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setDomainName("anchor.tld")
|
.setDomainName("anchor.tld")
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(
|
.setReservedLists(
|
||||||
persistReservedList(
|
persistReservedList(
|
||||||
|
@ -291,12 +291,12 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.build();
|
.build();
|
||||||
Money eapFee =
|
Money eapFee =
|
||||||
Money.of(
|
Money.of(
|
||||||
Registry.get(domainTld).getCurrency(),
|
Tld.get(domainTld).getCurrency(),
|
||||||
Registry.get(domainTld).getEapFeeFor(clock.nowUtc()).getCost());
|
Tld.get(domainTld).getEapFeeFor(clock.nowUtc()).getCost());
|
||||||
DateTime billingTime =
|
DateTime billingTime =
|
||||||
isAnchorTenant
|
isAnchorTenant
|
||||||
? clock.nowUtc().plus(Registry.get(domainTld).getAnchorTenantAddGracePeriodLength())
|
? clock.nowUtc().plus(Tld.get(domainTld).getAnchorTenantAddGracePeriodLength())
|
||||||
: clock.nowUtc().plus(Registry.get(domainTld).getAddGracePeriodLength());
|
: clock.nowUtc().plus(Tld.get(domainTld).getAddGracePeriodLength());
|
||||||
assertLastHistoryContainsResource(domain);
|
assertLastHistoryContainsResource(domain);
|
||||||
DomainHistory historyEntry = getHistoryEntries(domain, DomainHistory.class).get(0);
|
DomainHistory historyEntry = getHistoryEntries(domain, DomainHistory.class).get(0);
|
||||||
assertAboutDomains()
|
assertAboutDomains()
|
||||||
|
@ -818,7 +818,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
setEppInput("domain_create_premium_eap.xml");
|
setEppInput("domain_create_premium_eap.xml");
|
||||||
persistContactsAndHosts("net");
|
persistContactsAndHosts("net");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("example")
|
Tld.get("example")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setEapFeeSchedule(
|
.setEapFeeSchedule(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
@ -851,10 +851,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_nonDefaultAddGracePeriod() throws Exception {
|
void testSuccess_nonDefaultAddGracePeriod() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld").asBuilder().setAddGracePeriodLength(Duration.standardMinutes(6)).build());
|
||||||
.asBuilder()
|
|
||||||
.setAddGracePeriodLength(Duration.standardMinutes(6))
|
|
||||||
.build());
|
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
doSuccessfulTest();
|
doSuccessfulTest();
|
||||||
}
|
}
|
||||||
|
@ -956,7 +953,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setTokenType(SINGLE_USE)
|
.setTokenType(SINGLE_USE)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(
|
.setTldStateTransitions(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
@ -980,7 +977,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
void testSuccess_noClaimsNotice_forClaimsListName_afterClaimsPeriodEnd() throws Exception {
|
void testSuccess_noClaimsNotice_forClaimsListName_afterClaimsPeriodEnd() throws Exception {
|
||||||
persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY));
|
persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY));
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
persistResource(Registry.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
|
persistResource(Tld.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
|
||||||
runFlowAssertResponse(
|
runFlowAssertResponse(
|
||||||
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
|
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
|
||||||
assertSuccessfulCreate("tld", ImmutableSet.of());
|
assertSuccessfulCreate("tld", ImmutableSet.of());
|
||||||
|
@ -1009,7 +1006,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
setEppInput("domain_create_claim_notice.xml");
|
setEppInput("domain_create_claim_notice.xml");
|
||||||
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
|
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
persistResource(Registry.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
|
persistResource(Tld.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
|
||||||
EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
|
EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
@ -1065,8 +1062,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testFailure_wrongFeeAmount_v06() {
|
void testFailure_wrongFeeAmount_v06() {
|
||||||
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.6", "CURRENCY", "USD"));
|
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.6", "CURRENCY", "USD"));
|
||||||
persistResource(
|
persistResource(Tld.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
|
||||||
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
|
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
|
@ -1084,7 +1080,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setDiscountFraction(0.5)
|
.setDiscountFraction(0.5)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||||
.setCreateBillingCost(Money.of(USD, 8))
|
.setCreateBillingCost(Money.of(USD, 8))
|
||||||
|
@ -1111,7 +1107,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setDiscountFraction(0.5)
|
.setDiscountFraction(0.5)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||||
.setCreateBillingCost(Money.of(USD, 100))
|
.setCreateBillingCost(Money.of(USD, 100))
|
||||||
|
@ -1126,8 +1122,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testFailure_wrongFeeAmount_v11() {
|
void testFailure_wrongFeeAmount_v11() {
|
||||||
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11", "CURRENCY", "USD"));
|
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11", "CURRENCY", "USD"));
|
||||||
persistResource(
|
persistResource(Tld.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
|
||||||
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
|
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
|
@ -1145,7 +1140,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setDiscountFraction(0.5)
|
.setDiscountFraction(0.5)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||||
.setCreateBillingCost(Money.of(USD, 8))
|
.setCreateBillingCost(Money.of(USD, 8))
|
||||||
|
@ -1172,7 +1167,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setDiscountFraction(0.5)
|
.setDiscountFraction(0.5)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||||
.setCreateBillingCost(Money.of(USD, 100))
|
.setCreateBillingCost(Money.of(USD, 100))
|
||||||
|
@ -1187,8 +1182,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testFailure_wrongFeeAmount_v12() {
|
void testFailure_wrongFeeAmount_v12() {
|
||||||
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.12", "CURRENCY", "USD"));
|
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.12", "CURRENCY", "USD"));
|
||||||
persistResource(
|
persistResource(Tld.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
|
||||||
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
|
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
|
@ -1206,7 +1200,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setDiscountFraction(0.5)
|
.setDiscountFraction(0.5)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||||
.setCreateBillingCost(Money.of(USD, 8))
|
.setCreateBillingCost(Money.of(USD, 8))
|
||||||
|
@ -1233,7 +1227,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setDiscountFraction(0.5)
|
.setDiscountFraction(0.5)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||||
.setCreateBillingCost(Money.of(USD, 100))
|
.setCreateBillingCost(Money.of(USD, 100))
|
||||||
|
@ -1377,7 +1371,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setTokenType(SINGLE_USE)
|
.setTokenType(SINGLE_USE)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(
|
.setReservedLists(
|
||||||
persistReservedList("anchor-with-claims", "example-one,RESERVED_FOR_ANCHOR_TENANT"))
|
persistReservedList("anchor-with-claims", "example-one,RESERVED_FOR_ANCHOR_TENANT"))
|
||||||
|
@ -1447,7 +1441,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setTokenType(SINGLE_USE)
|
.setTokenType(SINGLE_USE)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(
|
.setReservedLists(
|
||||||
persistReservedList("anchor_tenants", "test-validate,RESERVED_FOR_ANCHOR_TENANT"))
|
persistReservedList("anchor_tenants", "test-validate,RESERVED_FOR_ANCHOR_TENANT"))
|
||||||
|
@ -1475,7 +1469,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_anchorTenant_duringQuietPeriodBeforeSunrise() throws Exception {
|
void testSuccess_anchorTenant_duringQuietPeriodBeforeSunrise() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(
|
.setTldStateTransitions(
|
||||||
new ImmutableSortedMap.Builder<DateTime, TldState>(Ordering.natural())
|
new ImmutableSortedMap.Builder<DateTime, TldState>(Ordering.natural())
|
||||||
|
@ -1518,7 +1512,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_reservedDomain_viaAllocationTokenExtension_inQuietPeriod() throws Exception {
|
void testSuccess_reservedDomain_viaAllocationTokenExtension_inQuietPeriod() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1816,7 +1810,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||||
|
@ -1850,7 +1844,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||||
|
@ -1888,7 +1882,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||||
|
@ -1915,7 +1909,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||||
|
@ -1942,7 +1936,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||||
|
@ -1972,7 +1966,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||||
|
@ -2002,7 +1996,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||||
|
@ -2039,7 +2033,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
.build())
|
.build())
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||||
|
@ -2077,7 +2071,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
void testSuccess_reservedNameCollisionDomain_inSunrise_setsServerHoldAndPollMessage()
|
void testSuccess_reservedNameCollisionDomain_inSunrise_setsServerHoldAndPollMessage()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, START_DATE_SUNRISE))
|
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, START_DATE_SUNRISE))
|
||||||
.build());
|
.build());
|
||||||
|
@ -2772,7 +2766,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
void testFailure_missingBillingAccountMap() {
|
void testFailure_missingBillingAccountMap() {
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCurrency(JPY)
|
.setCurrency(JPY)
|
||||||
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
||||||
|
@ -2792,7 +2786,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
persistActiveContact("someone");
|
persistActiveContact("someone");
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAllowedRegistrantContactIds(ImmutableSet.of("someone"))
|
.setAllowedRegistrantContactIds(ImmutableSet.of("someone"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -2805,7 +2799,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
void testFailure_nameserverNotAllowListed() {
|
void testFailure_nameserverNotAllowListed() {
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -2818,7 +2812,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
void testFailure_emptyNameserverFailsAllowList() {
|
void testFailure_emptyNameserverFailsAllowList() {
|
||||||
setEppInput("domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"));
|
setEppInput("domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"));
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("somethingelse.example.net"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("somethingelse.example.net"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -2832,7 +2826,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_nameserverAndRegistrantAllowListed() throws Exception {
|
void testSuccess_nameserverAndRegistrantAllowListed() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAllowedRegistrantContactIds(ImmutableSet.of("jd1234"))
|
.setAllowedRegistrantContactIds(ImmutableSet.of("jd1234"))
|
||||||
.setAllowedFullyQualifiedHostNames(
|
.setAllowedFullyQualifiedHostNames(
|
||||||
|
@ -3024,7 +3018,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
|
|
||||||
private void setEapForTld(String tld) {
|
private void setEapForTld(String tld) {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get(tld)
|
Tld.get(tld)
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setEapFeeSchedule(
|
.setEapFeeSchedule(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
@ -3041,7 +3035,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
void testSuccess_eapFee_beforeEntireSchedule() throws Exception {
|
void testSuccess_eapFee_beforeEntireSchedule() throws Exception {
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setEapFeeSchedule(
|
.setEapFeeSchedule(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
@ -3059,7 +3053,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
void testSuccess_eapFee_afterEntireSchedule() throws Exception {
|
void testSuccess_eapFee_afterEntireSchedule() throws Exception {
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setEapFeeSchedule(
|
.setEapFeeSchedule(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
@ -3095,10 +3089,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
void testIcannTransactionRecord_getsStored() throws Exception {
|
void testIcannTransactionRecord_getsStored() throws Exception {
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld").asBuilder().setAddGracePeriodLength(Duration.standardMinutes(9)).build());
|
||||||
.asBuilder()
|
|
||||||
.setAddGracePeriodLength(Duration.standardMinutes(9))
|
|
||||||
.build());
|
|
||||||
runFlow();
|
runFlow();
|
||||||
Domain domain = reloadResourceByForeignKey();
|
Domain domain = reloadResourceByForeignKey();
|
||||||
DomainHistory historyEntry = (DomainHistory) getHistoryEntries(domain).get(0);
|
DomainHistory historyEntry = (DomainHistory) getHistoryEntries(domain).get(0);
|
||||||
|
@ -3114,7 +3105,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testIcannTransactionRecord_testTld_notStored() throws Exception {
|
void testIcannTransactionRecord_testTld_notStored() throws Exception {
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
persistResource(Registry.get("tld").asBuilder().setTldType(TldType.TEST).build());
|
persistResource(Tld.get("tld").asBuilder().setTldType(TldType.TEST).build());
|
||||||
runFlow();
|
runFlow();
|
||||||
Domain domain = reloadResourceByForeignKey();
|
Domain domain = reloadResourceByForeignKey();
|
||||||
DomainHistory historyEntry = (DomainHistory) getHistoryEntries(domain).get(0);
|
DomainHistory historyEntry = (DomainHistory) getHistoryEntries(domain).get(0);
|
||||||
|
@ -3267,7 +3258,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
"domain_create_allocationtoken.xml",
|
"domain_create_allocationtoken.xml",
|
||||||
ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "2"));
|
ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "2"));
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||||
.build());
|
.build());
|
||||||
|
@ -3289,7 +3280,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
"domain_create_allocationtoken.xml",
|
"domain_create_allocationtoken.xml",
|
||||||
ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "2"));
|
ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "2"));
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||||
.build());
|
.build());
|
||||||
|
@ -3306,7 +3297,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
"domain_create_allocationtoken.xml",
|
"domain_create_allocationtoken.xml",
|
||||||
ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "2"));
|
ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "2"));
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||||
.build());
|
.build());
|
||||||
|
@ -3325,7 +3316,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
// Trademarked domains using a bypass-tld-state token should fail if we're in a quiet period
|
// Trademarked domains using a bypass-tld-state token should fail if we're in a quiet period
|
||||||
// before the sunrise period
|
// before the sunrise period
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(
|
.setTldStateTransitions(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
@ -3348,7 +3339,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
// Trademarked domains using a bypass-tld-state token should succeed if we're in a quiet period
|
// Trademarked domains using a bypass-tld-state token should succeed if we're in a quiet period
|
||||||
// after the sunrise period
|
// after the sunrise period
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(
|
.setTldStateTransitions(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
@ -3496,7 +3487,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_anchorTenant_quietPeriodAfterSunrise_nonTrademarked_viaToken() throws Exception {
|
void testSuccess_anchorTenant_quietPeriodAfterSunrise_nonTrademarked_viaToken() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(
|
.setTldStateTransitions(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
@ -3527,7 +3518,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
void testSuccess_anchorTenant_quietPeriodAfterSunrise_trademarked_withClaims_viaToken()
|
void testSuccess_anchorTenant_quietPeriodAfterSunrise_trademarked_withClaims_viaToken()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(
|
.setTldStateTransitions(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
@ -3553,7 +3544,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testFailure_anchorTenant_quietPeriodAfterSunrise_trademarked_withoutClaims_viaToken() {
|
void testFailure_anchorTenant_quietPeriodAfterSunrise_trademarked_withoutClaims_viaToken() {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(
|
.setTldStateTransitions(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
|
|
@ -32,7 +32,7 @@ import static google.registry.model.reporting.DomainTransactionRecord.Transactio
|
||||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
|
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
|
||||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_DELETE;
|
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_DELETE;
|
||||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST;
|
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST;
|
||||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||||
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
|
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
|
||||||
import static google.registry.testing.DatabaseHelper.assertPollMessages;
|
import static google.registry.testing.DatabaseHelper.assertPollMessages;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
|
@ -93,8 +93,8 @@ import google.registry.model.poll.PendingActionNotificationResponse.DomainPendin
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.model.transfer.DomainTransferData;
|
import google.registry.model.transfer.DomainTransferData;
|
||||||
import google.registry.model.transfer.TransferResponse;
|
import google.registry.model.transfer.TransferResponse;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
|
@ -181,7 +181,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
|
|
||||||
private void setUpGracePeriodDurations() {
|
private void setUpGracePeriodDurations() {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAddGracePeriodLength(standardDays(3))
|
.setAddGracePeriodLength(standardDays(3))
|
||||||
.setRenewGracePeriodLength(standardDays(2))
|
.setRenewGracePeriodLength(standardDays(2))
|
||||||
|
@ -291,7 +291,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_asyncActionsAreEnqueued() throws Exception {
|
void testSuccess_asyncActionsAreEnqueued() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRedemptionGracePeriodLength(standardDays(3))
|
.setRedemptionGracePeriodLength(standardDays(3))
|
||||||
.setPendingDeleteLength(standardDays(2))
|
.setPendingDeleteLength(standardDays(2))
|
||||||
|
@ -365,7 +365,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_updatedEppUpdateTimeAfterPendingRedemption() throws Exception {
|
void testSuccess_updatedEppUpdateTimeAfterPendingRedemption() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRedemptionGracePeriodLength(standardDays(3))
|
.setRedemptionGracePeriodLength(standardDays(3))
|
||||||
.setPendingDeleteLength(standardDays(2))
|
.setPendingDeleteLength(standardDays(2))
|
||||||
|
@ -443,8 +443,8 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
.hasDeletionTime(
|
.hasDeletionTime(
|
||||||
clock
|
clock
|
||||||
.nowUtc()
|
.nowUtc()
|
||||||
.plus(Registry.get("tld").getRedemptionGracePeriodLength())
|
.plus(Tld.get("tld").getRedemptionGracePeriodLength())
|
||||||
.plus(Registry.get("tld").getPendingDeleteLength()))
|
.plus(Tld.get("tld").getPendingDeleteLength()))
|
||||||
.and()
|
.and()
|
||||||
.hasExactlyStatusValues(StatusValue.INACTIVE, StatusValue.PENDING_DELETE)
|
.hasExactlyStatusValues(StatusValue.INACTIVE, StatusValue.PENDING_DELETE)
|
||||||
.and()
|
.and()
|
||||||
|
@ -464,7 +464,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
GracePeriod.create(
|
GracePeriod.create(
|
||||||
GracePeriodStatus.REDEMPTION,
|
GracePeriodStatus.REDEMPTION,
|
||||||
domain.getRepoId(),
|
domain.getRepoId(),
|
||||||
clock.nowUtc().plus(Registry.get("tld").getRedemptionGracePeriodLength()),
|
clock.nowUtc().plus(Tld.get("tld").getRedemptionGracePeriodLength()),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
null,
|
null,
|
||||||
resource.getGracePeriods().iterator().next().getGracePeriodId()));
|
resource.getGracePeriods().iterator().next().getGracePeriodId()));
|
||||||
|
@ -531,7 +531,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
void testSuccess_nonDefaultRedemptionGracePeriod() throws Exception {
|
void testSuccess_nonDefaultRedemptionGracePeriod() throws Exception {
|
||||||
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
|
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRedemptionGracePeriodLength(Duration.standardMinutes(7))
|
.setRedemptionGracePeriodLength(Duration.standardMinutes(7))
|
||||||
.build());
|
.build());
|
||||||
|
@ -542,10 +542,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
void testSuccess_nonDefaultPendingDeleteLength() throws Exception {
|
void testSuccess_nonDefaultPendingDeleteLength() throws Exception {
|
||||||
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
|
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld").asBuilder().setPendingDeleteLength(Duration.standardMinutes(8)).build());
|
||||||
.asBuilder()
|
|
||||||
.setPendingDeleteLength(Duration.standardMinutes(8))
|
|
||||||
.build());
|
|
||||||
doSuccessfulTest_noAddGracePeriod("domain_delete_response_pending.xml");
|
doSuccessfulTest_noAddGracePeriod("domain_delete_response_pending.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,7 +575,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
removeServiceExtensionUri(ServiceExtension.FEE_0_11.getUri());
|
removeServiceExtensionUri(ServiceExtension.FEE_0_11.getUri());
|
||||||
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
|
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRenewBillingCostTransitions(
|
.setRenewBillingCostTransitions(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
@ -596,7 +593,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
void testSuccess_autoRenewGracePeriod_priceChanges_v11() throws Exception {
|
void testSuccess_autoRenewGracePeriod_priceChanges_v11() throws Exception {
|
||||||
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
|
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRenewBillingCostTransitions(
|
.setRenewBillingCostTransitions(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
@ -613,7 +610,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_autoRenewGracePeriod_priceChanges_v12() throws Exception {
|
void testSuccess_autoRenewGracePeriod_priceChanges_v12() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRenewBillingCostTransitions(
|
.setRenewBillingCostTransitions(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
@ -656,8 +653,8 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
.hasDeletionTime(
|
.hasDeletionTime(
|
||||||
clock
|
clock
|
||||||
.nowUtc()
|
.nowUtc()
|
||||||
.plus(Registry.get("tld").getRedemptionGracePeriodLength())
|
.plus(Tld.get("tld").getRedemptionGracePeriodLength())
|
||||||
.plus(Registry.get("tld").getPendingDeleteLength()))
|
.plus(Tld.get("tld").getPendingDeleteLength()))
|
||||||
.and()
|
.and()
|
||||||
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_DELETE);
|
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_DELETE);
|
||||||
// All existing grace periods should be gone, and a new REDEMPTION one should be added.
|
// All existing grace periods should be gone, and a new REDEMPTION one should be added.
|
||||||
|
@ -666,7 +663,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
GracePeriod.create(
|
GracePeriod.create(
|
||||||
GracePeriodStatus.REDEMPTION,
|
GracePeriodStatus.REDEMPTION,
|
||||||
domain.getRepoId(),
|
domain.getRepoId(),
|
||||||
clock.nowUtc().plus(Registry.get("tld").getRedemptionGracePeriodLength()),
|
clock.nowUtc().plus(Tld.get("tld").getRedemptionGracePeriodLength()),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
null,
|
null,
|
||||||
domain.getGracePeriods().iterator().next().getGracePeriodId()));
|
domain.getGracePeriods().iterator().next().getGracePeriodId()));
|
||||||
|
@ -960,7 +957,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
void testIcannTransactionRecord_testTld_notStored() throws Exception {
|
void testIcannTransactionRecord_testTld_notStored() throws Exception {
|
||||||
setUpSuccessfulTest();
|
setUpSuccessfulTest();
|
||||||
setUpGracePeriodDurations();
|
setUpGracePeriodDurations();
|
||||||
persistResource(Registry.get("tld").asBuilder().setTldType(TldType.TEST).build());
|
persistResource(Tld.get("tld").asBuilder().setTldType(TldType.TEST).build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
earlierHistoryEntry =
|
earlierHistoryEntry =
|
||||||
persistResource(
|
persistResource(
|
||||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.flows.domain;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.checkHasBillingAccount;
|
import static google.registry.flows.domain.DomainFlowUtils.checkHasBillingAccount;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
import static google.registry.testing.DatabaseHelper.newTld;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||||
|
@ -38,7 +38,7 @@ import google.registry.flows.domain.DomainFlowUtils.MissingBillingAccountMapExce
|
||||||
import google.registry.flows.domain.DomainFlowUtils.TldDoesNotExistException;
|
import google.registry.flows.domain.DomainFlowUtils.TldDoesNotExistException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.TrailingDashException;
|
import google.registry.flows.domain.DomainFlowUtils.TrailingDashException;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.tld.Registry.TldType;
|
import google.registry.model.tld.Tld.TldType;
|
||||||
import google.registry.persistence.transaction.JpaTransactionManagerExtension;
|
import google.registry.persistence.transaction.JpaTransactionManagerExtension;
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
@ -182,7 +182,7 @@ class DomainFlowUtilsTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||||
|
|
||||||
private void persistFoobarTld(TldType tldType) {
|
private void persistFoobarTld(TldType tldType) {
|
||||||
persistResource(
|
persistResource(
|
||||||
newRegistry("foobar", "FOOBAR")
|
newTld("foobar", "FOOBAR")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldType(tldType)
|
.setTldType(tldType)
|
||||||
.setCurrency(CHF)
|
.setCurrency(CHF)
|
||||||
|
|
|
@ -20,7 +20,7 @@ import static google.registry.model.billing.BillingEvent.RenewalPriceBehavior.DE
|
||||||
import static google.registry.model.billing.BillingEvent.RenewalPriceBehavior.NONPREMIUM;
|
import static google.registry.model.billing.BillingEvent.RenewalPriceBehavior.NONPREMIUM;
|
||||||
import static google.registry.model.billing.BillingEvent.RenewalPriceBehavior.SPECIFIED;
|
import static google.registry.model.billing.BillingEvent.RenewalPriceBehavior.SPECIFIED;
|
||||||
import static google.registry.model.eppcommon.EppXmlTransformer.marshal;
|
import static google.registry.model.eppcommon.EppXmlTransformer.marshal;
|
||||||
import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD;
|
import static google.registry.model.tld.Tld.TldState.QUIET_PERIOD;
|
||||||
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveContact;
|
import static google.registry.testing.DatabaseHelper.persistActiveContact;
|
||||||
|
@ -72,7 +72,7 @@ import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppoutput.EppOutput;
|
import google.registry.model.eppoutput.EppOutput;
|
||||||
import google.registry.model.host.Host;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.persistence.transaction.JpaTransactionManagerExtension;
|
import google.registry.persistence.transaction.JpaTransactionManagerExtension;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
|
@ -322,7 +322,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_inQuietPeriod() throws Exception {
|
void testSuccess_inQuietPeriod() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||||
.build());
|
.build());
|
||||||
|
@ -853,7 +853,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||||
void testFeeExtension_renewCommandPremium_anchorTenant() throws Exception {
|
void testFeeExtension_renewCommandPremium_anchorTenant() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "example,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "example,USD 70"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -873,7 +873,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||||
void testFeeExtension_renewCommandPremium_internalRegistration() throws Exception {
|
void testFeeExtension_renewCommandPremium_internalRegistration() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "example,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "example,USD 70"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -893,7 +893,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||||
void testFeeExtension_renewCommandPremium_anchorTenant_multiYear() throws Exception {
|
void testFeeExtension_renewCommandPremium_anchorTenant_multiYear() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "example,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "example,USD 70"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -913,7 +913,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||||
void testFeeExtension_renewCommandPremium_internalRegistration_multiYear() throws Exception {
|
void testFeeExtension_renewCommandPremium_internalRegistration_multiYear() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "example,USD 70"))
|
.setPremiumList(persistPremiumList("tld", USD, "example,USD 70"))
|
||||||
.build());
|
.build());
|
||||||
|
|
|
@ -49,7 +49,7 @@ import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.domain.fee.Fee;
|
import google.registry.model.domain.fee.Fee;
|
||||||
import google.registry.model.domain.token.AllocationToken;
|
import google.registry.model.domain.token.AllocationToken;
|
||||||
import google.registry.model.eppinput.EppInput;
|
import google.registry.model.eppinput.EppInput;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
|
@ -77,7 +77,7 @@ public class DomainPricingLogicTest {
|
||||||
@Mock EppInput eppInput;
|
@Mock EppInput eppInput;
|
||||||
SessionMetadata sessionMetadata;
|
SessionMetadata sessionMetadata;
|
||||||
@Mock FlowMetadata flowMetadata;
|
@Mock FlowMetadata flowMetadata;
|
||||||
Registry registry;
|
Tld registry;
|
||||||
Domain domain;
|
Domain domain;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
|
@ -89,7 +89,7 @@ public class DomainPricingLogicTest {
|
||||||
new DomainPricingCustomLogic(eppInput, sessionMetadata, flowMetadata));
|
new DomainPricingCustomLogic(eppInput, sessionMetadata, flowMetadata));
|
||||||
registry =
|
registry =
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("example")
|
Tld.get("example")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRenewBillingCostTransitions(
|
.setRenewBillingCostTransitions(
|
||||||
ImmutableSortedMap.of(
|
ImmutableSortedMap.of(
|
||||||
|
|
|
@ -99,7 +99,7 @@ import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -281,7 +281,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
.setCost(totalRenewCost)
|
.setCost(totalRenewCost)
|
||||||
.setPeriodYears(renewalYears)
|
.setPeriodYears(renewalYears)
|
||||||
.setEventTime(clock.nowUtc())
|
.setEventTime(clock.nowUtc())
|
||||||
.setBillingTime(clock.nowUtc().plus(Registry.get("tld").getRenewGracePeriodLength()))
|
.setBillingTime(clock.nowUtc().plus(Tld.get("tld").getRenewGracePeriodLength()))
|
||||||
.setDomainHistory(historyEntryDomainRenew)
|
.setDomainHistory(historyEntryDomainRenew)
|
||||||
.build();
|
.build();
|
||||||
assertBillingEvents(
|
assertBillingEvents(
|
||||||
|
@ -327,7 +327,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
GracePeriod.create(
|
GracePeriod.create(
|
||||||
GracePeriodStatus.RENEW,
|
GracePeriodStatus.RENEW,
|
||||||
domain.getRepoId(),
|
domain.getRepoId(),
|
||||||
clock.nowUtc().plus(Registry.get("tld").getRenewGracePeriodLength()),
|
clock.nowUtc().plus(Tld.get("tld").getRenewGracePeriodLength()),
|
||||||
renewalClientId,
|
renewalClientId,
|
||||||
null),
|
null),
|
||||||
renewBillingEvent));
|
renewBillingEvent));
|
||||||
|
@ -397,7 +397,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_internalRegiration_premiumDomain() throws Exception {
|
void testSuccess_internalRegiration_premiumDomain() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "example,USD 100"))
|
.setPremiumList(persistPremiumList("tld", USD, "example,USD 100"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -434,7 +434,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_anchorTenant_premiumDomain() throws Exception {
|
void testSuccess_anchorTenant_premiumDomain() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPremiumList(persistPremiumList("tld", USD, "example,USD 100"))
|
.setPremiumList(persistPremiumList("tld", USD, "example,USD 100"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -842,10 +842,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_nonDefaultRenewGracePeriod() throws Exception {
|
void testSuccess_nonDefaultRenewGracePeriod() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld").asBuilder().setRenewGracePeriodLength(Duration.standardMinutes(9)).build());
|
||||||
.asBuilder()
|
|
||||||
.setRenewGracePeriodLength(Duration.standardMinutes(9))
|
|
||||||
.build());
|
|
||||||
persistDomain();
|
persistDomain();
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_renew_response.xml",
|
"domain_renew_response.xml",
|
||||||
|
@ -994,7 +991,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
void testFailure_wrongFeeAmount_v06() throws Exception {
|
void testFailure_wrongFeeAmount_v06() throws Exception {
|
||||||
setEppInput("domain_renew_fee.xml", FEE_06_MAP);
|
setEppInput("domain_renew_fee.xml", FEE_06_MAP);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1007,7 +1004,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
void testFailure_wrongFeeAmount_v11() throws Exception {
|
void testFailure_wrongFeeAmount_v11() throws Exception {
|
||||||
setEppInput("domain_renew_fee.xml", FEE_11_MAP);
|
setEppInput("domain_renew_fee.xml", FEE_11_MAP);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1020,7 +1017,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
void testFailure_wrongFeeAmount_v12() throws Exception {
|
void testFailure_wrongFeeAmount_v12() throws Exception {
|
||||||
setEppInput("domain_renew_fee.xml", FEE_12_MAP);
|
setEppInput("domain_renew_fee.xml", FEE_12_MAP);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1033,7 +1030,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
void testFailure_wrongCurrency_v06() throws Exception {
|
void testFailure_wrongCurrency_v06() throws Exception {
|
||||||
setEppInput("domain_renew_fee.xml", FEE_06_MAP);
|
setEppInput("domain_renew_fee.xml", FEE_06_MAP);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCurrency(EUR)
|
.setCurrency(EUR)
|
||||||
.setCreateBillingCost(Money.of(EUR, 13))
|
.setCreateBillingCost(Money.of(EUR, 13))
|
||||||
|
@ -1052,7 +1049,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
void testFailure_wrongCurrency_v11() throws Exception {
|
void testFailure_wrongCurrency_v11() throws Exception {
|
||||||
setEppInput("domain_renew_fee.xml", FEE_11_MAP);
|
setEppInput("domain_renew_fee.xml", FEE_11_MAP);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCurrency(EUR)
|
.setCurrency(EUR)
|
||||||
.setCreateBillingCost(Money.of(EUR, 13))
|
.setCreateBillingCost(Money.of(EUR, 13))
|
||||||
|
@ -1071,7 +1068,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
void testFailure_wrongCurrency_v12() throws Exception {
|
void testFailure_wrongCurrency_v12() throws Exception {
|
||||||
setEppInput("domain_renew_fee.xml", FEE_12_MAP);
|
setEppInput("domain_renew_fee.xml", FEE_12_MAP);
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCurrency(EUR)
|
.setCurrency(EUR)
|
||||||
.setCreateBillingCost(Money.of(EUR, 13))
|
.setCreateBillingCost(Money.of(EUR, 13))
|
||||||
|
@ -1114,7 +1111,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
void testFailure_missingBillingAccountMap() throws Exception {
|
void testFailure_missingBillingAccountMap() throws Exception {
|
||||||
persistDomain();
|
persistDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCurrency(JPY)
|
.setCurrency(JPY)
|
||||||
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
||||||
|
@ -1236,10 +1233,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
persistDomain();
|
persistDomain();
|
||||||
// Test with a nonstandard Renew period to ensure the reporting time is correct regardless
|
// Test with a nonstandard Renew period to ensure the reporting time is correct regardless
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld").asBuilder().setRenewGracePeriodLength(Duration.standardMinutes(9)).build());
|
||||||
.asBuilder()
|
|
||||||
.setRenewGracePeriodLength(Duration.standardMinutes(9))
|
|
||||||
.build());
|
|
||||||
runFlow();
|
runFlow();
|
||||||
Domain domain = reloadResourceByForeignKey();
|
Domain domain = reloadResourceByForeignKey();
|
||||||
DomainHistory historyEntry =
|
DomainHistory historyEntry =
|
||||||
|
@ -1401,7 +1395,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||||
|
@ -1452,7 +1446,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||||
|
@ -1495,7 +1489,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||||
|
@ -1544,7 +1538,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(
|
ImmutableList.of(
|
||||||
|
@ -1588,7 +1582,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(
|
.setDefaultPromoTokens(
|
||||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||||
|
@ -1621,7 +1615,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1659,7 +1653,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
||||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||||
|
@ -1682,7 +1676,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1720,7 +1714,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
||||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||||
|
@ -1743,7 +1737,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1781,7 +1775,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
||||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||||
|
|
|
@ -72,7 +72,7 @@ import google.registry.model.registrar.Registrar.State;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -469,7 +469,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_superuserOverridesReservedList() throws Exception {
|
void testSuccess_superuserOverridesReservedList() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED"))
|
.setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -529,8 +529,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||||
void testFailure_wrongFeeAmount_v06() throws Exception {
|
void testFailure_wrongFeeAmount_v06() throws Exception {
|
||||||
setEppInput("domain_update_restore_request_fee.xml", FEE_06_MAP);
|
setEppInput("domain_update_restore_request_fee.xml", FEE_06_MAP);
|
||||||
persistPendingDeleteDomain();
|
persistPendingDeleteDomain();
|
||||||
persistResource(
|
persistResource(Tld.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
||||||
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
|
||||||
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
@ -539,8 +538,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||||
void testFailure_wrongFeeAmount_v11() throws Exception {
|
void testFailure_wrongFeeAmount_v11() throws Exception {
|
||||||
setEppInput("domain_update_restore_request_fee.xml", FEE_11_MAP);
|
setEppInput("domain_update_restore_request_fee.xml", FEE_11_MAP);
|
||||||
persistPendingDeleteDomain();
|
persistPendingDeleteDomain();
|
||||||
persistResource(
|
persistResource(Tld.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
||||||
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
|
||||||
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
@ -549,8 +547,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||||
void testFailure_wrongFeeAmount_v12() throws Exception {
|
void testFailure_wrongFeeAmount_v12() throws Exception {
|
||||||
setEppInput("domain_update_restore_request_fee.xml", FEE_12_MAP);
|
setEppInput("domain_update_restore_request_fee.xml", FEE_12_MAP);
|
||||||
persistPendingDeleteDomain();
|
persistPendingDeleteDomain();
|
||||||
persistResource(
|
persistResource(Tld.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
||||||
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
|
||||||
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
@ -559,7 +556,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||||
setEppInput("domain_update_restore_request_fee.xml", substitutions);
|
setEppInput("domain_update_restore_request_fee.xml", substitutions);
|
||||||
persistPendingDeleteDomain();
|
persistPendingDeleteDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCurrency(EUR)
|
.setCurrency(EUR)
|
||||||
.setCreateBillingCost(Money.of(EUR, 13))
|
.setCreateBillingCost(Money.of(EUR, 13))
|
||||||
|
@ -702,7 +699,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||||
void testFailure_missingBillingAccount() throws Exception {
|
void testFailure_missingBillingAccount() throws Exception {
|
||||||
persistPendingDeleteDomain();
|
persistPendingDeleteDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCurrency(JPY)
|
.setCurrency(JPY)
|
||||||
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
||||||
|
@ -741,7 +738,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||||
void testFailure_reservedBlocked() throws Exception {
|
void testFailure_reservedBlocked() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED"))
|
.setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED"))
|
||||||
.build());
|
.build());
|
||||||
|
|
|
@ -83,7 +83,7 @@ import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.label.PremiumList;
|
import google.registry.model.tld.label.PremiumList;
|
||||||
import google.registry.model.tld.label.PremiumListDao;
|
import google.registry.model.tld.label.PremiumListDao;
|
||||||
import google.registry.model.transfer.DomainTransferData;
|
import google.registry.model.transfer.DomainTransferData;
|
||||||
|
@ -114,7 +114,7 @@ class DomainTransferApproveFlowTest
|
||||||
// moment that the transfer is approved.
|
// moment that the transfer is approved.
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRenewBillingCostTransitions(
|
.setRenewBillingCostTransitions(
|
||||||
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
||||||
|
@ -185,7 +185,7 @@ class DomainTransferApproveFlowTest
|
||||||
DateTime expectedExpirationTime)
|
DateTime expectedExpirationTime)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
setEppLoader(commandFilename);
|
setEppLoader(commandFilename);
|
||||||
Registry registry = Registry.get(tld);
|
Tld registry = Tld.get(tld);
|
||||||
domain = reloadResourceByForeignKey();
|
domain = reloadResourceByForeignKey();
|
||||||
// Make sure the implicit billing event is there; it will be deleted by the flow.
|
// Make sure the implicit billing event is there; it will be deleted by the flow.
|
||||||
// We also expect to see autorenew events for the gaining and losing registrars.
|
// We also expect to see autorenew events for the gaining and losing registrars.
|
||||||
|
@ -271,7 +271,7 @@ class DomainTransferApproveFlowTest
|
||||||
int expectedYearsToCharge,
|
int expectedYearsToCharge,
|
||||||
BillingEvent.Cancellation.Builder... expectedCancellationBillingEvents)
|
BillingEvent.Cancellation.Builder... expectedCancellationBillingEvents)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
Registry registry = Registry.get(tld);
|
Tld registry = Tld.get(tld);
|
||||||
domain = reloadResourceByForeignKey();
|
domain = reloadResourceByForeignKey();
|
||||||
final DomainHistory historyEntryTransferApproved =
|
final DomainHistory historyEntryTransferApproved =
|
||||||
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_APPROVE, DomainHistory.class);
|
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_APPROVE, DomainHistory.class);
|
||||||
|
@ -471,7 +471,7 @@ class DomainTransferApproveFlowTest
|
||||||
// with the new transfer grace period in mind.
|
// with the new transfer grace period in mind.
|
||||||
createTld("net");
|
createTld("net");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("net")
|
Tld.get("net")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTransferGracePeriodLength(Duration.standardMinutes(10))
|
.setTransferGracePeriodLength(Duration.standardMinutes(10))
|
||||||
.build());
|
.build());
|
||||||
|
@ -515,8 +515,7 @@ class DomainTransferApproveFlowTest
|
||||||
.setTargetId("example.tld")
|
.setTargetId("example.tld")
|
||||||
.setRegistrarId("TheRegistrar")
|
.setRegistrarId("TheRegistrar")
|
||||||
.setEventTime(clock.nowUtc()) // The cancellation happens at the moment of transfer.
|
.setEventTime(clock.nowUtc()) // The cancellation happens at the moment of transfer.
|
||||||
.setBillingTime(
|
.setBillingTime(oldExpirationTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()))
|
||||||
oldExpirationTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()))
|
|
||||||
.setRecurringEventKey(domain.getAutorenewBillingEvent()));
|
.setRecurringEventKey(domain.getAutorenewBillingEvent()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +528,7 @@ class DomainTransferApproveFlowTest
|
||||||
.setName("tld")
|
.setName("tld")
|
||||||
.setLabelsToPrices(ImmutableMap.of("example", new BigDecimal("67.89")))
|
.setLabelsToPrices(ImmutableMap.of("example", new BigDecimal("67.89")))
|
||||||
.build());
|
.build());
|
||||||
persistResource(Registry.get("tld").asBuilder().setPremiumList(pl).build());
|
persistResource(Tld.get("tld").asBuilder().setPremiumList(pl).build());
|
||||||
domain = loadByEntity(domain);
|
domain = loadByEntity(domain);
|
||||||
persistResource(
|
persistResource(
|
||||||
loadByKey(domain.getAutorenewBillingEvent())
|
loadByKey(domain.getAutorenewBillingEvent())
|
||||||
|
@ -575,7 +574,7 @@ class DomainTransferApproveFlowTest
|
||||||
.setName("tld")
|
.setName("tld")
|
||||||
.setLabelsToPrices(ImmutableMap.of("example", new BigDecimal("67.89")))
|
.setLabelsToPrices(ImmutableMap.of("example", new BigDecimal("67.89")))
|
||||||
.build());
|
.build());
|
||||||
persistResource(Registry.get("tld").asBuilder().setPremiumList(pl).build());
|
persistResource(Tld.get("tld").asBuilder().setPremiumList(pl).build());
|
||||||
domain = loadByEntity(domain);
|
domain = loadByEntity(domain);
|
||||||
persistResource(
|
persistResource(
|
||||||
loadByKey(domain.getAutorenewBillingEvent())
|
loadByKey(domain.getAutorenewBillingEvent())
|
||||||
|
@ -773,7 +772,7 @@ class DomainTransferApproveFlowTest
|
||||||
|
|
||||||
private void setUpGracePeriodDurations() {
|
private void setUpGracePeriodDurations() {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAutomaticTransferLength(Duration.standardDays(2))
|
.setAutomaticTransferLength(Duration.standardDays(2))
|
||||||
.setTransferGracePeriodLength(Duration.standardDays(3))
|
.setTransferGracePeriodLength(Duration.standardDays(3))
|
||||||
|
@ -863,7 +862,7 @@ class DomainTransferApproveFlowTest
|
||||||
GracePeriod.createForRecurring(
|
GracePeriod.createForRecurring(
|
||||||
GracePeriodStatus.AUTO_RENEW,
|
GracePeriodStatus.AUTO_RENEW,
|
||||||
domain.getRepoId(),
|
domain.getRepoId(),
|
||||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
autorenewTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
existingAutorenewEvent))
|
existingAutorenewEvent))
|
||||||
.build());
|
.build());
|
||||||
|
|
|
@ -52,7 +52,7 @@ import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.DomainTransferData;
|
import google.registry.model.transfer.DomainTransferData;
|
||||||
import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
|
import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
|
@ -391,7 +391,7 @@ class DomainTransferCancelFlowTest
|
||||||
void testIcannTransactionRecord_cancelsPreviousRecords() throws Exception {
|
void testIcannTransactionRecord_cancelsPreviousRecords() throws Exception {
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAutomaticTransferLength(Duration.standardDays(2))
|
.setAutomaticTransferLength(Duration.standardDays(2))
|
||||||
.setTransferGracePeriodLength(Duration.standardDays(3))
|
.setTransferGracePeriodLength(Duration.standardDays(3))
|
||||||
|
|
|
@ -41,7 +41,7 @@ import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.Host;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.TransferData;
|
import google.registry.model.transfer.TransferData;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import google.registry.persistence.transaction.JpaTransactionManagerExtension;
|
import google.registry.persistence.transaction.JpaTransactionManagerExtension;
|
||||||
|
@ -63,7 +63,7 @@ abstract class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
|
||||||
|
|
||||||
static final DateTime TRANSFER_REQUEST_TIME = DateTime.parse("2000-06-06T22:00:00.0Z");
|
static final DateTime TRANSFER_REQUEST_TIME = DateTime.parse("2000-06-06T22:00:00.0Z");
|
||||||
static final DateTime TRANSFER_EXPIRATION_TIME =
|
static final DateTime TRANSFER_EXPIRATION_TIME =
|
||||||
TRANSFER_REQUEST_TIME.plus(Registry.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
TRANSFER_REQUEST_TIME.plus(Tld.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||||
private static final Duration TIME_SINCE_REQUEST = Duration.standardDays(3);
|
private static final Duration TIME_SINCE_REQUEST = Duration.standardDays(3);
|
||||||
private static final int EXTENDED_REGISTRATION_YEARS = 1;
|
private static final int EXTENDED_REGISTRATION_YEARS = 1;
|
||||||
private static final DateTime REGISTRATION_EXPIRATION_TIME =
|
private static final DateTime REGISTRATION_EXPIRATION_TIME =
|
||||||
|
@ -77,7 +77,7 @@ abstract class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
|
||||||
private DomainHistory historyEntryDomainCreate;
|
private DomainHistory historyEntryDomainCreate;
|
||||||
|
|
||||||
DomainTransferFlowTestCase() {
|
DomainTransferFlowTestCase() {
|
||||||
checkState(!Registry.DEFAULT_TRANSFER_GRACE_PERIOD.isShorterThan(TIME_SINCE_REQUEST));
|
checkState(!Tld.DEFAULT_TRANSFER_GRACE_PERIOD.isShorterThan(TIME_SINCE_REQUEST));
|
||||||
clock.setTo(TRANSFER_REQUEST_TIME.plus(TIME_SINCE_REQUEST));
|
clock.setTo(TRANSFER_REQUEST_TIME.plus(TIME_SINCE_REQUEST));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ import google.registry.model.poll.PendingActionNotificationResponse;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.transfer.TransferData;
|
import google.registry.model.transfer.TransferData;
|
||||||
import google.registry.model.transfer.TransferResponse;
|
import google.registry.model.transfer.TransferResponse;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
|
@ -343,7 +343,7 @@ class DomainTransferRejectFlowTest
|
||||||
|
|
||||||
private void setUpGracePeriodDurations() {
|
private void setUpGracePeriodDurations() {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAutomaticTransferLength(Duration.standardDays(2))
|
.setAutomaticTransferLength(Duration.standardDays(2))
|
||||||
.setTransferGracePeriodLength(Duration.standardDays(3))
|
.setTransferGracePeriodLength(Duration.standardDays(3))
|
||||||
|
|
|
@ -27,7 +27,7 @@ import static google.registry.model.domain.token.AllocationToken.TokenType.UNLIM
|
||||||
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.TRANSFER_SUCCESSFUL;
|
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.TRANSFER_SUCCESSFUL;
|
||||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
|
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
|
||||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST;
|
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST;
|
||||||
import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD;
|
import static google.registry.model.tld.Tld.TldState.QUIET_PERIOD;
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
|
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
|
||||||
import static google.registry.testing.DatabaseHelper.assertBillingEventsEqual;
|
import static google.registry.testing.DatabaseHelper.assertBillingEventsEqual;
|
||||||
|
@ -115,7 +115,7 @@ import google.registry.model.registrar.Registrar.State;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.model.tld.label.PremiumList;
|
import google.registry.model.tld.label.PremiumList;
|
||||||
import google.registry.model.tld.label.PremiumListDao;
|
import google.registry.model.tld.label.PremiumListDao;
|
||||||
import google.registry.model.transfer.DomainTransferData;
|
import google.registry.model.transfer.DomainTransferData;
|
||||||
|
@ -259,7 +259,7 @@ class DomainTransferRequestFlowTest
|
||||||
ImmutableSet<GracePeriod> originalGracePeriods,
|
ImmutableSet<GracePeriod> originalGracePeriods,
|
||||||
boolean expectTransferBillingEvent,
|
boolean expectTransferBillingEvent,
|
||||||
BillingEvent.Cancellation.Builder... extraExpectedBillingEvents) {
|
BillingEvent.Cancellation.Builder... extraExpectedBillingEvents) {
|
||||||
Registry registry = Registry.get(domain.getTld());
|
Tld registry = Tld.get(domain.getTld());
|
||||||
final DomainHistory historyEntryTransferRequest =
|
final DomainHistory historyEntryTransferRequest =
|
||||||
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REQUEST, DomainHistory.class);
|
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REQUEST, DomainHistory.class);
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ class DomainTransferRequestFlowTest
|
||||||
private void assertAboutDomainAfterAutomaticTransfer(
|
private void assertAboutDomainAfterAutomaticTransfer(
|
||||||
DateTime expectedExpirationTime, DateTime implicitTransferTime, Period expectedPeriod)
|
DateTime expectedExpirationTime, DateTime implicitTransferTime, Period expectedPeriod)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
Registry registry = Registry.get(domain.getTld());
|
Tld registry = Tld.get(domain.getTld());
|
||||||
Domain domainAfterAutomaticTransfer = domain.cloneProjectedAtTime(implicitTransferTime);
|
Domain domainAfterAutomaticTransfer = domain.cloneProjectedAtTime(implicitTransferTime);
|
||||||
assertTransferApproved(domainAfterAutomaticTransfer, implicitTransferTime, expectedPeriod);
|
assertTransferApproved(domainAfterAutomaticTransfer, implicitTransferTime, expectedPeriod);
|
||||||
assertAboutDomains()
|
assertAboutDomains()
|
||||||
|
@ -477,7 +477,7 @@ class DomainTransferRequestFlowTest
|
||||||
// For all of the other transfer flow tests, 'now' corresponds to day 3 of the transfer, but
|
// For all of the other transfer flow tests, 'now' corresponds to day 3 of the transfer, but
|
||||||
// for the request test we want that same 'now' to be the initial request time, so we shift
|
// for the request test we want that same 'now' to be the initial request time, so we shift
|
||||||
// the transfer timeline 3 days later by adjusting the implicit transfer time here.
|
// the transfer timeline 3 days later by adjusting the implicit transfer time here.
|
||||||
Registry registry = Registry.get(domain.getTld());
|
Tld registry = Tld.get(domain.getTld());
|
||||||
DateTime implicitTransferTime = clock.nowUtc().plus(registry.getAutomaticTransferLength());
|
DateTime implicitTransferTime = clock.nowUtc().plus(registry.getAutomaticTransferLength());
|
||||||
// Setup done; run the test.
|
// Setup done; run the test.
|
||||||
assertTransactionalFlow(true);
|
assertTransactionalFlow(true);
|
||||||
|
@ -845,7 +845,7 @@ class DomainTransferRequestFlowTest
|
||||||
void testSuccess_nonDefaultAutomaticTransferLength() throws Exception {
|
void testSuccess_nonDefaultAutomaticTransferLength() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAutomaticTransferLength(Duration.standardMinutes(15))
|
.setAutomaticTransferLength(Duration.standardMinutes(15))
|
||||||
.build());
|
.build());
|
||||||
|
@ -857,7 +857,7 @@ class DomainTransferRequestFlowTest
|
||||||
void testSuccess_nonDefaultTransferGracePeriod() throws Exception {
|
void testSuccess_nonDefaultTransferGracePeriod() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTransferGracePeriodLength(Duration.standardMinutes(5))
|
.setTransferGracePeriodLength(Duration.standardMinutes(5))
|
||||||
.build());
|
.build());
|
||||||
|
@ -888,7 +888,7 @@ class DomainTransferRequestFlowTest
|
||||||
void testSuccess_inQuietPeriod() throws Exception {
|
void testSuccess_inQuietPeriod() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||||
.build());
|
.build());
|
||||||
|
@ -966,7 +966,7 @@ class DomainTransferRequestFlowTest
|
||||||
GracePeriod.createForRecurring(
|
GracePeriod.createForRecurring(
|
||||||
GracePeriodStatus.AUTO_RENEW,
|
GracePeriodStatus.AUTO_RENEW,
|
||||||
domain.getRepoId(),
|
domain.getRepoId(),
|
||||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
autorenewTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
existingAutorenewEvent))
|
existingAutorenewEvent))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1023,7 +1023,7 @@ class DomainTransferRequestFlowTest
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_request.xml",
|
"domain_transfer_request.xml",
|
||||||
"domain_transfer_request_response_10_year_cap.xml",
|
"domain_transfer_request_response_10_year_cap.xml",
|
||||||
clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength()).plusYears(10));
|
clock.nowUtc().plus(Tld.get("tld").getAutomaticTransferLength()).plusYears(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1070,7 +1070,7 @@ class DomainTransferRequestFlowTest
|
||||||
void testFailure_missingBillingAccount() {
|
void testFailure_missingBillingAccount() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCurrency(JPY)
|
.setCurrency(JPY)
|
||||||
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
||||||
|
@ -1106,7 +1106,7 @@ class DomainTransferRequestFlowTest
|
||||||
// Set the domain to have auto-renewed long enough ago that it is still in the autorenew grace
|
// Set the domain to have auto-renewed long enough ago that it is still in the autorenew grace
|
||||||
// period at the transfer request time, but will have exited it by the automatic transfer time.
|
// period at the transfer request time, but will have exited it by the automatic transfer time.
|
||||||
DateTime autorenewTime =
|
DateTime autorenewTime =
|
||||||
clock.nowUtc().minus(Registry.get("tld").getAutoRenewGracePeriodLength()).plusDays(1);
|
clock.nowUtc().minus(Tld.get("tld").getAutoRenewGracePeriodLength()).plusDays(1);
|
||||||
DateTime expirationTime = autorenewTime.plusYears(1);
|
DateTime expirationTime = autorenewTime.plusYears(1);
|
||||||
domain =
|
domain =
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -1117,7 +1117,7 @@ class DomainTransferRequestFlowTest
|
||||||
GracePeriod.createForRecurring(
|
GracePeriod.createForRecurring(
|
||||||
GracePeriodStatus.AUTO_RENEW,
|
GracePeriodStatus.AUTO_RENEW,
|
||||||
domain.getRepoId(),
|
domain.getRepoId(),
|
||||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
autorenewTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
domain.getAutorenewBillingEvent()))
|
domain.getAutorenewBillingEvent()))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1147,7 +1147,7 @@ class DomainTransferRequestFlowTest
|
||||||
GracePeriod.createForRecurring(
|
GracePeriod.createForRecurring(
|
||||||
GracePeriodStatus.AUTO_RENEW,
|
GracePeriodStatus.AUTO_RENEW,
|
||||||
domain.getRepoId(),
|
domain.getRepoId(),
|
||||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
autorenewTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
existingAutorenewEvent))
|
existingAutorenewEvent))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1163,8 +1163,8 @@ class DomainTransferRequestFlowTest
|
||||||
.setTargetId("example.tld")
|
.setTargetId("example.tld")
|
||||||
.setRegistrarId("TheRegistrar")
|
.setRegistrarId("TheRegistrar")
|
||||||
// The cancellation happens at the moment of transfer.
|
// The cancellation happens at the moment of transfer.
|
||||||
.setEventTime(clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength()))
|
.setEventTime(clock.nowUtc().plus(Tld.get("tld").getAutomaticTransferLength()))
|
||||||
.setBillingTime(autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()))
|
.setBillingTime(autorenewTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()))
|
||||||
// The cancellation should refer to the old autorenew billing event.
|
// The cancellation should refer to the old autorenew billing event.
|
||||||
.setRecurringEventKey(existingAutorenewEvent));
|
.setRecurringEventKey(existingAutorenewEvent));
|
||||||
}
|
}
|
||||||
|
@ -1190,9 +1190,8 @@ class DomainTransferRequestFlowTest
|
||||||
.setTargetId("example.tld")
|
.setTargetId("example.tld")
|
||||||
.setRegistrarId("TheRegistrar")
|
.setRegistrarId("TheRegistrar")
|
||||||
// The cancellation happens at the moment of transfer.
|
// The cancellation happens at the moment of transfer.
|
||||||
.setEventTime(clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength()))
|
.setEventTime(clock.nowUtc().plus(Tld.get("tld").getAutomaticTransferLength()))
|
||||||
.setBillingTime(
|
.setBillingTime(expirationTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()))
|
||||||
expirationTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()))
|
|
||||||
// The cancellation should refer to the old autorenew billing event.
|
// The cancellation should refer to the old autorenew billing event.
|
||||||
.setRecurringEventKey(existingAutorenewEvent));
|
.setRecurringEventKey(existingAutorenewEvent));
|
||||||
}
|
}
|
||||||
|
@ -1226,7 +1225,7 @@ class DomainTransferRequestFlowTest
|
||||||
.setName("tld")
|
.setName("tld")
|
||||||
.setLabelsToPrices(ImmutableMap.of("example", new BigDecimal("67.89")))
|
.setLabelsToPrices(ImmutableMap.of("example", new BigDecimal("67.89")))
|
||||||
.build());
|
.build());
|
||||||
persistResource(Registry.get("tld").asBuilder().setPremiumList(pl).build());
|
persistResource(Tld.get("tld").asBuilder().setPremiumList(pl).build());
|
||||||
domain = loadByEntity(domain);
|
domain = loadByEntity(domain);
|
||||||
persistResource(
|
persistResource(
|
||||||
loadByKey(domain.getAutorenewBillingEvent())
|
loadByKey(domain.getAutorenewBillingEvent())
|
||||||
|
@ -1281,7 +1280,7 @@ class DomainTransferRequestFlowTest
|
||||||
.setName("tld")
|
.setName("tld")
|
||||||
.setLabelsToPrices(ImmutableMap.of("example", new BigDecimal("67.89")))
|
.setLabelsToPrices(ImmutableMap.of("example", new BigDecimal("67.89")))
|
||||||
.build());
|
.build());
|
||||||
persistResource(Registry.get("tld").asBuilder().setPremiumList(pl).build());
|
persistResource(Tld.get("tld").asBuilder().setPremiumList(pl).build());
|
||||||
domain = loadByEntity(domain);
|
domain = loadByEntity(domain);
|
||||||
persistResource(
|
persistResource(
|
||||||
loadByKey(domain.getAutorenewBillingEvent())
|
loadByKey(domain.getAutorenewBillingEvent())
|
||||||
|
@ -1329,7 +1328,7 @@ class DomainTransferRequestFlowTest
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_specifiedRenewalPrice_notCarriedOverForPackageName() throws Exception {
|
void testSuccess_specifiedRenewalPrice_notCarriedOverForPackageName() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
persistResource(Registry.get("tld").asBuilder().build());
|
persistResource(Tld.get("tld").asBuilder().build());
|
||||||
domain = loadByEntity(domain);
|
domain = loadByEntity(domain);
|
||||||
persistResource(
|
persistResource(
|
||||||
loadByKey(domain.getAutorenewBillingEvent())
|
loadByKey(domain.getAutorenewBillingEvent())
|
||||||
|
@ -1388,7 +1387,7 @@ class DomainTransferRequestFlowTest
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_defaultRenewalPrice_carriedOverForPackageName() throws Exception {
|
void testSuccess_defaultRenewalPrice_carriedOverForPackageName() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
persistResource(Registry.get("tld").asBuilder().build());
|
persistResource(Tld.get("tld").asBuilder().build());
|
||||||
domain = loadByEntity(domain);
|
domain = loadByEntity(domain);
|
||||||
persistResource(
|
persistResource(
|
||||||
loadByKey(domain.getAutorenewBillingEvent())
|
loadByKey(domain.getAutorenewBillingEvent())
|
||||||
|
@ -1445,7 +1444,7 @@ class DomainTransferRequestFlowTest
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_packageName_zeroPeriod() throws Exception {
|
void testSuccess_packageName_zeroPeriod() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
persistResource(Registry.get("tld").asBuilder().build());
|
persistResource(Tld.get("tld").asBuilder().build());
|
||||||
domain = loadByEntity(domain);
|
domain = loadByEntity(domain);
|
||||||
persistResource(
|
persistResource(
|
||||||
loadByKey(domain.getAutorenewBillingEvent())
|
loadByKey(domain.getAutorenewBillingEvent())
|
||||||
|
@ -1544,7 +1543,7 @@ class DomainTransferRequestFlowTest
|
||||||
|
|
||||||
private void runWrongFeeAmountTest(Map<String, String> substitutions) {
|
private void runWrongFeeAmountTest(Map<String, String> substitutions) {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1818,7 +1817,7 @@ class DomainTransferRequestFlowTest
|
||||||
void testIcannTransactionRecord_getsStored() throws Exception {
|
void testIcannTransactionRecord_getsStored() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAutomaticTransferLength(Duration.standardDays(2))
|
.setAutomaticTransferLength(Duration.standardDays(2))
|
||||||
.setTransferGracePeriodLength(Duration.standardDays(3))
|
.setTransferGracePeriodLength(Duration.standardDays(3))
|
||||||
|
|
|
@ -28,7 +28,7 @@ import static google.registry.model.eppcommon.StatusValue.SERVER_TRANSFER_PROHIB
|
||||||
import static google.registry.model.eppcommon.StatusValue.SERVER_UPDATE_PROHIBITED;
|
import static google.registry.model.eppcommon.StatusValue.SERVER_UPDATE_PROHIBITED;
|
||||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
|
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
|
||||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_UPDATE;
|
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_UPDATE;
|
||||||
import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD;
|
import static google.registry.model.tld.Tld.TldState.QUIET_PERIOD;
|
||||||
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
|
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
|
||||||
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
||||||
import static google.registry.testing.DatabaseHelper.assertPollMessagesForResource;
|
import static google.registry.testing.DatabaseHelper.assertPollMessagesForResource;
|
||||||
|
@ -101,7 +101,7 @@ import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.Host;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -265,7 +265,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_inQuietPeriod() throws Exception {
|
void testSuccess_inQuietPeriod() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1529,7 +1529,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAllowedRegistrantContactIds(ImmutableSet.of("contact1234"))
|
.setAllowedRegistrantContactIds(ImmutableSet.of("contact1234"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1543,7 +1543,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1560,7 +1560,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
persistDomain();
|
persistDomain();
|
||||||
// No registrant is given but both nameserver and registrant allow list exist.
|
// No registrant is given but both nameserver and registrant allow list exist.
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
||||||
.setAllowedFullyQualifiedHostNames(
|
.setAllowedFullyQualifiedHostNames(
|
||||||
|
@ -1582,7 +1582,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
persistDomain();
|
persistDomain();
|
||||||
// Only changes registrant, with both nameserver and registrant allow list on the TLD.
|
// Only changes registrant, with both nameserver and registrant allow list on the TLD.
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
||||||
|
@ -1622,7 +1622,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.foo"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.foo"))
|
||||||
|
@ -1642,7 +1642,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
loadByForeignKey(Host.class, "ns2.example.foo", clock.nowUtc()).get().createVKey())
|
loadByForeignKey(Host.class, "ns2.example.foo", clock.nowUtc()).get().createVKey())
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAllowedFullyQualifiedHostNames(
|
.setAllowedFullyQualifiedHostNames(
|
||||||
ImmutableSet.of("ns1.example.foo", "ns2.example.foo"))
|
ImmutableSet.of("ns1.example.foo", "ns2.example.foo"))
|
||||||
|
@ -1665,7 +1665,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
persistDomain();
|
persistDomain();
|
||||||
setEppInput("domain_update_remove_nameserver.xml");
|
setEppInput("domain_update_remove_nameserver.xml");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Tld.get("tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
|
|
|
@ -50,7 +50,7 @@ import google.registry.model.domain.token.AllocationToken;
|
||||||
import google.registry.model.domain.token.AllocationToken.TokenStatus;
|
import google.registry.model.domain.token.AllocationToken.TokenStatus;
|
||||||
import google.registry.model.domain.token.AllocationTokenExtension;
|
import google.registry.model.domain.token.AllocationTokenExtension;
|
||||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Tld;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
|
@ -92,7 +92,7 @@ class AllocationTokenFlowUtilsTest {
|
||||||
flowUtils
|
flowUtils
|
||||||
.verifyAllocationTokenCreateIfPresent(
|
.verifyAllocationTokenCreateIfPresent(
|
||||||
createCommand("blah.tld"),
|
createCommand("blah.tld"),
|
||||||
Registry.get("tld"),
|
Tld.get("tld"),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
DateTime.now(UTC),
|
DateTime.now(UTC),
|
||||||
Optional.of(allocationTokenExtension))
|
Optional.of(allocationTokenExtension))
|
||||||
|
@ -114,7 +114,7 @@ class AllocationTokenFlowUtilsTest {
|
||||||
flowUtils
|
flowUtils
|
||||||
.verifyAllocationTokenIfPresent(
|
.verifyAllocationTokenIfPresent(
|
||||||
DatabaseHelper.newDomain("blah.tld"),
|
DatabaseHelper.newDomain("blah.tld"),
|
||||||
Registry.get("tld"),
|
Tld.get("tld"),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
DateTime.now(UTC),
|
DateTime.now(UTC),
|
||||||
CommandName.RENEW,
|
CommandName.RENEW,
|
||||||
|
@ -133,7 +133,7 @@ class AllocationTokenFlowUtilsTest {
|
||||||
flowUtils
|
flowUtils
|
||||||
.verifyAllocationTokenIfPresent(
|
.verifyAllocationTokenIfPresent(
|
||||||
DatabaseHelper.newDomain("blah.tld"),
|
DatabaseHelper.newDomain("blah.tld"),
|
||||||
Registry.get("tld"),
|
Tld.get("tld"),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
DateTime.now(UTC),
|
DateTime.now(UTC),
|
||||||
CommandName.RENEW,
|
CommandName.RENEW,
|
||||||
|
@ -161,7 +161,7 @@ class AllocationTokenFlowUtilsTest {
|
||||||
() ->
|
() ->
|
||||||
flowUtils.verifyAllocationTokenCreateIfPresent(
|
flowUtils.verifyAllocationTokenCreateIfPresent(
|
||||||
createCommand("blah.tld"),
|
createCommand("blah.tld"),
|
||||||
Registry.get("tld"),
|
Tld.get("tld"),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
DateTime.now(UTC),
|
DateTime.now(UTC),
|
||||||
Optional.of(allocationTokenExtension))))
|
Optional.of(allocationTokenExtension))))
|
||||||
|
@ -177,7 +177,7 @@ class AllocationTokenFlowUtilsTest {
|
||||||
() ->
|
() ->
|
||||||
flowUtils.verifyAllocationTokenIfPresent(
|
flowUtils.verifyAllocationTokenIfPresent(
|
||||||
DatabaseHelper.newDomain("blah.tld"),
|
DatabaseHelper.newDomain("blah.tld"),
|
||||||
Registry.get("tld"),
|
Tld.get("tld"),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
DateTime.now(UTC),
|
DateTime.now(UTC),
|
||||||
CommandName.RENEW,
|
CommandName.RENEW,
|
||||||
|
@ -198,7 +198,7 @@ class AllocationTokenFlowUtilsTest {
|
||||||
() ->
|
() ->
|
||||||
failingFlowUtils.verifyAllocationTokenCreateIfPresent(
|
failingFlowUtils.verifyAllocationTokenCreateIfPresent(
|
||||||
createCommand("blah.tld"),
|
createCommand("blah.tld"),
|
||||||
Registry.get("tld"),
|
Tld.get("tld"),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
DateTime.now(UTC),
|
DateTime.now(UTC),
|
||||||
Optional.of(allocationTokenExtension)));
|
Optional.of(allocationTokenExtension)));
|
||||||
|
@ -218,7 +218,7 @@ class AllocationTokenFlowUtilsTest {
|
||||||
() ->
|
() ->
|
||||||
failingFlowUtils.verifyAllocationTokenIfPresent(
|
failingFlowUtils.verifyAllocationTokenIfPresent(
|
||||||
DatabaseHelper.newDomain("blah.tld"),
|
DatabaseHelper.newDomain("blah.tld"),
|
||||||
Registry.get("tld"),
|
Tld.get("tld"),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
DateTime.now(UTC),
|
DateTime.now(UTC),
|
||||||
CommandName.RENEW,
|
CommandName.RENEW,
|
||||||
|
@ -434,7 +434,7 @@ class AllocationTokenFlowUtilsTest {
|
||||||
() ->
|
() ->
|
||||||
flowUtils.verifyAllocationTokenCreateIfPresent(
|
flowUtils.verifyAllocationTokenCreateIfPresent(
|
||||||
createCommand("blah.tld"),
|
createCommand("blah.tld"),
|
||||||
Registry.get("tld"),
|
Tld.get("tld"),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
DateTime.now(UTC),
|
DateTime.now(UTC),
|
||||||
Optional.of(allocationTokenExtension))))
|
Optional.of(allocationTokenExtension))))
|
||||||
|
@ -449,7 +449,7 @@ class AllocationTokenFlowUtilsTest {
|
||||||
() ->
|
() ->
|
||||||
flowUtils.verifyAllocationTokenIfPresent(
|
flowUtils.verifyAllocationTokenIfPresent(
|
||||||
DatabaseHelper.newDomain("blah.tld"),
|
DatabaseHelper.newDomain("blah.tld"),
|
||||||
Registry.get("tld"),
|
Tld.get("tld"),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
DateTime.now(UTC),
|
DateTime.now(UTC),
|
||||||
CommandName.RENEW,
|
CommandName.RENEW,
|
||||||
|
@ -483,7 +483,7 @@ class AllocationTokenFlowUtilsTest {
|
||||||
public AllocationToken validateToken(
|
public AllocationToken validateToken(
|
||||||
DomainCommand.Create command,
|
DomainCommand.Create command,
|
||||||
AllocationToken token,
|
AllocationToken token,
|
||||||
Registry registry,
|
Tld tld,
|
||||||
String registrarId,
|
String registrarId,
|
||||||
DateTime now) {
|
DateTime now) {
|
||||||
throw new IllegalStateException("failed for tests");
|
throw new IllegalStateException("failed for tests");
|
||||||
|
@ -491,7 +491,7 @@ class AllocationTokenFlowUtilsTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AllocationToken validateToken(
|
public AllocationToken validateToken(
|
||||||
Domain domain, AllocationToken token, Registry registry, String registrarId, DateTime now) {
|
Domain domain, AllocationToken token, Tld tld, String registrarId, DateTime now) {
|
||||||
throw new IllegalStateException("failed for tests");
|
throw new IllegalStateException("failed for tests");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue