mirror of
https://github.com/google/nomulus
synced 2026-07-19 06:22:33 +00:00
Migrate core, billing, and history to java.time (#3020)
Migrated core entity primitives (GracePeriod, RegistryLock, TimeOfYear), transfer objects (BaseTransferObject, DomainTransferData, TransferResponse), and HostBase from Joda-Time DateTime to java.time.Instant as Phases 5 and 7. Migrated the Billing Ecosystem (BillingBase, BillingEvent, BillingRecurrence, BillingCancellation) and associated Beam pipelines (ExpandBillingRecurrencesPipeline, InvoicingPipeline) to java.time.Instant as Phase 6. Migrated PollMessage event times and all associated Poll flow utilities (PollAckFlow, PollRequestFlow) to use Instant natively. Migrated core timestamp tracking on EppResource (creationTime, lastEppUpdateTime, deletionTime) as well as CreateAutoTimestamp and UpdateAutoTimestamp to Instant, shedding deprecated DateTime accessors. Migrated the entire HistoryEntry reporting ecosystem (HistoryEntry, DomainTransactionRecord, HistoryEntryDao) completely to java.time.Instant. Updated all associated EPP flows, tools, and testing helpers to handle Instants directly where supported.
This commit is contained in:
@@ -16,6 +16,8 @@ This document outlines foundational mandates, architectural patterns, and projec
|
||||
## 2. Time and Precision Handling (java.time Migration)
|
||||
|
||||
- **Idiomatic java.time Usage:** Avoid redundant conversions between `Instant` and `DateTime`. If a field or parameter is an `Instant`, use it directly. Do not convert to `DateTime` just to call a deprecated method if an `Instant` alternative exists or can be easily created. Furthermore, you should not call `toInstant()` or `toDateTime()` conversion methods when not strictly necessary; always prefer to use an alternative method that returns the correct type if one exists (e.g. use `tm().getTxTime()` which returns an `Instant` instead of calling `tm().getTransactionTime().toInstant()`).
|
||||
- **CRITICAL MISTAKE TO AVOID:** NEVER use `toInstant(clock.nowUtc())` or `toInstant(fakeClock.nowUtc())`. Both `Clock` and `FakeClock` have a `now()` method that natively returns a `java.time.Instant`. You MUST use `clock.now()` or `fakeClock.now()` directly. Converting `nowUtc()` to an Instant is an embarrassing mistake that demonstrates a lack of basic codebase familiarity.
|
||||
- **UTC Timezones:** Do not use `ZoneId.of("UTC")`. Use a statically imported `UTC` from `ZoneOffset` instead (`import static java.time.ZoneOffset.UTC;`).
|
||||
- **Millisecond Precision:** Always truncate `Instant.now()` to milliseconds (using `.truncatedTo(ChronoUnit.MILLIS)`) to maintain consistency with Joda `DateTime` and the PostgreSQL schema (which enforces millisecond precision via JPA converters).
|
||||
- **Clock Injection:**
|
||||
- Avoid direct calls to `Instant.now()`, `DateTime.now()`, `ZonedDateTime.now()`, or `System.currentTimeMillis()`.
|
||||
@@ -53,6 +55,10 @@ This document outlines foundational mandates, architectural patterns, and projec
|
||||
### 6. Project Dependencies
|
||||
- **Common Module:** When using `Clock` or other core utilities in a new or separate module (like `load-testing`), ensure `implementation project(':common')` is added to the module's `build.gradle`.
|
||||
|
||||
### 7. Search and Discovery
|
||||
- **No CodeSearch:** This project is hosted on GitHub, not Google3. Do NOT use `mcp_Coding_search_for_files_codesearch` or other internal Google3 search tools.
|
||||
- **Local Grep:** Use local shell commands like `git grep` or `grep` via `run_shell_command` to search the codebase.
|
||||
|
||||
## Performance and Efficiency
|
||||
- **Turn Minimization:** Aim for "perfect" code in the first iteration. Iterative fixes for checkstyle or compilation errors consume significant context and time.
|
||||
- **Context Management:** Use sub-agents for batch refactoring or high-volume output tasks to keep the main session history lean and efficient.
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.time.format.SignStyle;
|
||||
import java.time.temporal.ChronoField;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
@@ -252,6 +253,22 @@ public abstract class DateTimeUtils {
|
||||
return (instant == null) ? null : org.joda.time.Instant.ofEpochMilli(instant.toEpochMilli());
|
||||
}
|
||||
|
||||
public static Instant plusHours(Instant instant, long hours) {
|
||||
return instant.plus(hours, ChronoUnit.HOURS);
|
||||
}
|
||||
|
||||
public static Instant minusHours(Instant instant, long hours) {
|
||||
return instant.minus(hours, ChronoUnit.HOURS);
|
||||
}
|
||||
|
||||
public static Instant plusMinutes(Instant instant, long minutes) {
|
||||
return instant.plus(minutes, ChronoUnit.MINUTES);
|
||||
}
|
||||
|
||||
public static Instant minusMinutes(Instant instant, long minutes) {
|
||||
return instant.minus(minutes, ChronoUnit.MINUTES);
|
||||
}
|
||||
|
||||
public static Instant plusDays(Instant instant, int days) {
|
||||
return instant.atZone(ZoneOffset.UTC).plusDays(days).toInstant();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import static google.registry.persistence.PersistenceModule.TransactionIsolation
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.request.Action.Method.POST;
|
||||
import static google.registry.request.RequestParameters.PARAM_DRY_RUN;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.RegistryEnvironment.PRODUCTION;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -99,7 +99,7 @@ public class DeleteLoadTestDataAction implements Runnable {
|
||||
|
||||
private void deletePollMessages(String registrarId) {
|
||||
ImmutableList<PollMessage> pollMessages =
|
||||
PollFlowUtils.createPollMessageQuery(registrarId, END_OF_TIME).list();
|
||||
PollFlowUtils.createPollMessageQuery(registrarId, END_INSTANT).list();
|
||||
if (isDryRun) {
|
||||
logger.atInfo().log(
|
||||
"Would delete %d poll messages for registrar %s.", pollMessages.size(), registrarId);
|
||||
|
||||
@@ -188,7 +188,8 @@ public class DeleteProberDataAction implements Runnable {
|
||||
tm().query(DOMAIN_QUERY_STRING, Domain.class)
|
||||
.setParameter("tlds", deletableTlds)
|
||||
.setParameter(
|
||||
"creationTimeCutoff", CreateAutoTimestamp.create(now.minus(DOMAIN_USED_DURATION)))
|
||||
"creationTimeCutoff",
|
||||
CreateAutoTimestamp.create(toInstant(now.minus(DOMAIN_USED_DURATION))))
|
||||
.setParameter("nowMinusSoftDeleteDelay", toInstant(now.minus(SOFT_DELETE_DELAY)))
|
||||
.setParameter("now", toInstant(now));
|
||||
ImmutableList<Domain> domainList =
|
||||
@@ -304,12 +305,12 @@ public class DeleteProberDataAction implements Runnable {
|
||||
// Take a DNS queue + admin registrar id as input so that it can be called from the mapper as well
|
||||
private void softDeleteDomain(Domain domain) {
|
||||
Domain deletedDomain =
|
||||
domain.asBuilder().setDeletionTime(tm().getTransactionTime()).setStatusValues(null).build();
|
||||
domain.asBuilder().setDeletionTime(tm().getTxTime()).setStatusValues(null).build();
|
||||
DomainHistory historyEntry =
|
||||
new DomainHistory.Builder()
|
||||
.setDomain(domain)
|
||||
.setType(DOMAIN_DELETE)
|
||||
.setModificationTime(tm().getTransactionTime())
|
||||
.setModificationTime(tm().getTxTime())
|
||||
.setBySuperuser(true)
|
||||
.setReason("Deletion of prober data")
|
||||
.setRegistrarId(registryAdminRegistrarId)
|
||||
|
||||
@@ -14,12 +14,17 @@
|
||||
|
||||
package google.registry.beam.billing;
|
||||
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.reporting.billing.BillingModule;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.beam.sdk.coders.AtomicCoder;
|
||||
import org.apache.beam.sdk.coders.Coder;
|
||||
@@ -29,9 +34,6 @@ import org.apache.beam.sdk.coders.StringUtf8Coder;
|
||||
import org.apache.beam.sdk.coders.VarIntCoder;
|
||||
import org.apache.beam.sdk.coders.VarLongCoder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* A record representing a single billable event, parsed from a {@code SchemaAndRecord}.
|
||||
@@ -53,8 +55,8 @@ import org.joda.time.format.DateTimeFormatter;
|
||||
*/
|
||||
public record BillingEvent(
|
||||
long id,
|
||||
DateTime billingTime,
|
||||
DateTime eventTime,
|
||||
Instant billingTime,
|
||||
Instant eventTime,
|
||||
String registrarId,
|
||||
String billingId,
|
||||
String poNumber,
|
||||
@@ -68,7 +70,7 @@ public record BillingEvent(
|
||||
String flags) {
|
||||
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER =
|
||||
DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss zzz");
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss 'UTC'").withZone(ZoneOffset.UTC);
|
||||
|
||||
private static final Pattern SYNTHETIC_REGEX = Pattern.compile("SYNTHETIC", Pattern.LITERAL);
|
||||
|
||||
@@ -92,8 +94,8 @@ public record BillingEvent(
|
||||
/** Creates a concrete {@link BillingEvent}. */
|
||||
static BillingEvent create(
|
||||
long id,
|
||||
DateTime billingTime,
|
||||
DateTime eventTime,
|
||||
Instant billingTime,
|
||||
Instant eventTime,
|
||||
String registrarId,
|
||||
String billingId,
|
||||
String poNumber,
|
||||
@@ -143,8 +145,8 @@ public record BillingEvent(
|
||||
.join(
|
||||
ImmutableList.of(
|
||||
id(),
|
||||
DATE_TIME_FORMATTER.print(billingTime()),
|
||||
DATE_TIME_FORMATTER.print(eventTime()),
|
||||
DATE_TIME_FORMATTER.format(billingTime()),
|
||||
DATE_TIME_FORMATTER.format(eventTime()),
|
||||
registrarId(),
|
||||
billingId(),
|
||||
poNumber(),
|
||||
@@ -162,10 +164,13 @@ public record BillingEvent(
|
||||
/** Returns the grouping key for this {@code BillingEvent}, to generate the overall invoice. */
|
||||
InvoiceGroupingKey getInvoiceGroupingKey() {
|
||||
return new InvoiceGroupingKey(
|
||||
billingTime().toLocalDate().withDayOfMonth(1).toString(),
|
||||
ZonedDateTime.ofInstant(billingTime(), ZoneOffset.UTC)
|
||||
.toLocalDate()
|
||||
.withDayOfMonth(1)
|
||||
.toString(),
|
||||
years() == 0
|
||||
? ""
|
||||
: billingTime()
|
||||
: ZonedDateTime.ofInstant(billingTime(), ZoneOffset.UTC)
|
||||
.toLocalDate()
|
||||
.withDayOfMonth(1)
|
||||
.plusYears(years())
|
||||
@@ -308,8 +313,8 @@ public record BillingEvent(
|
||||
@Override
|
||||
public void encode(BillingEvent value, OutputStream outStream) throws IOException {
|
||||
longCoder.encode(value.id(), outStream);
|
||||
stringCoder.encode(DATE_TIME_FORMATTER.print(value.billingTime()), outStream);
|
||||
stringCoder.encode(DATE_TIME_FORMATTER.print(value.eventTime()), outStream);
|
||||
stringCoder.encode(DATE_TIME_FORMATTER.format(value.billingTime()), outStream);
|
||||
stringCoder.encode(DATE_TIME_FORMATTER.format(value.eventTime()), outStream);
|
||||
stringCoder.encode(value.registrarId(), outStream);
|
||||
stringCoder.encode(value.billingId(), outStream);
|
||||
stringCoder.encode(value.poNumber(), outStream);
|
||||
@@ -327,8 +332,8 @@ public record BillingEvent(
|
||||
public BillingEvent decode(InputStream inStream) throws IOException {
|
||||
return new BillingEvent(
|
||||
longCoder.decode(inStream),
|
||||
DATE_TIME_FORMATTER.parseDateTime(stringCoder.decode(inStream)),
|
||||
DATE_TIME_FORMATTER.parseDateTime(stringCoder.decode(inStream)),
|
||||
Instant.from(DATE_TIME_FORMATTER.parse(stringCoder.decode(inStream))),
|
||||
Instant.from(DATE_TIME_FORMATTER.parse(stringCoder.decode(inStream))),
|
||||
stringCoder.decode(inStream),
|
||||
stringCoder.decode(inStream),
|
||||
stringCoder.decode(inStream),
|
||||
|
||||
+4
-4
@@ -276,12 +276,12 @@ public class ExpandBillingRecurrencesPipeline implements Serializable {
|
||||
ImmutableSet.copyOf(
|
||||
billingRecurrence
|
||||
.getRecurrenceTimeOfYear()
|
||||
.getInstancesInRangeInstant(
|
||||
.getInstancesInRange(
|
||||
Range.closedOpen(
|
||||
latestOf(
|
||||
plusYears(billingRecurrence.getRecurrenceLastExpansionInstant(), 1),
|
||||
plusYears(billingRecurrence.getRecurrenceLastExpansion(), 1),
|
||||
startTime),
|
||||
earliestOf(billingRecurrence.getRecurrenceEndTimeInstant(), endTime))));
|
||||
earliestOf(billingRecurrence.getRecurrenceEndTime(), endTime))));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return;
|
||||
}
|
||||
@@ -306,7 +306,7 @@ public class ExpandBillingRecurrencesPipeline implements Serializable {
|
||||
return;
|
||||
}
|
||||
|
||||
Instant recurrenceLastExpansionTime = billingRecurrence.getRecurrenceLastExpansionInstant();
|
||||
Instant recurrenceLastExpansionTime = billingRecurrence.getRecurrenceLastExpansion();
|
||||
|
||||
// Create new OneTime and DomainHistory for EventTimes that needs to be expanded.
|
||||
for (Instant eventTime : eventTimesToExpand) {
|
||||
|
||||
@@ -228,7 +228,7 @@ public class BsaValidateAction implements Runnable {
|
||||
}
|
||||
|
||||
boolean isStalenessAllowed(Domain domain) {
|
||||
return domain.getCreationTimeInstant().plus(maxStaleness).isAfter(clock.now());
|
||||
return domain.getCreationTime().plus(maxStaleness).isAfter(clock.now());
|
||||
}
|
||||
|
||||
/** Returns unique labels across all block lists in the download specified by {@code jobName}. */
|
||||
|
||||
@@ -251,7 +251,7 @@ public class FlowModule {
|
||||
String registrarId,
|
||||
EppInput eppInput) {
|
||||
builder
|
||||
.setModificationTime(tm().getTransactionTime())
|
||||
.setModificationTime(tm().getTxTime())
|
||||
.setTrid(trid)
|
||||
.setXmlBytes(inputXmlBytes)
|
||||
.setBySuperuser(isSuperuser)
|
||||
|
||||
@@ -572,7 +572,7 @@ public final class DomainCreateFlow implements MutatingFlow {
|
||||
ImmutableSet.of(
|
||||
DomainTransactionRecord.create(
|
||||
tld.getTldStr(),
|
||||
now.plus(addGracePeriod),
|
||||
toInstant(now.plus(addGracePeriod)),
|
||||
TransactionReportField.netAddsFieldFromYears(period.getValue()),
|
||||
1)));
|
||||
}
|
||||
@@ -607,13 +607,14 @@ public final class DomainCreateFlow implements MutatingFlow {
|
||||
.setRegistrarId(registrarId)
|
||||
.setPeriodYears(years)
|
||||
.setCost(feesAndCredits.getCreateCost())
|
||||
.setEventTime(now)
|
||||
.setEventTime(toInstant(now))
|
||||
.setAllocationToken(allocationToken.map(AllocationToken::createVKey).orElse(null))
|
||||
.setBillingTime(
|
||||
now.plus(
|
||||
isAnchorTenant
|
||||
? tld.getAnchorTenantAddGracePeriodLength()
|
||||
: tld.getAddGracePeriodLength()))
|
||||
toInstant(
|
||||
now.plus(
|
||||
isAnchorTenant
|
||||
? tld.getAnchorTenantAddGracePeriodLength()
|
||||
: tld.getAddGracePeriodLength())))
|
||||
.setFlags(flagsBuilder.build())
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
.build();
|
||||
@@ -638,7 +639,7 @@ public final class DomainCreateFlow implements MutatingFlow {
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
|
||||
.setTargetId(targetId)
|
||||
.setRegistrarId(registrarId)
|
||||
.setEventTime(registrationExpirationTime)
|
||||
.setEventTime(toInstant(registrationExpirationTime))
|
||||
.setRecurrenceEndTime(END_INSTANT)
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
.setRenewalPriceBehavior(renewalPriceBehavior)
|
||||
@@ -651,7 +652,7 @@ public final class DomainCreateFlow implements MutatingFlow {
|
||||
return new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(targetId)
|
||||
.setRegistrarId(registrarId)
|
||||
.setEventTime(registrationExpirationTime)
|
||||
.setEventTime(toInstant(registrationExpirationTime))
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
.build();
|
||||
@@ -685,7 +686,7 @@ public final class DomainCreateFlow implements MutatingFlow {
|
||||
String domainName, HistoryEntry historyEntry, String registrarId, DateTime now) {
|
||||
return new PollMessage.OneTime.Builder()
|
||||
.setRegistrarId(registrarId)
|
||||
.setEventTime(now)
|
||||
.setEventTime(toInstant(now))
|
||||
.setMsg(COLLISION_MESSAGE) // Remind the registrar of the name collision policy.
|
||||
.setResponseData(
|
||||
ImmutableList.of(
|
||||
|
||||
@@ -40,6 +40,7 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
|
||||
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
|
||||
import static google.registry.util.CollectionUtils.nullToEmpty;
|
||||
import static google.registry.util.CollectionUtils.union;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -162,7 +163,7 @@ public final class DomainDeleteFlow implements MutatingFlow, SqlStatementLogging
|
||||
} else {
|
||||
builder = existingDomain.asBuilder();
|
||||
}
|
||||
builder.setLastEppUpdateTime(now).setLastEppUpdateRegistrarId(registrarId);
|
||||
builder.setLastEppUpdateTime(toInstant(now)).setLastEppUpdateRegistrarId(registrarId);
|
||||
Duration redemptionGracePeriodLength = tld.getRedemptionGracePeriodLength();
|
||||
Duration pendingDeleteLength = tld.getPendingDeleteLength();
|
||||
Optional<DomainDeleteSuperuserExtension> domainDeleteSuperuserExtension =
|
||||
@@ -187,13 +188,13 @@ public final class DomainDeleteFlow implements MutatingFlow, SqlStatementLogging
|
||||
historyBuilder.setRevisionId(domainHistoryId.getRevisionId());
|
||||
DateTime deletionTime = now.plus(durationUntilDelete);
|
||||
if (durationUntilDelete.equals(Duration.ZERO)) {
|
||||
builder.setDeletionTime(now).setStatusValues(null);
|
||||
builder.setDeletionTime(toInstant(now)).setStatusValues(null);
|
||||
} else {
|
||||
DateTime redemptionTime = now.plus(redemptionGracePeriodLength);
|
||||
asyncTaskEnqueuer.enqueueAsyncResave(
|
||||
existingDomain.createVKey(), now, ImmutableSortedSet.of(redemptionTime, deletionTime));
|
||||
builder
|
||||
.setDeletionTime(deletionTime)
|
||||
.setDeletionTime(toInstant(deletionTime))
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
// Clear out all old grace periods and add REDEMPTION, which does not include a key to a
|
||||
// billing event because there isn't one for a domain delete.
|
||||
@@ -242,7 +243,8 @@ public final class DomainDeleteFlow implements MutatingFlow, SqlStatementLogging
|
||||
// No cancellation is written if the grace period was not for a billable event.
|
||||
if (gracePeriod.hasBillingEvent()) {
|
||||
entitiesToInsert.add(
|
||||
BillingCancellation.forGracePeriod(gracePeriod, now, domainHistoryId, targetId));
|
||||
BillingCancellation.forGracePeriod(
|
||||
gracePeriod, toInstant(now), domainHistoryId, targetId));
|
||||
if (gracePeriod.getBillingEvent() != null) {
|
||||
// Take the amount of registration time being refunded off the expiration time.
|
||||
// This can be either add grace periods or renew grace periods.
|
||||
@@ -290,7 +292,7 @@ public final class DomainDeleteFlow implements MutatingFlow, SqlStatementLogging
|
||||
flowCustomLogic.beforeResponse(
|
||||
BeforeResponseParameters.newBuilder()
|
||||
.setResultCode(
|
||||
newDomain.getDeletionDateTime().isAfter(now)
|
||||
newDomain.getDeletionTime().isAfter(toInstant(now))
|
||||
? SUCCESS_WITH_ACTION_PENDING
|
||||
: SUCCESS)
|
||||
.setResponseExtensions(
|
||||
@@ -343,7 +345,7 @@ public final class DomainDeleteFlow implements MutatingFlow, SqlStatementLogging
|
||||
cancelledRecords,
|
||||
DomainTransactionRecord.create(
|
||||
domain.getTld(),
|
||||
now.plus(durationUntilDelete),
|
||||
toInstant(now.plus(durationUntilDelete)),
|
||||
inAddGracePeriod
|
||||
? TransactionReportField.DELETED_DOMAINS_GRACE
|
||||
: TransactionReportField.DELETED_DOMAINS_NOGRACE,
|
||||
@@ -380,7 +382,7 @@ public final class DomainDeleteFlow implements MutatingFlow, SqlStatementLogging
|
||||
Domain existingDomain, HistoryEntryId domainHistoryId, DateTime now, DateTime deletionTime) {
|
||||
return new PollMessage.OneTime.Builder()
|
||||
.setRegistrarId(existingDomain.getPersistedCurrentSponsorRegistrarId())
|
||||
.setEventTime(now)
|
||||
.setEventTime(toInstant(now))
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
.setMsg(
|
||||
String.format(
|
||||
@@ -421,7 +423,10 @@ public final class DomainDeleteFlow implements MutatingFlow, SqlStatementLogging
|
||||
if (gracePeriod.getType() == GracePeriodStatus.AUTO_RENEW) {
|
||||
// If we updated the autorenew billing event, reuse it.
|
||||
DateTime autoRenewTime =
|
||||
billingRecurrence.getRecurrenceTimeOfYear().getLastInstanceBeforeOrAt(now);
|
||||
toDateTime(
|
||||
billingRecurrence
|
||||
.getRecurrenceTimeOfYear()
|
||||
.getLastInstanceBeforeOrAt(toInstant(now)));
|
||||
return getDomainRenewCost(targetId, toInstant(autoRenewTime), 1);
|
||||
}
|
||||
return tm().loadByKey(checkNotNull(gracePeriod.getBillingEvent())).getCost();
|
||||
|
||||
@@ -560,7 +560,7 @@ public class DomainFlowUtils {
|
||||
|
||||
// If the resultant autorenew poll message would have no poll messages to deliver, then just
|
||||
// delete it. Otherwise, save it with the new end time.
|
||||
if (isAtOrAfter(updatedAutorenewPollMessage.getEventTime(), newEndTime)) {
|
||||
if (isAtOrAfter(updatedAutorenewPollMessage.getEventTime(), toInstant(newEndTime))) {
|
||||
autorenewPollMessage.ifPresent(autorenew -> tm().delete(autorenew));
|
||||
} else {
|
||||
tm().put(updatedAutorenewPollMessage);
|
||||
@@ -1081,7 +1081,7 @@ public class DomainFlowUtils {
|
||||
for (DomainTransactionRecord record :
|
||||
historyEntry.getDomainTransactionRecords()) {
|
||||
if (cancelableFields.contains(record.getReportField())
|
||||
&& record.getReportingTime().isAfter(now)) {
|
||||
&& record.getReportingTime().isAfter(toInstant(now))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public final class DomainInfoFlow implements MutatingFlow {
|
||||
.setStatusValues(domain.getStatusValues())
|
||||
.setNameservers(
|
||||
hostsRequest.requestDelegated() ? domain.loadNameserverHostNames() : null)
|
||||
.setCreationTime(domain.getCreationTimeInstant())
|
||||
.setCreationTime(domain.getCreationTime())
|
||||
.setLastEppUpdateTime(domain.getLastEppUpdateTime())
|
||||
.setRegistrationExpirationTime(domain.getRegistrationExpirationTime())
|
||||
.setLastTransferTime(domain.getLastTransferTimeInstant());
|
||||
|
||||
@@ -222,14 +222,14 @@ public final class DomainRenewFlow implements MutatingFlow {
|
||||
// Create a new autorenew billing event and poll message starting at the new expiration time.
|
||||
BillingRecurrence newAutorenewEvent =
|
||||
newAutorenewBillingEvent(existingDomain)
|
||||
.setEventTime(newExpirationTime)
|
||||
.setEventTime(toInstant(newExpirationTime))
|
||||
.setRenewalPrice(existingBillingRecurrence.getRenewalPrice().orElse(null))
|
||||
.setRenewalPriceBehavior(existingBillingRecurrence.getRenewalPriceBehavior())
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
.build();
|
||||
PollMessage.Autorenew newAutorenewPollMessage =
|
||||
newAutorenewPollMessage(existingDomain)
|
||||
.setEventTime(newExpirationTime)
|
||||
.setEventTime(toInstant(newExpirationTime))
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
.build();
|
||||
// End the old autorenew billing event and poll message now. This may delete the poll message.
|
||||
@@ -238,7 +238,7 @@ public final class DomainRenewFlow implements MutatingFlow {
|
||||
Domain newDomain =
|
||||
existingDomain
|
||||
.asBuilder()
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateTime(toInstant(now))
|
||||
.setLastEppUpdateRegistrarId(registrarId)
|
||||
.setRegistrationExpirationTime(newExpirationTime)
|
||||
.setAutorenewBillingEvent(newAutorenewEvent.createVKey())
|
||||
@@ -306,7 +306,7 @@ public final class DomainRenewFlow implements MutatingFlow {
|
||||
ImmutableSet.of(
|
||||
DomainTransactionRecord.create(
|
||||
newDomain.getTld(),
|
||||
now.plus(renewGracePeriod),
|
||||
toInstant(now.plus(renewGracePeriod)),
|
||||
TransactionReportField.netRenewsFieldFromYears(period.getValue()),
|
||||
1)))
|
||||
.build();
|
||||
@@ -349,13 +349,13 @@ public final class DomainRenewFlow implements MutatingFlow {
|
||||
.setRegistrarId(registrarId)
|
||||
.setPeriodYears(years)
|
||||
.setCost(renewCost)
|
||||
.setEventTime(now)
|
||||
.setEventTime(toInstant(now))
|
||||
.setAllocationToken(
|
||||
allocationToken
|
||||
.filter(t -> AllocationToken.TokenBehavior.DEFAULT.equals(t.getTokenBehavior()))
|
||||
.map(AllocationToken::createVKey)
|
||||
.orElse(null))
|
||||
.setBillingTime(now.plus(Tld.get(tld).getRenewGracePeriodLength()))
|
||||
.setBillingTime(toInstant(now.plus(Tld.get(tld).getRenewGracePeriodLength())))
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -164,14 +164,14 @@ public final class DomainRestoreRequestFlow implements MutatingFlow {
|
||||
|
||||
BillingRecurrence autorenewEvent =
|
||||
newAutorenewBillingEvent(existingDomain)
|
||||
.setEventTime(newExpirationTime)
|
||||
.setEventTime(toInstant(newExpirationTime))
|
||||
.setRecurrenceEndTime(END_INSTANT)
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
.build();
|
||||
entitiesToInsert.add(autorenewEvent);
|
||||
PollMessage.Autorenew autorenewPollMessage =
|
||||
newAutorenewPollMessage(existingDomain)
|
||||
.setEventTime(newExpirationTime)
|
||||
.setEventTime(toInstant(newExpirationTime))
|
||||
.setAutorenewEndTime(END_INSTANT)
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
.build();
|
||||
@@ -204,7 +204,10 @@ public final class DomainRestoreRequestFlow implements MutatingFlow {
|
||||
.setDomainTransactionRecords(
|
||||
ImmutableSet.of(
|
||||
DomainTransactionRecord.create(
|
||||
newDomain.getTld(), now, TransactionReportField.RESTORED_DOMAINS, 1)))
|
||||
newDomain.getTld(),
|
||||
toInstant(now),
|
||||
TransactionReportField.RESTORED_DOMAINS,
|
||||
1)))
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -253,7 +256,7 @@ public final class DomainRestoreRequestFlow implements MutatingFlow {
|
||||
// Clear the autorenew end time so if it had expired but is now explicitly being restored,
|
||||
// it won't immediately be deleted again.
|
||||
.setAutorenewEndTime(Optional.empty())
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateTime(toInstant(now))
|
||||
.setLastEppUpdateRegistrarId(registrarId)
|
||||
.build();
|
||||
}
|
||||
@@ -273,8 +276,8 @@ public final class DomainRestoreRequestFlow implements MutatingFlow {
|
||||
return new BillingEvent.Builder()
|
||||
.setTargetId(targetId)
|
||||
.setRegistrarId(registrarId)
|
||||
.setEventTime(now)
|
||||
.setBillingTime(now)
|
||||
.setEventTime(toInstant(now))
|
||||
.setBillingTime(toInstant(now))
|
||||
.setPeriodYears(1)
|
||||
.setCost(cost)
|
||||
.setDomainHistoryId(domainHistoryId);
|
||||
|
||||
@@ -163,14 +163,15 @@ public final class DomainTransferApproveFlow implements MutatingFlow {
|
||||
.getTransferPrice(
|
||||
Tld.get(tldStr),
|
||||
targetId,
|
||||
transferData.getTransferRequestTimeInstant(),
|
||||
transferData.getTransferRequestTime(),
|
||||
// When removing a domain from bulk pricing it should return to the
|
||||
// default recurrence billing behavior so the existing recurrence
|
||||
// billing event should not be passed in.
|
||||
hasBulkToken ? null : existingBillingRecurrence)
|
||||
.getRenewCost())
|
||||
.setEventTime(now)
|
||||
.setBillingTime(now.plus(Tld.get(tldStr).getTransferGracePeriodLength()))
|
||||
.setEventTime(toInstant(now))
|
||||
.setBillingTime(
|
||||
toInstant(now.plus(Tld.get(tldStr).getTransferGracePeriodLength())))
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
.build());
|
||||
|
||||
@@ -187,7 +188,8 @@ public final class DomainTransferApproveFlow implements MutatingFlow {
|
||||
// still needs to be charged for the auto-renew.
|
||||
if (billingEvent.isPresent()) {
|
||||
entitiesToInsert.add(
|
||||
BillingCancellation.forGracePeriod(autorenewGrace, now, domainHistoryId, targetId));
|
||||
BillingCancellation.forGracePeriod(
|
||||
autorenewGrace, toInstant(now), domainHistoryId, targetId));
|
||||
}
|
||||
}
|
||||
// Close the old autorenew event and poll message at the transfer time (aka now). This may end
|
||||
@@ -205,7 +207,7 @@ public final class DomainTransferApproveFlow implements MutatingFlow {
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
|
||||
.setTargetId(targetId)
|
||||
.setRegistrarId(gainingRegistrarId)
|
||||
.setEventTime(newExpirationTime)
|
||||
.setEventTime(toInstant(newExpirationTime))
|
||||
.setRenewalPriceBehavior(
|
||||
hasBulkToken
|
||||
? RenewalPriceBehavior.DEFAULT
|
||||
@@ -219,7 +221,7 @@ public final class DomainTransferApproveFlow implements MutatingFlow {
|
||||
new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(targetId)
|
||||
.setRegistrarId(gainingRegistrarId)
|
||||
.setEventTime(newExpirationTime)
|
||||
.setEventTime(toInstant(newExpirationTime))
|
||||
.setAutorenewEndTime(END_INSTANT)
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
@@ -236,7 +238,7 @@ public final class DomainTransferApproveFlow implements MutatingFlow {
|
||||
partiallyApprovedDomain
|
||||
.getTransferData()
|
||||
.asBuilder()
|
||||
.setTransferredRegistrationExpirationTime(newExpirationTime)
|
||||
.setTransferredRegistrationExpirationTime(toInstant(newExpirationTime))
|
||||
.build())
|
||||
.setRegistrationExpirationTime(newExpirationTime)
|
||||
.setAutorenewBillingEvent(autorenewEvent.createVKey())
|
||||
@@ -250,7 +252,7 @@ public final class DomainTransferApproveFlow implements MutatingFlow {
|
||||
GracePeriod.forBillingEvent(
|
||||
GracePeriodStatus.TRANSFER, existingDomain.getRepoId(), event)))
|
||||
.orElseGet(ImmutableSet::of))
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateTime(toInstant(now))
|
||||
.setLastEppUpdateRegistrarId(registrarId)
|
||||
// Even if the existing domain had a bulk token, that bulk token should be removed
|
||||
// on transfer
|
||||
@@ -297,7 +299,7 @@ public final class DomainTransferApproveFlow implements MutatingFlow {
|
||||
cancelingRecords,
|
||||
DomainTransactionRecord.create(
|
||||
newDomain.getTld(),
|
||||
now.plus(tld.getTransferGracePeriodLength()),
|
||||
toInstant(now.plus(tld.getTransferGracePeriodLength())),
|
||||
TRANSFER_SUCCESSFUL,
|
||||
1)))
|
||||
.build();
|
||||
|
||||
@@ -90,7 +90,7 @@ public final class DomainTransferQueryFlow implements TransactionalFlow {
|
||||
}
|
||||
DateTime newExpirationTime = null;
|
||||
if (transferData.getTransferStatus().isApproved()) {
|
||||
newExpirationTime = transferData.getTransferredRegistrationExpirationDateTime();
|
||||
newExpirationTime = toDateTime(transferData.getTransferredRegistrationExpirationTime());
|
||||
} else if (transferData.getTransferStatus().equals(TransferStatus.PENDING)) {
|
||||
newExpirationTime =
|
||||
toDateTime(
|
||||
|
||||
@@ -33,6 +33,7 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
|
||||
import static google.registry.util.CollectionUtils.union;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.flows.EppException;
|
||||
@@ -143,7 +144,8 @@ public final class DomainTransferRejectFlow implements MutatingFlow {
|
||||
.setDomainTransactionRecords(
|
||||
union(
|
||||
cancelingRecords,
|
||||
DomainTransactionRecord.create(newDomain.getTld(), now, TRANSFER_NACKED, 1)))
|
||||
DomainTransactionRecord.create(
|
||||
newDomain.getTld(), toInstant(now), TRANSFER_NACKED, 1)))
|
||||
.setDomain(newDomain)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -257,11 +257,12 @@ public final class DomainTransferRequestFlow implements MutatingFlow {
|
||||
domainHistoryId.getRevisionId(),
|
||||
new DomainTransferData.Builder()
|
||||
.setTransferRequestTrid(trid)
|
||||
.setTransferRequestTime(now)
|
||||
.setTransferRequestTime(toInstant(now))
|
||||
.setGainingRegistrarId(gainingClientId)
|
||||
.setLosingRegistrarId(existingDomain.getCurrentSponsorRegistrarId())
|
||||
.setPendingTransferExpirationTime(automaticTransferTime)
|
||||
.setTransferredRegistrationExpirationTime(serverApproveNewExpirationTime),
|
||||
.setPendingTransferExpirationTime(toInstant(automaticTransferTime))
|
||||
.setTransferredRegistrationExpirationTime(
|
||||
toInstant(serverApproveNewExpirationTime)),
|
||||
serverApproveEntities,
|
||||
period);
|
||||
// Create a poll message to notify the losing registrar that a transfer was requested.
|
||||
@@ -269,7 +270,7 @@ public final class DomainTransferRequestFlow implements MutatingFlow {
|
||||
createLosingTransferPollMessage(
|
||||
targetId, pendingTransferData, serverApproveNewExpirationTime, domainHistoryId)
|
||||
.asBuilder()
|
||||
.setEventTime(now)
|
||||
.setEventTime(toInstant(now))
|
||||
.build();
|
||||
// End the old autorenew event and poll message at the implicit transfer time. This may delete
|
||||
// the poll message if it has no events left. Note that if the automatic transfer succeeds, then
|
||||
@@ -282,7 +283,7 @@ public final class DomainTransferRequestFlow implements MutatingFlow {
|
||||
.asBuilder()
|
||||
.setTransferData(pendingTransferData)
|
||||
.addStatusValue(StatusValue.PENDING_TRANSFER)
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateTime(toInstant(now))
|
||||
.setLastEppUpdateRegistrarId(gainingClientId)
|
||||
.build();
|
||||
DomainHistory domainHistory = buildDomainHistory(newDomain, tld, now, period);
|
||||
@@ -374,8 +375,9 @@ public final class DomainTransferRequestFlow implements MutatingFlow {
|
||||
ImmutableSet.of(
|
||||
DomainTransactionRecord.create(
|
||||
tld.getTldStr(),
|
||||
now.plus(tld.getAutomaticTransferLength())
|
||||
.plus(tld.getTransferGracePeriodLength()),
|
||||
toInstant(
|
||||
now.plus(tld.getAutomaticTransferLength())
|
||||
.plus(tld.getTransferGracePeriodLength())),
|
||||
TransactionReportField.TRANSFER_SUCCESSFUL,
|
||||
1)))
|
||||
.build();
|
||||
|
||||
@@ -17,6 +17,7 @@ package google.registry.flows.domain;
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static com.google.common.collect.MoreCollectors.onlyElement;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -120,11 +121,11 @@ public final class DomainTransferUtils {
|
||||
DomainTransferData serverApproveTransferData =
|
||||
new DomainTransferData.Builder()
|
||||
.setTransferRequestTrid(trid)
|
||||
.setTransferRequestTime(now)
|
||||
.setTransferRequestTime(toInstant(now))
|
||||
.setGainingRegistrarId(gainingRegistrarId)
|
||||
.setLosingRegistrarId(existingDomain.getCurrentSponsorRegistrarId())
|
||||
.setPendingTransferExpirationTime(automaticTransferTime)
|
||||
.setTransferredRegistrationExpirationTime(serverApproveNewExpirationTime)
|
||||
.setPendingTransferExpirationTime(toInstant(automaticTransferTime))
|
||||
.setTransferredRegistrationExpirationTime(toInstant(serverApproveNewExpirationTime))
|
||||
.setTransferStatus(TransferStatus.SERVER_APPROVED)
|
||||
.build();
|
||||
Tld tld = Tld.get(existingDomain.getTld());
|
||||
@@ -184,7 +185,7 @@ public final class DomainTransferUtils {
|
||||
HistoryEntryId domainHistoryId) {
|
||||
return new PollMessage.OneTime.Builder()
|
||||
.setRegistrarId(transferData.getGainingRegistrarId())
|
||||
.setEventTime(transferData.getPendingTransferExpirationDateTime())
|
||||
.setEventTime(transferData.getPendingTransferExpirationTime())
|
||||
.setMsg(transferData.getTransferStatus().getMessage())
|
||||
.setResponseData(
|
||||
ImmutableList.of(
|
||||
@@ -206,7 +207,7 @@ public final class DomainTransferUtils {
|
||||
HistoryEntryId domainHistoryId) {
|
||||
return new PollMessage.OneTime.Builder()
|
||||
.setRegistrarId(transferData.getLosingRegistrarId())
|
||||
.setEventTime(transferData.getPendingTransferExpirationDateTime())
|
||||
.setEventTime(transferData.getPendingTransferExpirationTime())
|
||||
.setMsg(transferData.getTransferStatus().getMessage())
|
||||
.setResponseData(
|
||||
ImmutableList.of(
|
||||
@@ -224,10 +225,10 @@ public final class DomainTransferUtils {
|
||||
.setDomainName(targetId)
|
||||
.setGainingRegistrarId(transferData.getGainingRegistrarId())
|
||||
.setLosingRegistrarId(transferData.getLosingRegistrarId())
|
||||
.setPendingTransferExpirationTime(transferData.getPendingTransferExpirationDateTime())
|
||||
.setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime())
|
||||
.setTransferRequestTime(transferData.getTransferRequestTime())
|
||||
.setTransferStatus(transferData.getTransferStatus())
|
||||
.setExtendedRegistrationExpirationTime(extendedRegistrationExpirationTime)
|
||||
.setExtendedRegistrationExpirationTime(toInstant(extendedRegistrationExpirationTime))
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -239,7 +240,7 @@ public final class DomainTransferUtils {
|
||||
return new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(targetId)
|
||||
.setRegistrarId(gainingRegistrarId)
|
||||
.setEventTime(serverApproveNewExpirationTime)
|
||||
.setEventTime(toInstant(serverApproveNewExpirationTime))
|
||||
.setAutorenewEndTime(END_INSTANT)
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
@@ -257,7 +258,7 @@ public final class DomainTransferUtils {
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
|
||||
.setTargetId(targetId)
|
||||
.setRegistrarId(gainingRegistrarId)
|
||||
.setEventTime(serverApproveNewExpirationTime)
|
||||
.setEventTime(toInstant(serverApproveNewExpirationTime))
|
||||
.setRecurrenceEndTime(END_INSTANT)
|
||||
.setRenewalPriceBehavior(existingBillingRecurrence.getRenewalPriceBehavior())
|
||||
.setRenewalPrice(existingBillingRecurrence.getRenewalPrice().orElse(null))
|
||||
@@ -294,9 +295,10 @@ public final class DomainTransferUtils {
|
||||
domainAtTransferTime.getGracePeriodsOfType(GracePeriodStatus.AUTO_RENEW), null);
|
||||
if (autorenewGracePeriod != null && transferCost.isPresent()) {
|
||||
return Optional.of(
|
||||
BillingCancellation.forGracePeriod(autorenewGracePeriod, now, domainHistoryId, targetId)
|
||||
BillingCancellation.forGracePeriod(
|
||||
autorenewGracePeriod, toInstant(now), domainHistoryId, targetId)
|
||||
.asBuilder()
|
||||
.setEventTime(automaticTransferTime)
|
||||
.setEventTime(toInstant(automaticTransferTime))
|
||||
.build());
|
||||
}
|
||||
return Optional.empty();
|
||||
@@ -315,8 +317,9 @@ public final class DomainTransferUtils {
|
||||
.setRegistrarId(gainingRegistrarId)
|
||||
.setCost(transferCost)
|
||||
.setPeriodYears(1)
|
||||
.setEventTime(automaticTransferTime)
|
||||
.setBillingTime(automaticTransferTime.plus(registry.getTransferGracePeriodLength()))
|
||||
.setEventTime(toInstant(automaticTransferTime))
|
||||
.setBillingTime(
|
||||
toInstant(automaticTransferTime.plus(registry.getTransferGracePeriodLength())))
|
||||
.setDomainHistoryId(domainHistoryId)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ public final class DomainUpdateFlow implements MutatingFlow {
|
||||
.collect(toImmutableSet()),
|
||||
secDnsUpdate.get())
|
||||
: domain.getDsData())
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateTime(toInstant(now))
|
||||
.setLastEppUpdateRegistrarId(registrarId)
|
||||
.addStatusValues(add.getStatusValues())
|
||||
.removeStatusValues(remove.getStatusValues())
|
||||
@@ -319,8 +319,8 @@ public final class DomainUpdateFlow implements MutatingFlow {
|
||||
.setTargetId(targetId)
|
||||
.setRegistrarId(registrarId)
|
||||
.setCost(Tld.get(existingDomain.getTld()).getServerStatusChangeBillingCost())
|
||||
.setEventTime(now)
|
||||
.setBillingTime(now)
|
||||
.setEventTime(toInstant(now))
|
||||
.setBillingTime(toInstant(now))
|
||||
.setDomainHistory(historyEntry)
|
||||
.build());
|
||||
}
|
||||
@@ -369,7 +369,7 @@ public final class DomainUpdateFlow implements MutatingFlow {
|
||||
return Optional.ofNullable(
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setHistoryEntry(historyEntry)
|
||||
.setEventTime(now)
|
||||
.setEventTime(toInstant(now))
|
||||
.setRegistrarId(existingDomain.getCurrentSponsorRegistrarId())
|
||||
.setMsg(msg)
|
||||
.setResponseData(
|
||||
|
||||
@@ -25,7 +25,7 @@ import static google.registry.model.EppResourceUtils.createRepoId;
|
||||
import static google.registry.model.reporting.HistoryEntry.Type.HOST_CREATE;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.util.CollectionUtils.isNullOrEmpty;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
@@ -50,8 +50,8 @@ import google.registry.model.host.HostCommand.Create;
|
||||
import google.registry.model.host.HostHistory;
|
||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||
import jakarta.inject.Inject;
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* An EPP flow that creates a new host.
|
||||
@@ -100,8 +100,8 @@ public final class HostCreateFlow implements MutatingFlow {
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
Create command = (Create) resourceCommand;
|
||||
DateTime now = tm().getTransactionTime();
|
||||
verifyResourceDoesNotExist(Host.class, targetId, now, registrarId);
|
||||
Instant now = tm().getTxTime();
|
||||
verifyResourceDoesNotExist(Host.class, targetId, toDateTime(now), registrarId);
|
||||
// The superordinate domain of the host object if creating an in-bailiwick host, or null if
|
||||
// creating an external host. This is looked up before we actually create the Host object, so
|
||||
// we can detect error conditions earlier.
|
||||
@@ -142,7 +142,7 @@ public final class HostCreateFlow implements MutatingFlow {
|
||||
requestHostDnsRefresh(targetId);
|
||||
}
|
||||
tm().insertAll(entitiesToInsert);
|
||||
return responseBuilder.setResData(HostCreateData.create(targetId, toInstant(now))).build();
|
||||
return responseBuilder.setResData(HostCreateData.create(targetId, now)).build();
|
||||
}
|
||||
|
||||
/** Subordinate hosts must have an ip address. */
|
||||
|
||||
@@ -24,6 +24,7 @@ import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
||||
import static google.registry.flows.host.HostFlowUtils.validateHostName;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.flows.EppException;
|
||||
@@ -43,7 +44,7 @@ import google.registry.model.host.HostHistory;
|
||||
import google.registry.model.reporting.HistoryEntry.Type;
|
||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||
import jakarta.inject.Inject;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* An EPP flow that deletes a host.
|
||||
@@ -82,9 +83,9 @@ public final class HostDeleteFlow implements MutatingFlow {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
Instant now = tm().getTxTime();
|
||||
validateHostName(targetId);
|
||||
checkLinkedDomains(targetId, now);
|
||||
checkLinkedDomains(targetId, toDateTime(now));
|
||||
Host existingHost = loadAndVerifyExistence(Host.class, targetId, now);
|
||||
verifyNoDisallowedStatuses(existingHost, ImmutableSet.of(StatusValue.PENDING_DELETE));
|
||||
if (!isSuperuser) {
|
||||
@@ -93,7 +94,7 @@ public final class HostDeleteFlow implements MutatingFlow {
|
||||
// the client id, needs to be read off of it.
|
||||
EppResource owningResource =
|
||||
existingHost.isSubordinate()
|
||||
? tm().loadByKey(existingHost.getSuperordinateDomain()).cloneProjectedAtTime(now)
|
||||
? tm().loadByKey(existingHost.getSuperordinateDomain()).cloneProjectedAtInstant(now)
|
||||
: existingHost;
|
||||
verifyResourceOwnership(registrarId, owningResource);
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ import google.registry.model.ForeignKeyUtils;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import java.net.InetAddress;
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Static utility functions for host flows. */
|
||||
public class HostFlowUtils {
|
||||
@@ -90,8 +90,8 @@ public class HostFlowUtils {
|
||||
}
|
||||
|
||||
/** Return the {@link Domain} this host is subordinate to, or null for external hosts. */
|
||||
public static Optional<Domain> lookupSuperordinateDomain(
|
||||
InternetDomainName hostName, DateTime now) throws EppException {
|
||||
public static Optional<Domain> lookupSuperordinateDomain(InternetDomainName hostName, Instant now)
|
||||
throws EppException {
|
||||
Optional<InternetDomainName> tld = findTldForName(hostName);
|
||||
if (tld.isEmpty()) {
|
||||
// This is an host on a TLD we don't run, therefore obviously external, so we are done.
|
||||
|
||||
@@ -35,7 +35,7 @@ import google.registry.model.host.HostInfoData;
|
||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||
import google.registry.util.Clock;
|
||||
import jakarta.inject.Inject;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* An EPP flow that returns information about a host.
|
||||
@@ -64,7 +64,7 @@ public final class HostInfoFlow implements TransactionalFlow {
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateHostName(targetId);
|
||||
DateTime now = clock.nowUtc();
|
||||
Instant now = clock.now();
|
||||
Host host = loadAndVerifyExistence(Host.class, targetId, now);
|
||||
ImmutableSet.Builder<StatusValue> statusValues = new ImmutableSet.Builder<>();
|
||||
statusValues.addAll(host.getStatusValues());
|
||||
@@ -77,7 +77,7 @@ public final class HostInfoFlow implements TransactionalFlow {
|
||||
// there is no superordinate domain, the host's own values for these fields will be correct.
|
||||
if (host.isSubordinate()) {
|
||||
Domain superordinateDomain =
|
||||
tm().loadByKey(host.getSuperordinateDomain()).cloneProjectedAtTime(now);
|
||||
tm().loadByKey(host.getSuperordinateDomain()).cloneProjectedAtInstant(now);
|
||||
hostInfoDataBuilder
|
||||
.setCurrentSponsorRegistrarId(superordinateDomain.getCurrentSponsorRegistrarId())
|
||||
.setLastTransferTime(host.computeLastTransferTime(superordinateDomain));
|
||||
@@ -87,7 +87,7 @@ public final class HostInfoFlow implements TransactionalFlow {
|
||||
} else {
|
||||
hostInfoDataBuilder
|
||||
.setCurrentSponsorRegistrarId(host.getPersistedCurrentSponsorRegistrarId())
|
||||
.setLastTransferTime(host.getLastTransferTimeInstant());
|
||||
.setLastTransferTime(host.getLastTransferTime());
|
||||
}
|
||||
return responseBuilder
|
||||
.setResData(
|
||||
@@ -97,7 +97,7 @@ public final class HostInfoFlow implements TransactionalFlow {
|
||||
.setStatusValues(statusValues.build())
|
||||
.setInetAddresses(host.getInetAddresses())
|
||||
.setCreationRegistrarId(host.getCreationRegistrarId())
|
||||
.setCreationTime(host.getCreationTimeInstant())
|
||||
.setCreationTime(host.getCreationTime())
|
||||
.setLastEppUpdateRegistrarId(host.getLastEppUpdateRegistrarId())
|
||||
.setLastEppUpdateTime(host.getLastEppUpdateTime())
|
||||
.build())
|
||||
|
||||
@@ -32,7 +32,6 @@ import static google.registry.flows.host.HostFlowUtils.verifySuperordinateDomain
|
||||
import static google.registry.model.reporting.HistoryEntry.Type.HOST_UPDATE;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.util.CollectionUtils.isNullOrEmpty;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
|
||||
import com.google.cloud.tasks.v2.Task;
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
@@ -67,9 +66,9 @@ import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.request.Action;
|
||||
import jakarta.inject.Inject;
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* An EPP flow that updates a host.
|
||||
@@ -138,7 +137,7 @@ public final class HostUpdateFlow implements MutatingFlow {
|
||||
Update command = (Update) resourceCommand;
|
||||
Change change = command.getInnerChange();
|
||||
String suppliedNewHostName = change.getHostName();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
Instant now = tm().getTxTime();
|
||||
validateHostName(targetId);
|
||||
Host existingHost = loadAndVerifyExistence(Host.class, targetId, now);
|
||||
boolean isHostRename = suppliedNewHostName != null;
|
||||
@@ -146,7 +145,7 @@ public final class HostUpdateFlow implements MutatingFlow {
|
||||
String newHostName = firstNonNull(suppliedNewHostName, oldHostName);
|
||||
Domain oldSuperordinateDomain =
|
||||
existingHost.isSubordinate()
|
||||
? tm().loadByKey(existingHost.getSuperordinateDomain()).cloneProjectedAtTime(now)
|
||||
? tm().loadByKey(existingHost.getSuperordinateDomain()).cloneProjectedAtInstant(now)
|
||||
: null;
|
||||
// Note that lookupSuperordinateDomain calls cloneProjectedAtTime on the domain for us.
|
||||
Optional<Domain> newSuperordinateDomain =
|
||||
@@ -168,7 +167,7 @@ public final class HostUpdateFlow implements MutatingFlow {
|
||||
VKey<Domain> newSuperordinateDomainKey =
|
||||
newSuperordinateDomain.map(Domain::createVKey).orElse(null);
|
||||
// If the superordinateDomain field is changing, set the lastSuperordinateChange to now.
|
||||
DateTime lastSuperordinateChange =
|
||||
Instant lastSuperordinateChange =
|
||||
Objects.equals(newSuperordinateDomainKey, existingHost.getSuperordinateDomain())
|
||||
? existingHost.getLastSuperordinateChange()
|
||||
: now;
|
||||
@@ -176,8 +175,7 @@ public final class HostUpdateFlow implements MutatingFlow {
|
||||
// have just completed. This is only critical for updates that rename a host away from its
|
||||
// current superordinate domain, where we must "freeze" the last transfer time, but it's easiest
|
||||
// to just update it unconditionally.
|
||||
DateTime lastTransferTime =
|
||||
toDateTime(existingHost.computeLastTransferTime(oldSuperordinateDomain));
|
||||
Instant lastTransferTime = existingHost.computeLastTransferTime(oldSuperordinateDomain);
|
||||
// Copy the clientId onto the host. This is only really needed when the host will be external,
|
||||
// since external hosts store their own clientId. For subordinate hosts the canonical clientId
|
||||
// comes from the superordinate domain, but we might as well update the persisted value. For
|
||||
|
||||
@@ -41,8 +41,8 @@ import google.registry.persistence.IsolationLevel;
|
||||
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
||||
import google.registry.persistence.VKey;
|
||||
import jakarta.inject.Inject;
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* An EPP flow for acknowledging {@link PollMessage}s.
|
||||
@@ -83,7 +83,7 @@ public final class PollAckFlow implements MutatingFlow {
|
||||
throw new InvalidMessageIdException(messageId);
|
||||
}
|
||||
|
||||
final DateTime now = tm().getTransactionTime();
|
||||
final Instant now = tm().getTxTime();
|
||||
|
||||
// Load the message to be acked. If a message is queued to be delivered in the future, we treat
|
||||
// it as if it doesn't exist yet. Same for if the message ID year isn't the same as the actual
|
||||
|
||||
@@ -20,44 +20,20 @@ import static google.registry.persistence.transaction.QueryComposer.Comparator.L
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.util.DateTimeUtils.isBeforeOrAt;
|
||||
import static google.registry.util.DateTimeUtils.plusYears;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.persistence.transaction.QueryComposer;
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Static utility functions for poll flows. */
|
||||
public final class PollFlowUtils {
|
||||
|
||||
/**
|
||||
* Returns the number of poll messages for the given registrar that are not in the future.
|
||||
*
|
||||
* @deprecated Use {@link #getPollMessageCount(String, Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public static int getPollMessageCount(String registrarId, DateTime now) {
|
||||
return getPollMessageCount(registrarId, toInstant(now));
|
||||
}
|
||||
|
||||
/** Returns the number of poll messages for the given registrar that are not in the future. */
|
||||
public static int getPollMessageCount(String registrarId, Instant now) {
|
||||
return (int) createPollMessageQuery(registrarId, now).count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first (by event time) poll message not in the future for this registrar.
|
||||
*
|
||||
* @deprecated Use {@link #getFirstPollMessage(String, Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public static Optional<PollMessage> getFirstPollMessage(String registrarId, DateTime now) {
|
||||
return getFirstPollMessage(registrarId, toInstant(now));
|
||||
}
|
||||
|
||||
/** Returns the first (by event time) poll message not in the future for this registrar. */
|
||||
public static Optional<PollMessage> getFirstPollMessage(String registrarId, Instant now) {
|
||||
return createPollMessageQuery(registrarId, now).orderBy("eventTime").first();
|
||||
@@ -72,17 +48,17 @@ public final class PollFlowUtils {
|
||||
*/
|
||||
public static void ackPollMessage(PollMessage pollMessage) {
|
||||
checkArgument(
|
||||
isBeforeOrAt(pollMessage.getEventTimeInstant(), tm().getTxTime()),
|
||||
isBeforeOrAt(pollMessage.getEventTime(), tm().getTxTime()),
|
||||
"Cannot ACK poll message with ID %s because its event time is in the future: %s",
|
||||
pollMessage.getId(),
|
||||
pollMessage.getEventTimeInstant());
|
||||
pollMessage.getEventTime());
|
||||
if (pollMessage instanceof PollMessage.OneTime) {
|
||||
// One-time poll messages are deleted once acked.
|
||||
tm().delete(pollMessage.createVKey());
|
||||
} else if (pollMessage instanceof PollMessage.Autorenew autorenewPollMessage) {
|
||||
|
||||
// Move the eventTime of this autorenew poll message forward by a year.
|
||||
Instant nextEventTime = plusYears(autorenewPollMessage.getEventTimeInstant(), 1);
|
||||
Instant nextEventTime = plusYears(autorenewPollMessage.getEventTime(), 1);
|
||||
|
||||
// If the next event falls within the bounds of the end time, then just update the eventTime
|
||||
// and re-save it for future autorenew poll messages to be delivered. Otherwise, this
|
||||
@@ -97,19 +73,6 @@ public final class PollFlowUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the QueryComposer for poll messages from the given registrar that are not in the
|
||||
* future.
|
||||
*
|
||||
* @deprecated Use {@link #createPollMessageQuery(String, Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public static QueryComposer<PollMessage> createPollMessageQuery(
|
||||
String registrarId, DateTime now) {
|
||||
return createPollMessageQuery(registrarId, toInstant(now));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the QueryComposer for poll messages from the given registrar that are not in the
|
||||
* future.
|
||||
|
||||
@@ -77,7 +77,7 @@ public final class PollRequestFlow implements TransactionalFlow {
|
||||
.setResultFromCode(SUCCESS_WITH_ACK_MESSAGE)
|
||||
.setMessageQueueInfo(
|
||||
new MessageQueueInfo.Builder()
|
||||
.setQueueDate(pollMessage.getEventTimeInstant())
|
||||
.setQueueDate(pollMessage.getEventTime())
|
||||
.setMsg(pollMessage.getMsg())
|
||||
.setQueueLength(getPollMessageCount(registrarId, now))
|
||||
.setMessageId(makePollMessageExternalId(pollMessage))
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
package google.registry.model;
|
||||
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import google.registry.persistence.EntityCallbacksListener.RecursivePrePersist;
|
||||
@@ -25,7 +23,6 @@ import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Embeddable;
|
||||
import java.time.Instant;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** A timestamp that auto-updates when first saved to the database. */
|
||||
@Embeddable
|
||||
@@ -49,28 +46,10 @@ public class CreateAutoTimestamp extends ImmutableObject implements UnsafeSerial
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getTimestamp()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
@Nullable
|
||||
public DateTime getTimestampDateTime() {
|
||||
return toDateTime(creationTime);
|
||||
}
|
||||
|
||||
public static CreateAutoTimestamp create(@Nullable Instant creationTime) {
|
||||
CreateAutoTimestamp instance = new CreateAutoTimestamp();
|
||||
instance.creationTime = creationTime;
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #create(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public static CreateAutoTimestamp create(@Nullable DateTime creationTime) {
|
||||
return create(toInstant(creationTime));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
|
||||
import static google.registry.util.CollectionUtils.nullToEmpty;
|
||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import com.github.benmanes.caffeine.cache.CacheLoader;
|
||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||
@@ -158,16 +156,7 @@ public abstract class EppResource extends UpdateAutoTimestampEntity implements B
|
||||
this.repoId = repoId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getCreationTimeInstant()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public final DateTime getCreationTime() {
|
||||
return creationTime.getTimestampDateTime();
|
||||
}
|
||||
|
||||
public final Instant getCreationTimeInstant() {
|
||||
public final Instant getCreationTime() {
|
||||
return creationTime.getTimestamp();
|
||||
}
|
||||
|
||||
@@ -175,12 +164,6 @@ public abstract class EppResource extends UpdateAutoTimestampEntity implements B
|
||||
return creationRegistrarId;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getLastEppUpdateDateTime() {
|
||||
return toDateTime(lastEppUpdateTime);
|
||||
}
|
||||
|
||||
public Instant getLastEppUpdateTime() {
|
||||
return lastEppUpdateTime;
|
||||
}
|
||||
@@ -203,12 +186,6 @@ public abstract class EppResource extends UpdateAutoTimestampEntity implements B
|
||||
return nullToEmptyImmutableCopy(statuses);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getDeletionDateTime() {
|
||||
return toDateTime(deletionTime);
|
||||
}
|
||||
|
||||
public Instant getDeletionTime() {
|
||||
return deletionTime;
|
||||
}
|
||||
@@ -260,15 +237,6 @@ public abstract class EppResource extends UpdateAutoTimestampEntity implements B
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setCreationTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public B setCreationTime(DateTime creationTime) {
|
||||
return setCreationTime(toInstant(creationTime));
|
||||
}
|
||||
|
||||
/** Set the time this resource was created. Should only be used in tests. */
|
||||
@VisibleForTesting
|
||||
public B setCreationTimeForTest(Instant creationTime) {
|
||||
@@ -276,31 +244,12 @@ public abstract class EppResource extends UpdateAutoTimestampEntity implements B
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setCreationTimeForTest(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@VisibleForTesting
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public B setCreationTimeForTest(DateTime creationTime) {
|
||||
return setCreationTimeForTest(toInstant(creationTime));
|
||||
}
|
||||
|
||||
/** Set the time after which this resource should be considered deleted. */
|
||||
public B setDeletionTime(Instant deletionTime) {
|
||||
getInstance().deletionTime = deletionTime;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setDeletionTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public B setDeletionTime(DateTime deletionTime) {
|
||||
return setDeletionTime(toInstant(deletionTime));
|
||||
}
|
||||
|
||||
/** Set the current sponsoring registrar. */
|
||||
public B setPersistedCurrentSponsorRegistrarId(String currentSponsorRegistrarId) {
|
||||
getInstance().currentSponsorRegistrarId = currentSponsorRegistrarId;
|
||||
@@ -319,15 +268,6 @@ public abstract class EppResource extends UpdateAutoTimestampEntity implements B
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setLastEppUpdateTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public B setLastEppUpdateTime(DateTime lastEppUpdateTime) {
|
||||
return setLastEppUpdateTime(toInstant(lastEppUpdateTime));
|
||||
}
|
||||
|
||||
/** Set the registrar who last performed a {@literal <update>} on this resource. */
|
||||
public B setLastEppUpdateRegistrarId(String lastEppUpdateRegistrarId) {
|
||||
getInstance().lastEppUpdateRegistrarId = lastEppUpdateRegistrarId;
|
||||
|
||||
@@ -20,6 +20,7 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
|
||||
import static google.registry.util.DateTimeUtils.START_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.isAtOrAfter;
|
||||
import static google.registry.util.DateTimeUtils.isBeforeOrAt;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -80,7 +81,7 @@ public final class EppResourceUtils {
|
||||
}
|
||||
|
||||
public static boolean isActive(EppResource resource, Instant time) {
|
||||
return isAtOrAfter(time, resource.getCreationTimeInstant())
|
||||
return isAtOrAfter(time, resource.getCreationTime())
|
||||
&& time.isBefore(resource.getDeletionTime());
|
||||
}
|
||||
|
||||
@@ -120,7 +121,7 @@ public final class EppResourceUtils {
|
||||
builder
|
||||
.removeStatusValue(StatusValue.PENDING_TRANSFER)
|
||||
.setTransferData(transferDataBuilder.build())
|
||||
.setLastTransferTime(transferData.getPendingTransferExpirationDateTime())
|
||||
.setLastTransferTime(toDateTime(transferData.getPendingTransferExpirationTime()))
|
||||
.setPersistedCurrentSponsorRegistrarId(transferData.getGainingRegistrarId());
|
||||
}
|
||||
|
||||
@@ -157,7 +158,7 @@ public final class EppResourceUtils {
|
||||
public static <T extends EppResource> T loadAtPointInTime(
|
||||
final T resource, final Instant timestamp) {
|
||||
// If we're before the resource creation time, don't try to find a "most recent revision".
|
||||
if (timestamp.isBefore(resource.getCreationTimeInstant())) {
|
||||
if (timestamp.isBefore(resource.getCreationTime())) {
|
||||
return null;
|
||||
}
|
||||
// If the resource was not modified after the requested time, then use it as-is, otherwise find
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package google.registry.model;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
@@ -53,11 +52,11 @@ public final class ResourceTransferUtils {
|
||||
.setDomainName(domain.getForeignKey())
|
||||
.setExtendedRegistrationExpirationTime(
|
||||
ADD_EXDATE_STATUSES.contains(transferData.getTransferStatus())
|
||||
? transferData.getTransferredRegistrationExpirationDateTime()
|
||||
? transferData.getTransferredRegistrationExpirationTime()
|
||||
: null)
|
||||
.setGainingRegistrarId(transferData.getGainingRegistrarId())
|
||||
.setLosingRegistrarId(transferData.getLosingRegistrarId())
|
||||
.setPendingTransferExpirationTime(transferData.getPendingTransferExpirationDateTime())
|
||||
.setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime())
|
||||
.setTransferRequestTime(transferData.getTransferRequestTime())
|
||||
.setTransferStatus(transferData.getTransferStatus())
|
||||
.build();
|
||||
@@ -145,7 +144,7 @@ public final class ResourceTransferUtils {
|
||||
.getTransferData()
|
||||
.copyConstantFieldsToBuilder()
|
||||
.setTransferStatus(transferStatus)
|
||||
.setPendingTransferExpirationTime(toDateTime(checkNotNull(now)))
|
||||
.setPendingTransferExpirationTime(now)
|
||||
.build());
|
||||
}
|
||||
|
||||
@@ -191,7 +190,7 @@ public final class ResourceTransferUtils {
|
||||
Domain domain, TransferStatus transferStatus, Instant now, String lastEppUpdateRegistrarId) {
|
||||
checkArgument(transferStatus.isDenied(), "Not a denial transfer status");
|
||||
return resolvePendingTransfer(domain, transferStatus, now)
|
||||
.setLastEppUpdateTime(toDateTime(now))
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateRegistrarId(lastEppUpdateRegistrarId)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@ package google.registry.model;
|
||||
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.util.DateTimeUtils.START_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import google.registry.persistence.EntityCallbacksListener.RecursivePrePersist;
|
||||
import google.registry.persistence.EntityCallbacksListener.RecursivePreUpdate;
|
||||
@@ -26,7 +24,6 @@ import jakarta.persistence.Embeddable;
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** A timestamp that auto-updates on each save to Cloud SQL. */
|
||||
@Embeddable
|
||||
@@ -49,27 +46,10 @@ public class UpdateAutoTimestamp extends ImmutableObject implements UnsafeSerial
|
||||
return Optional.ofNullable(lastUpdateTime).orElse(START_INSTANT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getTimestamp()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getTimestampDateTime() {
|
||||
return toDateTime(getTimestamp());
|
||||
}
|
||||
|
||||
public static UpdateAutoTimestamp create(@Nullable Instant timestamp) {
|
||||
UpdateAutoTimestamp instance = new UpdateAutoTimestamp();
|
||||
instance.lastUpdateTime = timestamp;
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #create(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public static UpdateAutoTimestamp create(@Nullable DateTime timestamp) {
|
||||
return create(toInstant(timestamp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ package google.registry.model.billing;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static google.registry.util.CollectionUtils.forceEmptyToNull;
|
||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -38,7 +36,6 @@ import jakarta.persistence.MappedSuperclass;
|
||||
import java.time.Instant;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** A billable event in a domain's lifecycle. */
|
||||
@MappedSuperclass
|
||||
@@ -173,16 +170,7 @@ public abstract class BillingBase extends ImmutableObject
|
||||
return domainRepoId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getEventTimeInstant()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getEventTime() {
|
||||
return toDateTime(eventTime);
|
||||
}
|
||||
|
||||
public Instant getEventTimeInstant() {
|
||||
public Instant getEventTime() {
|
||||
return eventTime;
|
||||
}
|
||||
|
||||
@@ -238,15 +226,6 @@ public abstract class BillingBase extends ImmutableObject
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setEventTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public B setEventTime(DateTime eventTime) {
|
||||
return setEventTime(toInstant(eventTime));
|
||||
}
|
||||
|
||||
public B setEventTime(Instant eventTime) {
|
||||
getInstance().eventTime = eventTime;
|
||||
return thisCastToDerived();
|
||||
|
||||
@@ -31,7 +31,7 @@ import jakarta.persistence.Convert;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Index;
|
||||
import jakarta.persistence.Table;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* An event representing a cancellation of one of the other two billable event types.
|
||||
@@ -55,7 +55,7 @@ import org.joda.time.DateTime;
|
||||
public class BillingCancellation extends BillingBase {
|
||||
|
||||
/** The billing time of the charge that is being cancelled. */
|
||||
DateTime billingTime;
|
||||
Instant billingTime;
|
||||
|
||||
/** The one-time billing event to cancel, or null for autorenew cancellations. */
|
||||
@Column(name = "billing_event_id")
|
||||
@@ -67,7 +67,7 @@ public class BillingCancellation extends BillingBase {
|
||||
@Convert(converter = VKeyConverter_BillingRecurrence.class)
|
||||
VKey<BillingRecurrence> billingRecurrence;
|
||||
|
||||
public DateTime getBillingTime() {
|
||||
public Instant getBillingTime() {
|
||||
return billingTime;
|
||||
}
|
||||
|
||||
@@ -90,10 +90,7 @@ public class BillingCancellation extends BillingBase {
|
||||
* reason) from the grace period.
|
||||
*/
|
||||
public static BillingCancellation forGracePeriod(
|
||||
GracePeriod gracePeriod,
|
||||
DateTime eventTime,
|
||||
HistoryEntryId domainHistoryId,
|
||||
String targetId) {
|
||||
GracePeriod gracePeriod, Instant eventTime, HistoryEntryId domainHistoryId, String targetId) {
|
||||
checkArgument(
|
||||
gracePeriod.hasBillingEvent(),
|
||||
"Cannot create cancellation for grace period without billing event");
|
||||
@@ -104,7 +101,7 @@ public class BillingCancellation extends BillingBase {
|
||||
.setRegistrarId(gracePeriod.getRegistrarId())
|
||||
.setEventTime(eventTime)
|
||||
// The charge being cancelled will take place at the grace period's expiration time.
|
||||
.setBillingTime(gracePeriod.getExpirationDateTime())
|
||||
.setBillingTime(gracePeriod.getExpirationTime())
|
||||
.setDomainHistoryId(domainHistoryId);
|
||||
// Set the grace period's billing event using the appropriate Cancellation builder method.
|
||||
if (gracePeriod.getBillingEvent() != null) {
|
||||
@@ -138,7 +135,7 @@ public class BillingCancellation extends BillingBase {
|
||||
super(instance);
|
||||
}
|
||||
|
||||
public Builder setBillingTime(DateTime billingTime) {
|
||||
public Builder setBillingTime(Instant billingTime) {
|
||||
getInstance().billingTime = billingTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ package google.registry.model.billing;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.domain.token.AllocationToken;
|
||||
@@ -35,7 +33,6 @@ import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.money.Money;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** A one-time billable event. */
|
||||
@Entity
|
||||
@@ -108,16 +105,7 @@ public class BillingEvent extends BillingBase {
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getBillingTimeInstant()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getBillingTime() {
|
||||
return toDateTime(billingTime);
|
||||
}
|
||||
|
||||
public Instant getBillingTimeInstant() {
|
||||
public Instant getBillingTime() {
|
||||
return billingTime;
|
||||
}
|
||||
|
||||
@@ -125,16 +113,7 @@ public class BillingEvent extends BillingBase {
|
||||
return periodYears;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getSyntheticCreationTimeInstant()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getSyntheticCreationTime() {
|
||||
return toDateTime(syntheticCreationTime);
|
||||
}
|
||||
|
||||
public Instant getSyntheticCreationTimeInstant() {
|
||||
public Instant getSyntheticCreationTime() {
|
||||
return syntheticCreationTime;
|
||||
}
|
||||
|
||||
@@ -185,29 +164,11 @@ public class BillingEvent extends BillingBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setBillingTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public Builder setBillingTime(DateTime billingTime) {
|
||||
return setBillingTime(toInstant(billingTime));
|
||||
}
|
||||
|
||||
public Builder setBillingTime(Instant billingTime) {
|
||||
getInstance().billingTime = billingTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setSyntheticCreationTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public Builder setSyntheticCreationTime(DateTime syntheticCreationTime) {
|
||||
return setSyntheticCreationTime(toInstant(syntheticCreationTime));
|
||||
}
|
||||
|
||||
public Builder setSyntheticCreationTime(Instant syntheticCreationTime) {
|
||||
getInstance().syntheticCreationTime = syntheticCreationTime;
|
||||
return this;
|
||||
|
||||
@@ -18,8 +18,6 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.minusYears;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import google.registry.model.common.TimeOfYear;
|
||||
import google.registry.persistence.VKey;
|
||||
@@ -37,7 +35,6 @@ import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.money.Money;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* A recurring billable event.
|
||||
@@ -113,29 +110,11 @@ public class BillingRecurrence extends BillingBase {
|
||||
@Column(name = "renewalPriceBehavior", nullable = false)
|
||||
RenewalPriceBehavior renewalPriceBehavior = RenewalPriceBehavior.DEFAULT;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getRecurrenceEndTimeInstant()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getRecurrenceEndTime() {
|
||||
return toDateTime(recurrenceEndTime);
|
||||
}
|
||||
|
||||
public Instant getRecurrenceEndTimeInstant() {
|
||||
public Instant getRecurrenceEndTime() {
|
||||
return recurrenceEndTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getRecurrenceLastExpansionInstant()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getRecurrenceLastExpansion() {
|
||||
return toDateTime(recurrenceLastExpansion);
|
||||
}
|
||||
|
||||
public Instant getRecurrenceLastExpansionInstant() {
|
||||
public Instant getRecurrenceLastExpansion() {
|
||||
return recurrenceLastExpansion;
|
||||
}
|
||||
|
||||
@@ -174,29 +153,11 @@ public class BillingRecurrence extends BillingBase {
|
||||
super(instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setRecurrenceEndTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public Builder setRecurrenceEndTime(DateTime recurrenceEndTime) {
|
||||
return setRecurrenceEndTime(toInstant(recurrenceEndTime));
|
||||
}
|
||||
|
||||
public Builder setRecurrenceEndTime(Instant recurrenceEndTime) {
|
||||
getInstance().recurrenceEndTime = recurrenceEndTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setRecurrenceLastExpansion(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public Builder setRecurrenceLastExpansion(DateTime recurrenceLastExpansion) {
|
||||
return setRecurrenceLastExpansion(toInstant(recurrenceLastExpansion));
|
||||
}
|
||||
|
||||
public Builder setRecurrenceLastExpansion(Instant recurrenceLastExpansion) {
|
||||
getInstance().recurrenceLastExpansion = recurrenceLastExpansion;
|
||||
return this;
|
||||
|
||||
@@ -17,16 +17,12 @@ package google.registry.model.common;
|
||||
import static com.google.common.collect.DiscreteDomain.integers;
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.START_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.isAtOrAfter;
|
||||
import static google.registry.util.DateTimeUtils.isBeforeOrAt;
|
||||
import static google.registry.util.DateTimeUtils.minusYears;
|
||||
import static google.registry.util.DateTimeUtils.plusYears;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
import static java.time.ZoneOffset.UTC;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ContiguousSet;
|
||||
@@ -37,10 +33,8 @@ import jakarta.persistence.Embeddable;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* A time of year (month, day, millis of day) that can be stored in a sort-friendly format.
|
||||
@@ -62,20 +56,6 @@ public class TimeOfYear extends ImmutableObject implements UnsafeSerializable {
|
||||
*/
|
||||
String timeString;
|
||||
|
||||
/**
|
||||
* Constructs a {@link TimeOfYear} from a {@link DateTime}.
|
||||
*
|
||||
* <p>This handles leap years in an intentionally peculiar way by always treating February 29 as
|
||||
* February 28. It is impossible to construct a {@link TimeOfYear} for February 29th.
|
||||
*
|
||||
* @deprecated Use {@link #fromInstant(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public static TimeOfYear fromDateTime(DateTime dateTime) {
|
||||
return fromInstant(toInstant(dateTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a {@link TimeOfYear} from an {@link Instant}.
|
||||
*
|
||||
@@ -83,7 +63,7 @@ public class TimeOfYear extends ImmutableObject implements UnsafeSerializable {
|
||||
* February 28. It is impossible to construct a {@link TimeOfYear} for February 29th.
|
||||
*/
|
||||
public static TimeOfYear fromInstant(Instant instant) {
|
||||
ZonedDateTime zdt = ZonedDateTime.ofInstant(instant, ZoneOffset.UTC);
|
||||
ZonedDateTime zdt = ZonedDateTime.ofInstant(instant, UTC);
|
||||
int month = zdt.getMonthValue();
|
||||
int day = zdt.getDayOfMonth();
|
||||
if (month == 2 && day == 29) {
|
||||
@@ -95,30 +75,6 @@ public class TimeOfYear extends ImmutableObject implements UnsafeSerializable {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an {@link Iterable} of {@link DateTime}s of every recurrence of this particular time of
|
||||
* year within a given {@link Range} (usually one spanning many years).
|
||||
*
|
||||
* <p>WARNING: This can return a potentially very large {@link Iterable} if {@code END_OF_TIME} is
|
||||
* used as the upper endpoint of the range.
|
||||
*
|
||||
* @deprecated Use {@link #getInstancesInRangeInstant(Range)}
|
||||
*/
|
||||
@Deprecated
|
||||
public Iterable<DateTime> getInstancesInRange(Range<DateTime> range) {
|
||||
// In registry world, all dates are within START_OF_TIME and END_OF_TIME, so restrict any
|
||||
// ranges without bounds to our notion of zero-to-infinity.
|
||||
Range<DateTime> normalizedRange = range.intersection(Range.closed(START_OF_TIME, END_OF_TIME));
|
||||
Range<Integer> yearRange = Range.closed(
|
||||
normalizedRange.lowerEndpoint().getYear(),
|
||||
normalizedRange.upperEndpoint().getYear());
|
||||
return ContiguousSet.create(yearRange, integers())
|
||||
.stream()
|
||||
.map(this::getDateTimeWithYear)
|
||||
.filter(normalizedRange)
|
||||
.collect(toImmutableList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an {@link Iterable} of {@link Instant}s of every recurrence of this particular time of
|
||||
* year within a given {@link Range} (usually one spanning many years).
|
||||
@@ -126,14 +82,14 @@ public class TimeOfYear extends ImmutableObject implements UnsafeSerializable {
|
||||
* <p>WARNING: This can return a potentially very large {@link Iterable} if {@code END_INSTANT} is
|
||||
* used as the upper endpoint of the range.
|
||||
*/
|
||||
public Iterable<Instant> getInstancesInRangeInstant(Range<Instant> range) {
|
||||
public Iterable<Instant> getInstancesInRange(Range<Instant> range) {
|
||||
// In registry world, all dates are within START_INSTANT and END_INSTANT, so restrict any
|
||||
// ranges without bounds to our notion of zero-to-infinity.
|
||||
Range<Instant> normalizedRange = range.intersection(Range.closed(START_INSTANT, END_INSTANT));
|
||||
Range<Integer> yearRange =
|
||||
Range.closed(
|
||||
ZonedDateTime.ofInstant(normalizedRange.lowerEndpoint(), ZoneOffset.UTC).getYear(),
|
||||
ZonedDateTime.ofInstant(normalizedRange.upperEndpoint(), ZoneOffset.UTC).getYear());
|
||||
ZonedDateTime.ofInstant(normalizedRange.lowerEndpoint(), UTC).getYear(),
|
||||
ZonedDateTime.ofInstant(normalizedRange.upperEndpoint(), UTC).getYear());
|
||||
return ContiguousSet.create(yearRange, integers()).stream()
|
||||
.map(this::toInstantWithYear)
|
||||
.filter(normalizedRange)
|
||||
@@ -151,57 +107,19 @@ public class TimeOfYear extends ImmutableObject implements UnsafeSerializable {
|
||||
int millis = Integer.parseInt(monthDayMillis.get(2));
|
||||
return LocalDate.of(year, month, day)
|
||||
.atTime(LocalTime.ofNanoOfDay(millis * 1000000L))
|
||||
.toInstant(ZoneOffset.UTC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first {@link DateTime} with this month/day/millis that is at or after the start.
|
||||
*
|
||||
* @deprecated Use {@link #getNextInstanceAtOrAfterInstant(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getNextInstanceAtOrAfter(DateTime start) {
|
||||
return toDateTime(getNextInstanceAtOrAfterInstant(toInstant(start)));
|
||||
.toInstant(UTC);
|
||||
}
|
||||
|
||||
/** Get the first {@link Instant} with this month/day/millis that is at or after the start. */
|
||||
public Instant getNextInstanceAtOrAfterInstant(Instant start) {
|
||||
Instant withSameYear =
|
||||
toInstantWithYear(ZonedDateTime.ofInstant(start, ZoneOffset.UTC).getYear());
|
||||
public Instant getNextInstanceAtOrAfter(Instant start) {
|
||||
Instant withSameYear = toInstantWithYear(ZonedDateTime.ofInstant(start, UTC).getYear());
|
||||
return isAtOrAfter(withSameYear, start) ? withSameYear : plusYears(withSameYear, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first {@link DateTime} with this month/day/millis that is at or before the end.
|
||||
*
|
||||
* @deprecated Use {@link #getLastInstanceBeforeOrAtInstant(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getLastInstanceBeforeOrAt(DateTime end) {
|
||||
return toDateTime(getLastInstanceBeforeOrAtInstant(toInstant(end)));
|
||||
}
|
||||
|
||||
/** Get the first {@link Instant} with this month/day/millis that is at or before the end. */
|
||||
public Instant getLastInstanceBeforeOrAtInstant(Instant end) {
|
||||
Instant withSameYear =
|
||||
toInstantWithYear(ZonedDateTime.ofInstant(end, ZoneOffset.UTC).getYear());
|
||||
public Instant getLastInstanceBeforeOrAt(Instant end) {
|
||||
Instant withSameYear = toInstantWithYear(ZonedDateTime.ofInstant(end, UTC).getYear());
|
||||
return isBeforeOrAt(withSameYear, end) ? withSameYear : minusYears(withSameYear, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new datetime with the same year as the parameter but projected to the month, day, and
|
||||
* time of day of this object.
|
||||
*/
|
||||
private DateTime getDateTimeWithYear(int year) {
|
||||
List<String> monthDayMillis = Splitter.on(' ').splitToList(timeString);
|
||||
// Do not be clever and use Ints.stringConverter here. That does radix guessing, and bad things
|
||||
// will happen because of the leading zeroes.
|
||||
return new DateTime(0, UTC)
|
||||
.withYear(year)
|
||||
.withMonthOfYear(Integer.parseInt(monthDayMillis.get(0)))
|
||||
.withDayOfMonth(Integer.parseInt(monthDayMillis.get(1)))
|
||||
.withMillisOfDay(Integer.parseInt(monthDayMillis.get(2)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ public class DomainBase extends EppResource {
|
||||
// Set all remaining transfer properties.
|
||||
setAutomaticTransferSuccessProperties(builder, transferData);
|
||||
builder
|
||||
.setLastEppUpdateTime(toDateTime(transferExpirationTime))
|
||||
.setLastEppUpdateTime(transferExpirationTime)
|
||||
.setLastEppUpdateRegistrarId(transferData.getGainingRegistrarId());
|
||||
// Finish projecting to now.
|
||||
return (T) builder.build().cloneProjectedAtInstant(now);
|
||||
@@ -592,10 +592,10 @@ public class DomainBase extends EppResource {
|
||||
// id, so we have to do the comparison instead of having one variable just storing the most
|
||||
// recent time.
|
||||
if (newLastEppUpdateTime.isPresent()) {
|
||||
if (domain.getLastEppUpdateDateTime() == null
|
||||
if (domain.getLastEppUpdateTime() == null
|
||||
|| newLastEppUpdateTime.get().isAfter(domain.getLastEppUpdateTime())) {
|
||||
builder
|
||||
.setLastEppUpdateTime(toDateTime(newLastEppUpdateTime.get()))
|
||||
.setLastEppUpdateTime(newLastEppUpdateTime.get())
|
||||
.setLastEppUpdateRegistrarId(domain.getCurrentSponsorRegistrarId());
|
||||
}
|
||||
}
|
||||
@@ -893,13 +893,13 @@ public class DomainBase extends EppResource {
|
||||
.setDomainName(domainBase.getDomainName())
|
||||
.setDeletePollMessage(domainBase.getDeletePollMessage())
|
||||
.setDsData(domainBase.getDsData())
|
||||
.setDeletionTime(domainBase.getDeletionDateTime())
|
||||
.setDeletionTime(domainBase.getDeletionTime())
|
||||
.setGracePeriods(domainBase.getGracePeriods())
|
||||
.setIdnTableName(domainBase.getIdnTableName())
|
||||
.setLastTransferTime(domainBase.getLastTransferTime())
|
||||
.setLaunchNotice(domainBase.getLaunchNotice())
|
||||
.setLastEppUpdateRegistrarId(domainBase.getLastEppUpdateRegistrarId())
|
||||
.setLastEppUpdateTime(domainBase.getLastEppUpdateDateTime())
|
||||
.setLastEppUpdateTime(domainBase.getLastEppUpdateTime())
|
||||
.setNameservers(domainBase.getNameservers())
|
||||
.setPersistedCurrentSponsorRegistrarId(domainBase.getPersistedCurrentSponsorRegistrarId())
|
||||
.setRegistrationExpirationTime(domainBase.getRegistrationExpirationDateTime())
|
||||
|
||||
@@ -16,7 +16,6 @@ package google.registry.model.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@@ -33,7 +32,6 @@ import jakarta.persistence.Index;
|
||||
import jakarta.persistence.Table;
|
||||
import java.time.Instant;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* A domain grace period with an expiration time.
|
||||
@@ -100,22 +98,6 @@ public class GracePeriod extends GracePeriodBase {
|
||||
type, domainRepoId, expirationTime, registrarId, billingEventOneTime, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a GracePeriod for an (optional) OneTime billing event.
|
||||
*
|
||||
* @deprecated Use {@link #create(GracePeriodStatus, String, Instant, String, VKey)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public static GracePeriod create(
|
||||
GracePeriodStatus type,
|
||||
String domainRepoId,
|
||||
DateTime expirationTime,
|
||||
String registrarId,
|
||||
@Nullable VKey<BillingEvent> billingEventOneTime) {
|
||||
return create(type, domainRepoId, toInstant(expirationTime), registrarId, billingEventOneTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a GracePeriod for an (optional) OneTime billing event and a given {@link
|
||||
* #gracePeriodId}.
|
||||
@@ -136,31 +118,6 @@ public class GracePeriod extends GracePeriodBase {
|
||||
type, domainRepoId, expirationTime, registrarId, billingEventOneTime, null, gracePeriodId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a GracePeriod for an (optional) OneTime billing event and a given {@link
|
||||
* #gracePeriodId}.
|
||||
*
|
||||
* @deprecated Use {@link #create(GracePeriodStatus, String, Instant, String, VKey, Long)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
@VisibleForTesting
|
||||
public static GracePeriod create(
|
||||
GracePeriodStatus type,
|
||||
String domainRepoId,
|
||||
DateTime expirationTime,
|
||||
String registrarId,
|
||||
@Nullable VKey<BillingEvent> billingEventOneTime,
|
||||
@Nullable Long gracePeriodId) {
|
||||
return create(
|
||||
type,
|
||||
domainRepoId,
|
||||
toInstant(expirationTime),
|
||||
registrarId,
|
||||
billingEventOneTime,
|
||||
gracePeriodId);
|
||||
}
|
||||
|
||||
public static GracePeriod createFromHistory(GracePeriodHistory history) {
|
||||
return createInternal(
|
||||
history.type,
|
||||
@@ -184,23 +141,6 @@ public class GracePeriod extends GracePeriodBase {
|
||||
type, domainRepoId, expirationTime, registrarId, null, billingEventRecurrence, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a GracePeriod for a Recurrence billing event.
|
||||
*
|
||||
* @deprecated Use {@link #createForRecurrence(GracePeriodStatus, String, Instant, String, VKey)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public static GracePeriod createForRecurrence(
|
||||
GracePeriodStatus type,
|
||||
String domainRepoId,
|
||||
DateTime expirationTime,
|
||||
String registrarId,
|
||||
VKey<BillingRecurrence> billingEventRecurrence) {
|
||||
return createForRecurrence(
|
||||
type, domainRepoId, toInstant(expirationTime), registrarId, billingEventRecurrence);
|
||||
}
|
||||
|
||||
/** Creates a GracePeriod for a Recurrence billing event and a given {@link #gracePeriodId}. */
|
||||
@VisibleForTesting
|
||||
public static GracePeriod createForRecurrence(
|
||||
@@ -221,56 +161,19 @@ public class GracePeriod extends GracePeriodBase {
|
||||
gracePeriodId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a GracePeriod for a Recurrence billing event and a given {@link #gracePeriodId}.
|
||||
*
|
||||
* @deprecated Use {@link #createForRecurrence(GracePeriodStatus, String, Instant, String, VKey,
|
||||
* Long)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
@VisibleForTesting
|
||||
public static GracePeriod createForRecurrence(
|
||||
GracePeriodStatus type,
|
||||
String domainRepoId,
|
||||
DateTime expirationTime,
|
||||
String registrarId,
|
||||
VKey<BillingRecurrence> billingEventRecurrence,
|
||||
@Nullable Long gracePeriodId) {
|
||||
return createForRecurrence(
|
||||
type,
|
||||
domainRepoId,
|
||||
toInstant(expirationTime),
|
||||
registrarId,
|
||||
billingEventRecurrence,
|
||||
gracePeriodId);
|
||||
}
|
||||
|
||||
/** Creates a GracePeriod with no billing event. */
|
||||
public static GracePeriod createWithoutBillingEvent(
|
||||
GracePeriodStatus type, String domainRepoId, Instant expirationTime, String registrarId) {
|
||||
return createInternal(type, domainRepoId, expirationTime, registrarId, null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a GracePeriod with no billing event.
|
||||
*
|
||||
* @deprecated Use {@link #createWithoutBillingEvent(GracePeriodStatus, String, Instant, String)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public static GracePeriod createWithoutBillingEvent(
|
||||
GracePeriodStatus type, String domainRepoId, DateTime expirationTime, String registrarId) {
|
||||
return createWithoutBillingEvent(type, domainRepoId, toInstant(expirationTime), registrarId);
|
||||
}
|
||||
|
||||
/** Constructs a GracePeriod of the given type from the provided one-time BillingEvent. */
|
||||
public static GracePeriod forBillingEvent(
|
||||
GracePeriodStatus type, String domainRepoId, BillingEvent billingEvent) {
|
||||
return create(
|
||||
type,
|
||||
domainRepoId,
|
||||
billingEvent.getBillingTimeInstant(),
|
||||
billingEvent.getBillingTime(),
|
||||
billingEvent.getRegistrarId(),
|
||||
billingEvent.createVKey());
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package google.registry.model.domain;
|
||||
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.UnsafeSerializable;
|
||||
@@ -33,7 +32,6 @@ import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import jakarta.persistence.Transient;
|
||||
import java.time.Instant;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Base class containing common fields and methods for {@link GracePeriod}. */
|
||||
@MappedSuperclass
|
||||
@@ -93,12 +91,6 @@ public class GracePeriodBase extends ImmutableObject implements UnsafeSerializab
|
||||
return domainRepoId;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getExpirationDateTime() {
|
||||
return toDateTime(expirationTime);
|
||||
}
|
||||
|
||||
public Instant getExpirationTime() {
|
||||
return expirationTime;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@ package google.registry.model.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static google.registry.util.DateTimeUtils.isBeforeOrAt;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
@@ -38,11 +36,10 @@ import jakarta.persistence.Index;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
|
||||
/**
|
||||
* Represents a registry lock/unlock object, meaning that the domain is locked on the registry
|
||||
@@ -124,19 +121,19 @@ public final class RegistryLock extends UpdateAutoTimestampEntity implements Bui
|
||||
private final CreateAutoTimestamp lockRequestTime = CreateAutoTimestamp.create((Instant) null);
|
||||
|
||||
/** When the unlock is first requested. */
|
||||
@Expose private DateTime unlockRequestTime;
|
||||
@Expose private Instant unlockRequestTime;
|
||||
|
||||
/**
|
||||
* When the user has verified the lock. If this field is null, it means the lock has not been
|
||||
* verified yet (and thus not been put into effect).
|
||||
*/
|
||||
@Expose private DateTime lockCompletionTime;
|
||||
@Expose private Instant lockCompletionTime;
|
||||
|
||||
/**
|
||||
* When the user has verified the unlock of this lock. If this field is null, it means the unlock
|
||||
* action has not been verified yet (and has not been put into effect).
|
||||
*/
|
||||
@Expose private DateTime unlockCompletionTime;
|
||||
@Expose private Instant unlockCompletionTime;
|
||||
|
||||
/** The user must provide the random verification code in order to complete the action. */
|
||||
@Column(nullable = false)
|
||||
@@ -158,7 +155,7 @@ public final class RegistryLock extends UpdateAutoTimestampEntity implements Bui
|
||||
|
||||
/** The duration after which we will re-lock this domain after it is unlocked. */
|
||||
@Column(columnDefinition = "interval")
|
||||
private Duration relockDuration;
|
||||
private org.joda.time.Duration relockDuration;
|
||||
|
||||
public String getRepoId() {
|
||||
return repoId;
|
||||
@@ -180,29 +177,20 @@ public final class RegistryLock extends UpdateAutoTimestampEntity implements Bui
|
||||
return lockRequestTime.getTimestamp();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getLockRequestTime()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getLockRequestDateTime() {
|
||||
return toDateTime(lockRequestTime.getTimestamp());
|
||||
}
|
||||
|
||||
/** Returns the unlock request timestamp or null if an unlock has not been requested yet. */
|
||||
public Optional<DateTime> getUnlockRequestTime() {
|
||||
public Optional<Instant> getUnlockRequestTime() {
|
||||
return Optional.ofNullable(unlockRequestTime);
|
||||
}
|
||||
|
||||
/** Returns the completion timestamp, or empty if this lock has not been completed yet. */
|
||||
public Optional<DateTime> getLockCompletionTime() {
|
||||
public Optional<Instant> getLockCompletionTime() {
|
||||
return Optional.ofNullable(lockCompletionTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unlock completion timestamp, or empty if this unlock has not been completed yet.
|
||||
*/
|
||||
public Optional<DateTime> getUnlockCompletionTime() {
|
||||
public Optional<Instant> getUnlockCompletionTime() {
|
||||
return Optional.ofNullable(unlockCompletionTime);
|
||||
}
|
||||
|
||||
@@ -214,8 +202,8 @@ public final class RegistryLock extends UpdateAutoTimestampEntity implements Bui
|
||||
return isSuperuser;
|
||||
}
|
||||
|
||||
public DateTime getLastUpdateTime() {
|
||||
return getUpdateTimestamp().getTimestampDateTime();
|
||||
public Instant getLastUpdateTime() {
|
||||
return getUpdateTimestamp().getTimestamp();
|
||||
}
|
||||
|
||||
public Long getRevisionId() {
|
||||
@@ -233,7 +221,7 @@ public final class RegistryLock extends UpdateAutoTimestampEntity implements Bui
|
||||
}
|
||||
|
||||
/** The duration after which we will re-lock this domain after it is unlocked. */
|
||||
public Optional<Duration> getRelockDuration() {
|
||||
public Optional<org.joda.time.Duration> getRelockDuration() {
|
||||
return Optional.ofNullable(relockDuration);
|
||||
}
|
||||
|
||||
@@ -241,41 +229,18 @@ public final class RegistryLock extends UpdateAutoTimestampEntity implements Bui
|
||||
return lockCompletionTime != null && unlockCompletionTime == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true iff the lock was requested >= 1 hour ago and has not been verified.
|
||||
*
|
||||
* @deprecated Use {@link #isLockRequestExpired(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public boolean isLockRequestExpired(DateTime now) {
|
||||
return isLockRequestExpired(toInstant(now));
|
||||
}
|
||||
|
||||
/** Returns true iff the lock was requested >= 1 hour ago and has not been verified. */
|
||||
public boolean isLockRequestExpired(Instant now) {
|
||||
return getLockCompletionTime().isEmpty()
|
||||
&& isBeforeOrAt(getLockRequestTime(), now.minus(java.time.Duration.ofHours(1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true iff the unlock was requested >= 1 hour ago and has not been verified.
|
||||
*
|
||||
* @deprecated Use {@link #isUnlockRequestExpired(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public boolean isUnlockRequestExpired(DateTime now) {
|
||||
return isUnlockRequestExpired(toInstant(now));
|
||||
&& isBeforeOrAt(getLockRequestTime(), now.minus(Duration.ofHours(1)));
|
||||
}
|
||||
|
||||
/** Returns true iff the unlock was requested >= 1 hour ago and has not been verified. */
|
||||
public boolean isUnlockRequestExpired(Instant now) {
|
||||
Optional<DateTime> unlockRequestTimestamp = getUnlockRequestTime();
|
||||
Optional<Instant> unlockRequestTimestamp = getUnlockRequestTime();
|
||||
return unlockRequestTimestamp.isPresent()
|
||||
&& getUnlockCompletionTime().isEmpty()
|
||||
&& isBeforeOrAt(
|
||||
toInstant(unlockRequestTimestamp.get()), now.minus(java.time.Duration.ofHours(1)));
|
||||
&& isBeforeOrAt(unlockRequestTimestamp.get(), now.minus(Duration.ofHours(1)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -323,17 +288,17 @@ public final class RegistryLock extends UpdateAutoTimestampEntity implements Bui
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setUnlockRequestTime(DateTime unlockRequestTime) {
|
||||
public Builder setUnlockRequestTime(Instant unlockRequestTime) {
|
||||
getInstance().unlockRequestTime = unlockRequestTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setLockCompletionTime(DateTime lockCompletionTime) {
|
||||
public Builder setLockCompletionTime(Instant lockCompletionTime) {
|
||||
getInstance().lockCompletionTime = lockCompletionTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setUnlockCompletionTime(DateTime unlockCompletionTime) {
|
||||
public Builder setUnlockCompletionTime(Instant unlockCompletionTime) {
|
||||
getInstance().unlockCompletionTime = unlockCompletionTime;
|
||||
return this;
|
||||
}
|
||||
@@ -353,7 +318,7 @@ public final class RegistryLock extends UpdateAutoTimestampEntity implements Bui
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setRelockDuration(@Nullable Duration relockDuration) {
|
||||
public Builder setRelockDuration(@Nullable org.joda.time.Duration relockDuration) {
|
||||
getInstance().relockDuration = relockDuration;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -342,9 +342,9 @@ public class AllocationToken extends UpdateAutoTimestampEntity implements Builda
|
||||
/**
|
||||
* @deprecated Use {@link #getCreationTime()}
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
@JsonIgnore
|
||||
public Optional<DateTime> getCreationDateTime() {
|
||||
return Optional.ofNullable(toDateTime(creationTime.getTimestamp()));
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ import static com.google.common.collect.Sets.difference;
|
||||
import static com.google.common.collect.Sets.union;
|
||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||
import static google.registry.util.DateTimeUtils.START_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static google.registry.util.DomainNameUtils.canonicalizeHostname;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -29,6 +27,7 @@ import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.VKeyConverter_Domain;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.persistence.converter.InetAddressSetUserType;
|
||||
import google.registry.util.DateTimeUtils;
|
||||
import jakarta.persistence.Access;
|
||||
import jakarta.persistence.AccessType;
|
||||
import jakarta.persistence.Column;
|
||||
@@ -109,29 +108,11 @@ public class HostBase extends EppResource {
|
||||
return nullToEmptyImmutableCopy(inetAddresses);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getLastTransferTimeInstant()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getLastTransferTime() {
|
||||
return toDateTime(lastTransferTime);
|
||||
}
|
||||
|
||||
public Instant getLastTransferTimeInstant() {
|
||||
public Instant getLastTransferTime() {
|
||||
return lastTransferTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getLastSuperordinateChangeInstant()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getLastSuperordinateChange() {
|
||||
return toDateTime(lastSuperordinateChange);
|
||||
}
|
||||
|
||||
public Instant getLastSuperordinateChangeInstant() {
|
||||
public Instant getLastSuperordinateChange() {
|
||||
return lastSuperordinateChange;
|
||||
}
|
||||
|
||||
@@ -187,23 +168,16 @@ public class HostBase extends EppResource {
|
||||
superordinateDomain != null
|
||||
&& superordinateDomain.createVKey().equals(getSuperordinateDomain()));
|
||||
Instant lastSuperordinateChange =
|
||||
Optional.ofNullable(getLastSuperordinateChangeInstant()).orElse(getCreationTimeInstant());
|
||||
Optional.ofNullable(getLastSuperordinateChange()).orElse(getCreationTime());
|
||||
Instant lastTransferOfCurrentSuperordinate =
|
||||
Optional.ofNullable(superordinateDomain.getLastTransferTimeInstant()).orElse(START_INSTANT);
|
||||
Optional.ofNullable(superordinateDomain.getLastTransferTime())
|
||||
.map(DateTimeUtils::toInstant)
|
||||
.orElse(START_INSTANT);
|
||||
return lastSuperordinateChange.isBefore(lastTransferOfCurrentSuperordinate)
|
||||
? lastTransferOfCurrentSuperordinate
|
||||
: lastTransferTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #computeLastTransferTime(Domain)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime computeLastTransferTimeDateTime(@Nullable Domain superordinateDomain) {
|
||||
return toDateTime(computeLastTransferTime(superordinateDomain));
|
||||
}
|
||||
|
||||
/** A builder for constructing {@link HostBase}, since it is immutable. */
|
||||
protected static class Builder<T extends HostBase, B extends Builder<T, B>>
|
||||
extends EppResource.Builder<T, B> {
|
||||
@@ -244,15 +218,6 @@ public class HostBase extends EppResource {
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setLastSuperordinateChange(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public B setLastSuperordinateChange(DateTime lastSuperordinateChange) {
|
||||
return setLastSuperordinateChange(toInstant(lastSuperordinateChange));
|
||||
}
|
||||
|
||||
public B addInetAddresses(ImmutableSet<InetAddress> inetAddresses) {
|
||||
return setInetAddresses(
|
||||
ImmutableSet.copyOf(union(getInstance().getInetAddresses(), inetAddresses)));
|
||||
@@ -273,23 +238,14 @@ public class HostBase extends EppResource {
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setLastTransferTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public B setLastTransferTime(DateTime lastTransferTime) {
|
||||
return setLastTransferTime(toInstant(lastTransferTime));
|
||||
}
|
||||
|
||||
public B copyFrom(HostBase hostBase) {
|
||||
return setCreationRegistrarId(hostBase.getCreationRegistrarId())
|
||||
.setCreationTime(hostBase.getCreationTimeInstant())
|
||||
.setCreationTime(hostBase.getCreationTime())
|
||||
.setDeletionTime(hostBase.getDeletionTime())
|
||||
.setHostName(hostBase.getHostName())
|
||||
.setInetAddresses(hostBase.getInetAddresses())
|
||||
.setLastTransferTime(hostBase.getLastTransferTimeInstant())
|
||||
.setLastSuperordinateChange(hostBase.getLastSuperordinateChangeInstant())
|
||||
.setLastTransferTime(hostBase.getLastTransferTime())
|
||||
.setLastSuperordinateChange(hostBase.getLastSuperordinateChange())
|
||||
.setLastEppUpdateRegistrarId(hostBase.getLastEppUpdateRegistrarId())
|
||||
.setLastEppUpdateTime(hostBase.getLastEppUpdateTime())
|
||||
.setPersistedCurrentSponsorRegistrarId(hostBase.getPersistedCurrentSponsorRegistrarId())
|
||||
|
||||
@@ -162,16 +162,7 @@ public abstract class PollMessage extends ImmutableObject
|
||||
return clientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getEventTimeInstant()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getEventTime() {
|
||||
return toDateTime(eventTime);
|
||||
}
|
||||
|
||||
public Instant getEventTimeInstant() {
|
||||
public Instant getEventTime() {
|
||||
return eventTime;
|
||||
}
|
||||
|
||||
@@ -470,7 +461,7 @@ public abstract class PollMessage extends ImmutableObject
|
||||
.setGainingRegistrarId(transferResponse.getGainingRegistrarId())
|
||||
.setLosingRegistrarId(transferResponse.getLosingRegistrarId())
|
||||
.setTransferStatus(transferResponse.getTransferStatus())
|
||||
.setTransferRequestTime(transferResponse.getTransferRequestTimeInstant())
|
||||
.setTransferRequestTime(transferResponse.getTransferRequestTime())
|
||||
.setPendingTransferExpirationTime(
|
||||
transferResponse.getPendingTransferExpirationTime())
|
||||
.setExtendedRegistrationExpirationTime(extendedRegistrationExpirationTime)
|
||||
|
||||
@@ -16,6 +16,8 @@ package google.registry.model.poll;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import google.registry.persistence.VKey;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -41,7 +43,10 @@ public final class PollMessageExternalKeyConverter {
|
||||
|
||||
/** Returns an external poll message ID for the given poll message. */
|
||||
public static String makePollMessageExternalId(PollMessage pollMessage) {
|
||||
return String.format("%d-%d", pollMessage.getId(), pollMessage.getEventTime().getYear());
|
||||
return String.format(
|
||||
"%d-%d",
|
||||
pollMessage.getId(),
|
||||
ZonedDateTime.ofInstant(pollMessage.getEventTime(), ZoneOffset.UTC).getYear());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -471,7 +471,7 @@ public class Registrar extends UpdateAutoTimestampEntity implements Buildable, J
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getLastUpdateTime() {
|
||||
return getUpdateTimestamp().getTimestampDateTime();
|
||||
return toDateTime(getUpdateTimestamp().getTimestamp());
|
||||
}
|
||||
|
||||
public Instant getLastUpdateTimeInstant() {
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
package google.registry.model.reporting;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -34,7 +32,6 @@ import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Index;
|
||||
import jakarta.persistence.Table;
|
||||
import java.time.Instant;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* The record of the mutations which contribute to transaction reporting.
|
||||
@@ -204,16 +201,7 @@ public class DomainTransactionRecord extends ImmutableObject
|
||||
return reportAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getReportingTimeInstant()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getReportingTime() {
|
||||
return toDateTime(reportingTime);
|
||||
}
|
||||
|
||||
public Instant getReportingTimeInstant() {
|
||||
public Instant getReportingTime() {
|
||||
return reportingTime;
|
||||
}
|
||||
|
||||
@@ -232,19 +220,6 @@ public class DomainTransactionRecord extends ImmutableObject
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #create(String, Instant, TransactionReportField, int)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public static DomainTransactionRecord create(
|
||||
String tld,
|
||||
DateTime reportingTime,
|
||||
TransactionReportField transactionReportField,
|
||||
int reportAmount) {
|
||||
return create(tld, toInstant(reportingTime), transactionReportField, reportAmount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder asBuilder() {
|
||||
return new Builder(clone(this));
|
||||
@@ -272,15 +247,6 @@ public class DomainTransactionRecord extends ImmutableObject
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setReportingTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public Builder setReportingTime(DateTime reportingTime) {
|
||||
return setReportingTime(toInstant(reportingTime));
|
||||
}
|
||||
|
||||
public Builder setReportField(TransactionReportField reportField) {
|
||||
checkArgumentNotNull(reportField, "reportField must not be null");
|
||||
getInstance().reportField = reportField;
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
package google.registry.model.reporting;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
|
||||
import google.registry.batch.ExpandBillingRecurrencesAction;
|
||||
@@ -47,7 +45,6 @@ import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* A record of an EPP command that mutated a resource.
|
||||
@@ -200,19 +197,8 @@ public abstract class HistoryEntry extends ImmutableObject
|
||||
return xmlBytes == null ? null : xmlBytes.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time the command occurred.
|
||||
*
|
||||
* @deprecated Use {@link #getModificationTimeInstant()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getModificationTime() {
|
||||
return toDateTime(modificationTime);
|
||||
}
|
||||
|
||||
/** Returns the time the command occurred. */
|
||||
public Instant getModificationTimeInstant() {
|
||||
public Instant getModificationTime() {
|
||||
return modificationTime;
|
||||
}
|
||||
|
||||
@@ -327,15 +313,6 @@ public abstract class HistoryEntry extends ImmutableObject
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setModificationTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public B setModificationTime(DateTime modificationTime) {
|
||||
return setModificationTime(toInstant(modificationTime));
|
||||
}
|
||||
|
||||
public B setRegistrarId(String registrarId) {
|
||||
getInstance().clientId = registrarId;
|
||||
return thisCastToDerived();
|
||||
|
||||
@@ -652,9 +652,9 @@ public class Tld extends ImmutableObject implements Buildable, UnsafeSerializabl
|
||||
/**
|
||||
* @deprecated Use {@link #getCreationTime()}
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
@JsonIgnore
|
||||
public DateTime getCreationDateTime() {
|
||||
return toDateTime(creationTime.getTimestamp());
|
||||
}
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
package google.registry.model.transfer;
|
||||
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import google.registry.model.Buildable.GenericBuilder;
|
||||
import google.registry.model.ImmutableObject;
|
||||
@@ -29,7 +27,6 @@ import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlTransient;
|
||||
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
import java.time.Instant;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Fields common to {@link DomainTransferData} and {@link TransferResponse}. */
|
||||
@XmlTransient
|
||||
@@ -73,16 +70,7 @@ public abstract class BaseTransferObject extends ImmutableObject implements Unsa
|
||||
return gainingClientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getTransferRequestTimeInstant()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getTransferRequestTime() {
|
||||
return toDateTime(transferRequestTime);
|
||||
}
|
||||
|
||||
public Instant getTransferRequestTimeInstant() {
|
||||
public Instant getTransferRequestTime() {
|
||||
return transferRequestTime;
|
||||
}
|
||||
|
||||
@@ -90,15 +78,6 @@ public abstract class BaseTransferObject extends ImmutableObject implements Unsa
|
||||
return losingClientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getPendingTransferExpirationTime()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getPendingTransferExpirationDateTime() {
|
||||
return toDateTime(pendingTransferExpirationTime);
|
||||
}
|
||||
|
||||
public Instant getPendingTransferExpirationTime() {
|
||||
return pendingTransferExpirationTime;
|
||||
}
|
||||
@@ -133,15 +112,6 @@ public abstract class BaseTransferObject extends ImmutableObject implements Unsa
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setTransferRequestTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public B setTransferRequestTime(DateTime transferRequestTime) {
|
||||
return setTransferRequestTime(toInstant(transferRequestTime));
|
||||
}
|
||||
|
||||
/** Set the losing registrar for a pending transfer on this resource. */
|
||||
public B setLosingRegistrarId(String losingRegistrarId) {
|
||||
getInstance().losingClientId = losingRegistrarId;
|
||||
@@ -154,15 +124,6 @@ public abstract class BaseTransferObject extends ImmutableObject implements Unsa
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setPendingTransferExpirationTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public B setPendingTransferExpirationTime(DateTime pendingTransferExpirationTime) {
|
||||
return setPendingTransferExpirationTime(toInstant(pendingTransferExpirationTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public T build() {
|
||||
return super.build();
|
||||
|
||||
@@ -18,8 +18,6 @@ import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static google.registry.util.CollectionUtils.isNullOrEmpty;
|
||||
import static google.registry.util.CollectionUtils.nullToEmpty;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -46,7 +44,6 @@ import jakarta.persistence.Embedded;
|
||||
import java.time.Instant;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Transfer data for domain. */
|
||||
@Embeddable
|
||||
@@ -170,13 +167,6 @@ public class DomainTransferData extends BaseTransferObject implements Buildable
|
||||
return transferRequestTrid;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getTransferredRegistrationExpirationDateTime() {
|
||||
return toDateTime(transferredRegistrationExpirationTime);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Instant getTransferredRegistrationExpirationTime() {
|
||||
return transferredRegistrationExpirationTime;
|
||||
@@ -345,13 +335,6 @@ public class DomainTransferData extends BaseTransferObject implements Buildable
|
||||
* @deprecated Use {@link #setTransferredRegistrationExpirationTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public Builder setTransferredRegistrationExpirationTime(
|
||||
DateTime transferredRegistrationExpirationTime) {
|
||||
return setTransferredRegistrationExpirationTime(
|
||||
toInstant(transferredRegistrationExpirationTime));
|
||||
}
|
||||
|
||||
public Builder setServerApproveBillingEvent(VKey<BillingEvent> serverApproveBillingEvent) {
|
||||
getInstance().serverApproveBillingEvent = serverApproveBillingEvent;
|
||||
return this;
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
package google.registry.model.transfer;
|
||||
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseData;
|
||||
@@ -27,7 +25,6 @@ import jakarta.xml.bind.annotation.XmlTransient;
|
||||
import jakarta.xml.bind.annotation.XmlType;
|
||||
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
import java.time.Instant;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* A response to a transfer command on a {@link EppResource}. This base class contains fields that
|
||||
@@ -67,15 +64,6 @@ public class TransferResponse extends BaseTransferObject implements ResponseData
|
||||
@XmlJavaTypeAdapter(UtcInstantAdapter.class)
|
||||
Instant extendedRegistrationExpirationTime;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getExtendedRegistrationExpirationTime()}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public DateTime getExtendedRegistrationExpirationDateTime() {
|
||||
return toDateTime(extendedRegistrationExpirationTime);
|
||||
}
|
||||
|
||||
public Instant getExtendedRegistrationExpirationTime() {
|
||||
return extendedRegistrationExpirationTime;
|
||||
}
|
||||
@@ -94,16 +82,6 @@ public class TransferResponse extends BaseTransferObject implements ResponseData
|
||||
getInstance().extendedRegistrationExpirationTime = extendedRegistrationExpirationTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setExtendedRegistrationExpirationTime(Instant)}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("InlineMeSuggester")
|
||||
public Builder setExtendedRegistrationExpirationTime(
|
||||
DateTime extendedRegistrationExpirationTime) {
|
||||
return setExtendedRegistrationExpirationTime(toInstant(extendedRegistrationExpirationTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -319,7 +319,7 @@ public class RdapJsonFormatter {
|
||||
.setEventAction(EventAction.REGISTRATION)
|
||||
.setEventActor(
|
||||
Optional.ofNullable(domain.getCreationRegistrarId()).orElse("(none)"))
|
||||
.setEventDate(domain.getCreationTimeInstant())
|
||||
.setEventDate(domain.getCreationTime())
|
||||
.build(),
|
||||
Event.builder()
|
||||
.setEventAction(EventAction.EXPIRATION)
|
||||
@@ -339,7 +339,7 @@ public class RdapJsonFormatter {
|
||||
// (i.e. without updating lastEppUpdateTime), that can only happen for domains that have already
|
||||
// been modified in some way. As a result, we can ignore those cases here.
|
||||
if (domain.getLastEppUpdateTime() != null
|
||||
&& domain.getLastEppUpdateTime().isAfter(domain.getCreationTimeInstant())) {
|
||||
&& domain.getLastEppUpdateTime().isAfter(domain.getCreationTime())) {
|
||||
// Creates an RDAP event object as defined by RFC 9083
|
||||
builder
|
||||
.eventsBuilder()
|
||||
@@ -759,7 +759,7 @@ public class RdapJsonFormatter {
|
||||
lastEntryOfType.put(
|
||||
rdapEventAction,
|
||||
new HistoryTimeAndRegistrar(
|
||||
historyEntry.getModificationTimeInstant(),
|
||||
historyEntry.getModificationTime(),
|
||||
historyEntry.getRegistrarId()));
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
package google.registry.rde;
|
||||
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -88,7 +89,7 @@ final class DomainToXjcConverter {
|
||||
// o An OPTIONAL <crDate> element that contains the date and time of
|
||||
// the domain name object creation. This element MUST be present if
|
||||
// the domain name has been allocated.
|
||||
bean.setCrDate(model.getCreationTime());
|
||||
bean.setCrDate(toDateTime(model.getCreationTime()));
|
||||
|
||||
// o An OPTIONAL <exDate> element that contains the date and time
|
||||
// identifying the end (expiration) of the domain name object's
|
||||
@@ -100,7 +101,7 @@ final class DomainToXjcConverter {
|
||||
// the most recent domain-name-object modification. This element
|
||||
// MUST NOT be present if the domain name object has never been
|
||||
// modified.
|
||||
bean.setUpDate(model.getLastEppUpdateDateTime());
|
||||
bean.setUpDate(toDateTime(model.getLastEppUpdateTime()));
|
||||
|
||||
// o An OPTIONAL <upRr> element that contains the identifier of the
|
||||
// registrar that last updated the domain name object. This element
|
||||
@@ -225,9 +226,9 @@ final class DomainToXjcConverter {
|
||||
XjcEppcomTrStatusType.fromValue(model.getTransferStatus().getXmlName()));
|
||||
bean.setReRr(RdeUtils.makeXjcRdeRrType(model.getGainingRegistrarId()));
|
||||
bean.setAcRr(RdeUtils.makeXjcRdeRrType(model.getLosingRegistrarId()));
|
||||
bean.setReDate(model.getTransferRequestTime());
|
||||
bean.setAcDate(model.getPendingTransferExpirationDateTime());
|
||||
bean.setExDate(model.getTransferredRegistrationExpirationDateTime());
|
||||
bean.setReDate(toDateTime(model.getTransferRequestTime()));
|
||||
bean.setAcDate(toDateTime(model.getPendingTransferExpirationTime()));
|
||||
bean.setExDate(toDateTime(model.getTransferredRegistrationExpirationTime()));
|
||||
return bean;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,9 @@ final class HostToXjcConverter {
|
||||
/** Converts {@link Host} to {@link XjcRdeHost}. */
|
||||
static XjcRdeHost convertExternalHost(Host model) {
|
||||
return convertHostCommon(
|
||||
model, model.getPersistedCurrentSponsorRegistrarId(), model.getLastTransferTime());
|
||||
model,
|
||||
model.getPersistedCurrentSponsorRegistrarId(),
|
||||
toDateTime(model.getLastTransferTime()));
|
||||
}
|
||||
|
||||
private static XjcRdeHost convertHostCommon(
|
||||
@@ -70,8 +72,8 @@ final class HostToXjcConverter {
|
||||
XjcRdeHost bean = new XjcRdeHost();
|
||||
bean.setName(model.getHostName());
|
||||
bean.setRoid(model.getRepoId());
|
||||
bean.setCrDate(model.getCreationTime());
|
||||
bean.setUpDate(model.getLastEppUpdateDateTime());
|
||||
bean.setCrDate(toDateTime(model.getCreationTime()));
|
||||
bean.setUpDate(toDateTime(model.getLastEppUpdateTime()));
|
||||
bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null));
|
||||
bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateRegistrarId(), null));
|
||||
bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null));
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
package google.registry.tmch;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static google.registry.util.DateTimeUtils.ISO_8601_FORMATTER;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import google.registry.model.domain.Domain;
|
||||
@@ -44,7 +46,7 @@ public final class LordnTaskUtils {
|
||||
domain.getDomainName(),
|
||||
domain.getSmdId(),
|
||||
getIanaIdentifier(domain.getCreationRegistrarId()),
|
||||
domain.getCreationTime()); // Used as creation time.
|
||||
ISO_8601_FORMATTER.format(domain.getCreationTime())); // Used as creation time.
|
||||
}
|
||||
|
||||
/** Returns the corresponding CSV LORDN line for a claims domain. */
|
||||
@@ -55,8 +57,8 @@ public final class LordnTaskUtils {
|
||||
domain.getDomainName(),
|
||||
domain.getLaunchNotice().getNoticeId().getTcnId(),
|
||||
getIanaIdentifier(domain.getCreationRegistrarId()),
|
||||
domain.getCreationTime(), // Used as creation time.
|
||||
domain.getLaunchNotice().getAcceptedTime());
|
||||
ISO_8601_FORMATTER.format(domain.getCreationTime()), // Used as creation time.
|
||||
ISO_8601_FORMATTER.format(toInstant(domain.getLaunchNotice().getAcceptedTime())));
|
||||
}
|
||||
|
||||
/** Retrieves the IANA identifier for a registrar by its ID. */
|
||||
|
||||
@@ -24,6 +24,7 @@ import static google.registry.tmch.LordnTaskUtils.COLUMNS_CLAIMS;
|
||||
import static google.registry.tmch.LordnTaskUtils.COLUMNS_SUNRISE;
|
||||
import static google.registry.tmch.LordnTaskUtils.getCsvLineForClaimsDomain;
|
||||
import static google.registry.tmch.LordnTaskUtils.getCsvLineForSunriseDomain;
|
||||
import static google.registry.util.DateTimeUtils.ISO_8601_FORMATTER;
|
||||
import static jakarta.servlet.http.HttpServletResponse.SC_ACCEPTED;
|
||||
import static java.nio.charset.StandardCharsets.US_ASCII;
|
||||
|
||||
@@ -170,7 +171,9 @@ public final class NordnUploadAction implements Runnable {
|
||||
String columns =
|
||||
phase.equals(PARAM_LORDN_PHASE_SUNRISE) ? COLUMNS_SUNRISE : COLUMNS_CLAIMS;
|
||||
String header =
|
||||
String.format("1,%s,%d\n%s\n", clock.nowUtc(), domains.size(), columns);
|
||||
String.format(
|
||||
"1,%s,%d\n%s\n",
|
||||
ISO_8601_FORMATTER.format(clock.now()), domains.size(), columns);
|
||||
try {
|
||||
URL url =
|
||||
uploadCsvToLordn(String.format("/LORDN/%s/%s", tld, phase), header + csv);
|
||||
|
||||
@@ -83,7 +83,7 @@ final class AckPollMessagesCommand implements Command {
|
||||
private void ackPollMessagesSql() {
|
||||
tm().transact(
|
||||
() -> {
|
||||
QueryComposer<PollMessage> query = createPollMessageQuery(clientId, clock.nowUtc());
|
||||
QueryComposer<PollMessage> query = createPollMessageQuery(clientId, clock.now());
|
||||
if (!isNullOrEmpty(message)) {
|
||||
query = query.where("msg", LIKE, "%" + message + "%");
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static google.registry.batch.AsyncTaskEnqueuer.QUEUE_ASYNC_ACTIONS;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.tools.LockOrUnlockDomainCommand.REGISTRY_LOCK_STATUSES;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -137,7 +138,7 @@ public final class DomainLockUtils {
|
||||
RegistryLock newLock =
|
||||
RegistryLockDao.save(
|
||||
createLockBuilder(domainName, registrarId, registryLockEmail, isAdmin)
|
||||
.setLockCompletionTime(now)
|
||||
.setLockCompletionTime(toInstant(now))
|
||||
.build());
|
||||
applyLockStatuses(newLock, now, isAdmin);
|
||||
setAsRelock(newLock);
|
||||
@@ -159,7 +160,7 @@ public final class DomainLockUtils {
|
||||
RegistryLock result =
|
||||
RegistryLockDao.save(
|
||||
createUnlockBuilder(domainName, registrarId, isAdmin, relockDuration)
|
||||
.setUnlockCompletionTime(now)
|
||||
.setUnlockCompletionTime(toInstant(now))
|
||||
.build());
|
||||
removeLockStatuses(result, isAdmin, now);
|
||||
return result;
|
||||
@@ -206,12 +207,13 @@ public final class DomainLockUtils {
|
||||
private RegistryLock verifyAndApplyLock(RegistryLock lock, boolean isAdmin) {
|
||||
DateTime now = tm().getTransactionTime();
|
||||
checkArgument(
|
||||
!lock.isLockRequestExpired(now), "The pending lock has expired; please try again");
|
||||
!lock.isLockRequestExpired(toInstant(now)),
|
||||
"The pending lock has expired; please try again");
|
||||
|
||||
checkArgument(!lock.isSuperuser() || isAdmin, "Non-admin user cannot complete admin lock");
|
||||
|
||||
RegistryLock newLock =
|
||||
RegistryLockDao.save(lock.asBuilder().setLockCompletionTime(now).build());
|
||||
RegistryLockDao.save(lock.asBuilder().setLockCompletionTime(toInstant(now)).build());
|
||||
setAsRelock(newLock);
|
||||
applyLockStatuses(newLock, now, isAdmin);
|
||||
return newLock;
|
||||
@@ -220,12 +222,13 @@ public final class DomainLockUtils {
|
||||
private RegistryLock verifyAndApplyUnlock(RegistryLock lock, boolean isAdmin) {
|
||||
DateTime now = tm().getTransactionTime();
|
||||
checkArgument(
|
||||
!lock.isUnlockRequestExpired(now), "The pending unlock has expired; please try again");
|
||||
!lock.isUnlockRequestExpired(toInstant(now)),
|
||||
"The pending unlock has expired; please try again");
|
||||
|
||||
checkArgument(isAdmin || !lock.isSuperuser(), "Non-admin user cannot complete admin unlock");
|
||||
|
||||
RegistryLock newLock =
|
||||
RegistryLockDao.save(lock.asBuilder().setUnlockCompletionTime(now).build());
|
||||
RegistryLockDao.save(lock.asBuilder().setUnlockCompletionTime(toInstant(now)).build());
|
||||
removeLockStatuses(newLock, isAdmin, now);
|
||||
return newLock;
|
||||
}
|
||||
@@ -246,7 +249,7 @@ public final class DomainLockUtils {
|
||||
.ifPresent(
|
||||
previousLock ->
|
||||
checkArgument(
|
||||
previousLock.isLockRequestExpired(now)
|
||||
previousLock.isLockRequestExpired(toInstant(now))
|
||||
|| previousLock.getUnlockCompletionTime().isPresent()
|
||||
|| isAdmin,
|
||||
"A pending or completed lock action already exists for %s",
|
||||
@@ -281,7 +284,7 @@ public final class DomainLockUtils {
|
||||
new RegistryLock.Builder()
|
||||
.setRepoId(domain.getRepoId())
|
||||
.setDomainName(domainName)
|
||||
.setLockCompletionTime(now)
|
||||
.setLockCompletionTime(toInstant(now))
|
||||
.setRegistrarId(registrarId));
|
||||
} else {
|
||||
RegistryLock lock =
|
||||
@@ -292,7 +295,7 @@ public final class DomainLockUtils {
|
||||
checkArgument(
|
||||
lock.isLocked(), "Lock object for domain %s is not currently locked", domainName);
|
||||
checkArgument(
|
||||
lock.getUnlockRequestTime().isEmpty() || lock.isUnlockRequestExpired(now),
|
||||
lock.getUnlockRequestTime().isEmpty() || lock.isUnlockRequestExpired(toInstant(now)),
|
||||
"A pending unlock action already exists for %s",
|
||||
domainName);
|
||||
checkArgument(
|
||||
@@ -307,7 +310,7 @@ public final class DomainLockUtils {
|
||||
return newLockBuilder
|
||||
.setVerificationCode(stringGenerator.createString(VERIFICATION_CODE_LENGTH))
|
||||
.isSuperuser(isAdmin)
|
||||
.setUnlockRequestTime(now)
|
||||
.setUnlockRequestTime(toInstant(now))
|
||||
.setRegistrarId(registrarId);
|
||||
}
|
||||
|
||||
@@ -384,7 +387,7 @@ public final class DomainLockUtils {
|
||||
.setBySuperuser(lock.isSuperuser())
|
||||
.setRequestedByRegistrar(!lock.isSuperuser())
|
||||
.setType(HistoryEntry.Type.DOMAIN_UPDATE)
|
||||
.setModificationTime(now)
|
||||
.setModificationTime(toInstant(now))
|
||||
.setDomain(domain)
|
||||
.setReason(reason)
|
||||
.build();
|
||||
@@ -397,8 +400,8 @@ public final class DomainLockUtils {
|
||||
.setTargetId(domain.getForeignKey())
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setCost(Tld.get(domain.getTld()).getRegistryLockOrUnlockBillingCost())
|
||||
.setEventTime(now)
|
||||
.setBillingTime(now)
|
||||
.setEventTime(toInstant(now))
|
||||
.setBillingTime(toInstant(now))
|
||||
.setDomainHistory(domainHistory)
|
||||
.build();
|
||||
tm().insert(billingEvent);
|
||||
|
||||
@@ -105,7 +105,7 @@ class EnqueuePollMessageCommand extends MutatingCommand {
|
||||
.setType(SYNTHETIC)
|
||||
.setBySuperuser(true)
|
||||
.setReason("Manual enqueueing of poll message: " + message)
|
||||
.setModificationTime(tm().getTransactionTime())
|
||||
.setModificationTime(tm().getTxTime())
|
||||
.setRequestedByRegistrar(false)
|
||||
.setRegistrarId(registryAdminClientId)
|
||||
.build();
|
||||
|
||||
@@ -19,6 +19,7 @@ import static com.google.common.io.BaseEncoding.base16;
|
||||
import static google.registry.model.tld.Tlds.assertTldExists;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.util.DateTimeUtils.isBeforeOrAt;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static java.nio.charset.StandardCharsets.US_ASCII;
|
||||
|
||||
import com.beust.jcommander.Parameter;
|
||||
@@ -80,7 +81,8 @@ final class GenerateDnsReportCommand implements Command {
|
||||
.list());
|
||||
for (Domain domain : domains) {
|
||||
// Skip deleted domains and domains that don't get published to DNS.
|
||||
if (isBeforeOrAt(domain.getDeletionDateTime(), now) || !domain.shouldPublishToDns()) {
|
||||
if (isBeforeOrAt(domain.getDeletionTime(), toInstant(now))
|
||||
|| !domain.shouldPublishToDns()) {
|
||||
continue;
|
||||
}
|
||||
write(domain);
|
||||
@@ -89,7 +91,7 @@ final class GenerateDnsReportCommand implements Command {
|
||||
Iterable<Host> nameservers = tm().transact(() -> tm().loadAllOf(Host.class));
|
||||
for (Host nameserver : nameservers) {
|
||||
// Skip deleted hosts and external hosts.
|
||||
if (isBeforeOrAt(nameserver.getDeletionDateTime(), now)
|
||||
if (isBeforeOrAt(nameserver.getDeletionTime(), toInstant(now))
|
||||
|| nameserver.getInetAddresses().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ final class GetHistoryEntriesCommand implements Command {
|
||||
System.out.printf(
|
||||
"Client: %s\nTime: %s\nClient TRID: %s\nServer TRID: %s\n%s\n",
|
||||
entry.getRegistrarId(),
|
||||
entry.getModificationTimeInstant(),
|
||||
entry.getModificationTime(),
|
||||
entry.getTrid() == null ? null : entry.getTrid().getClientTransactionId().orElse(null),
|
||||
entry.getTrid() == null ? null : entry.getTrid().getServerTransactionId(),
|
||||
entry.getXmlBytes() == null
|
||||
|
||||
@@ -23,6 +23,7 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.isBeforeOrAt;
|
||||
import static google.registry.util.DateTimeUtils.minusYears;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
@@ -187,7 +188,7 @@ class UnrenewDomainCommand extends ConfirmingCommand {
|
||||
DomainHistory domainHistory =
|
||||
new DomainHistory.Builder()
|
||||
.setDomain(domain)
|
||||
.setModificationTime(now)
|
||||
.setModificationTime(toInstant(now))
|
||||
.setBySuperuser(true)
|
||||
.setType(Type.SYNTHETIC)
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
@@ -208,12 +209,12 @@ class UnrenewDomainCommand extends ConfirmingCommand {
|
||||
// Create a new autorenew billing event and poll message starting at the new expiration time.
|
||||
BillingRecurrence newAutorenewEvent =
|
||||
newAutorenewBillingEvent(domain)
|
||||
.setEventTime(newExpirationTime)
|
||||
.setEventTime(toInstant(newExpirationTime))
|
||||
.setDomainHistory(domainHistory)
|
||||
.build();
|
||||
PollMessage.Autorenew newAutorenewPollMessage =
|
||||
newAutorenewPollMessage(domain)
|
||||
.setEventTime(newExpirationTime)
|
||||
.setEventTime(toInstant(newExpirationTime))
|
||||
.setHistoryEntry(domainHistory)
|
||||
.build();
|
||||
// End the old autorenew billing event and poll message now.
|
||||
@@ -224,7 +225,7 @@ class UnrenewDomainCommand extends ConfirmingCommand {
|
||||
domain
|
||||
.asBuilder()
|
||||
.setRegistrationExpirationTime(newExpirationTime)
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateTime(toInstant(now))
|
||||
.setLastEppUpdateRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setAutorenewBillingEvent(newAutorenewEvent.createVKey())
|
||||
.setAutorenewPollMessage(newAutorenewPollMessage.createVKey())
|
||||
|
||||
@@ -190,7 +190,7 @@ public class UpdateRecurrenceCommand extends ConfirmingCommand {
|
||||
endTime));
|
||||
BillingRecurrence billingRecurrence = tm().loadByKey(domain.getAutorenewBillingEvent());
|
||||
checkArgument(
|
||||
billingRecurrence.getRecurrenceEndTimeInstant().equals(END_INSTANT),
|
||||
billingRecurrence.getRecurrenceEndTime().equals(END_INSTANT),
|
||||
"Domain %s's recurrence's end date is not END_INSTANT",
|
||||
domainName);
|
||||
result.put(domain, billingRecurrence);
|
||||
|
||||
+7
-7
@@ -96,9 +96,9 @@ public class RecreateBillingRecurrencesCommand extends ConfirmingCommand {
|
||||
.map(
|
||||
existingRecurrence -> {
|
||||
TimeOfYear timeOfYear = existingRecurrence.getRecurrenceTimeOfYear();
|
||||
Instant newLastExpansion = timeOfYear.getLastInstanceBeforeOrAtInstant(now);
|
||||
Instant newLastExpansion = timeOfYear.getLastInstanceBeforeOrAt(now);
|
||||
// event time should be the next date of billing in the future
|
||||
Instant eventTime = timeOfYear.getNextInstanceAtOrAfterInstant(now);
|
||||
Instant eventTime = timeOfYear.getNextInstanceAtOrAfter(now);
|
||||
return existingRecurrence
|
||||
.asBuilder()
|
||||
.setRecurrenceEndTime(END_INSTANT)
|
||||
@@ -123,10 +123,10 @@ public class RecreateBillingRecurrencesCommand extends ConfirmingCommand {
|
||||
"Domain %s does not exist or has been deleted", domainName)));
|
||||
BillingRecurrence billingRecurrence = tm().loadByKey(domain.getAutorenewBillingEvent());
|
||||
checkArgument(
|
||||
!billingRecurrence.getRecurrenceEndTimeInstant().equals(END_INSTANT),
|
||||
"Domain %s's recurrence's end date is already END_OF_TIME",
|
||||
!billingRecurrence.getRecurrenceEndTime().equals(END_INSTANT),
|
||||
"Domain %s's recurrence's end date is already END_INSTANT",
|
||||
domainName);
|
||||
// Double-check that there are no non-linked BillingRecurrences that have an END_OF_TIME end.
|
||||
// Double-check that there are no non-linked BillingRecurrences that have an END_INSTANT end.
|
||||
// If this is the case, something has been mis-linked.
|
||||
ImmutableList<BillingRecurrence> allRecurrencesForDomain =
|
||||
tm().createQueryComposer(BillingRecurrence.class)
|
||||
@@ -135,9 +135,9 @@ public class RecreateBillingRecurrencesCommand extends ConfirmingCommand {
|
||||
allRecurrencesForDomain.forEach(
|
||||
recurrence ->
|
||||
checkArgument(
|
||||
!recurrence.getRecurrenceEndTimeInstant().equals(END_INSTANT),
|
||||
!recurrence.getRecurrenceEndTime().equals(END_INSTANT),
|
||||
"There exists a recurrence with id %s for domain %s with an end date of"
|
||||
+ " END_OF_TIME",
|
||||
+ " END_INSTANT",
|
||||
recurrence.getId(),
|
||||
domainName));
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import static com.google.common.io.BaseEncoding.base16;
|
||||
import static google.registry.model.EppResourceUtils.loadAtPointInTime;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.request.Action.Method.POST;
|
||||
import static google.registry.util.DateTimeUtils.minusMinutes;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import com.google.cloud.storage.BlobId;
|
||||
@@ -123,11 +124,10 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||
// We can only reliably call loadAtPointInTime at times that are UTC midnight and >
|
||||
// databaseRetention ago in the past.
|
||||
Instant now = clock.now();
|
||||
if (exportTime.isAfter(now.minus(java.time.Duration.ofMinutes(2)))) {
|
||||
if (exportTime.isAfter(minusMinutes(now, 2))) {
|
||||
throw new BadRequestException("Invalid export time: must be > 2 minutes ago");
|
||||
}
|
||||
if (exportTime.isBefore(
|
||||
now.minus(java.time.Duration.ofMillis(databaseRetention.getMillis())))) {
|
||||
if (exportTime.isBefore(now.minusMillis(databaseRetention.getMillis()))) {
|
||||
throw new BadRequestException(
|
||||
String.format(
|
||||
"Invalid export time: must be < %d days ago", databaseRetention.getStandardDays()));
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ConsoleDomainListAction extends ConsoleApiAction {
|
||||
// We have to use a constant checkpoint time in order to have stable pagination, since domains
|
||||
// can be constantly created or deleted
|
||||
DateTime checkpoint = checkpointTime.orElseGet(tm()::getTransactionTime);
|
||||
CreateAutoTimestamp checkpointTimestamp = CreateAutoTimestamp.create(checkpoint);
|
||||
CreateAutoTimestamp checkpointTimestamp = CreateAutoTimestamp.create(toInstant(checkpoint));
|
||||
// Don't compute the number of total results over and over if we don't need to
|
||||
long actualTotalResults =
|
||||
totalResults.orElseGet(
|
||||
|
||||
@@ -163,7 +163,7 @@ public class ConsoleRegistryLockAction extends ConsoleApiAction {
|
||||
domainName,
|
||||
registrarId,
|
||||
isAdmin,
|
||||
relockDurationMillis.map(Duration::new));
|
||||
relockDurationMillis.map(Duration::millis));
|
||||
sendVerificationEmail(registryLock, registryLockEmail, isLock);
|
||||
});
|
||||
response.setStatus(SC_OK);
|
||||
@@ -194,7 +194,7 @@ public class ConsoleRegistryLockAction extends ConsoleApiAction {
|
||||
return tm().transact(
|
||||
() ->
|
||||
RegistryLockDao.getLocksByRegistrarId(registrarId).stream()
|
||||
.filter(lock -> !lock.isLockRequestExpired(tm().getTransactionTime()))
|
||||
.filter(lock -> !lock.isLockRequestExpired(tm().getTxTime()))
|
||||
.collect(toImmutableList()));
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public class CheckBulkComplianceActionTest {
|
||||
new AllocationToken.Builder()
|
||||
.setToken("abc123")
|
||||
.setTokenType(TokenType.BULK_PRICING)
|
||||
.setCreationTimeForTest(DateTime.parse("2010-11-12T05:00:00Z"))
|
||||
.setCreationTimeForTest(Instant.parse("2010-11-12T05:00:00Z"))
|
||||
.setAllowedTlds(ImmutableSet.of("foo"))
|
||||
.setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar"))
|
||||
.setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED)
|
||||
@@ -200,7 +200,7 @@ public class CheckBulkComplianceActionTest {
|
||||
new AllocationToken.Builder()
|
||||
.setToken("token")
|
||||
.setTokenType(TokenType.BULK_PRICING)
|
||||
.setCreationTimeForTest(DateTime.parse("2010-11-12T05:00:00Z"))
|
||||
.setCreationTimeForTest(Instant.parse("2010-11-12T05:00:00Z"))
|
||||
.setAllowedTlds(ImmutableSet.of("foo"))
|
||||
.setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar"))
|
||||
.setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED)
|
||||
@@ -258,7 +258,7 @@ public class CheckBulkComplianceActionTest {
|
||||
new AllocationToken.Builder()
|
||||
.setToken("token")
|
||||
.setTokenType(TokenType.BULK_PRICING)
|
||||
.setCreationTimeForTest(DateTime.parse("2010-11-12T05:00:00Z"))
|
||||
.setCreationTimeForTest(Instant.parse("2010-11-12T05:00:00Z"))
|
||||
.setAllowedTlds(ImmutableSet.of("foo"))
|
||||
.setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar"))
|
||||
.setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED)
|
||||
@@ -334,7 +334,7 @@ public class CheckBulkComplianceActionTest {
|
||||
new AllocationToken.Builder()
|
||||
.setToken("token")
|
||||
.setTokenType(TokenType.BULK_PRICING)
|
||||
.setCreationTimeForTest(DateTime.parse("2010-11-12T05:00:00Z"))
|
||||
.setCreationTimeForTest(Instant.parse("2010-11-12T05:00:00Z"))
|
||||
.setAllowedTlds(ImmutableSet.of("foo"))
|
||||
.setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar"))
|
||||
.setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED)
|
||||
@@ -401,7 +401,7 @@ public class CheckBulkComplianceActionTest {
|
||||
new AllocationToken.Builder()
|
||||
.setToken("token")
|
||||
.setTokenType(TokenType.BULK_PRICING)
|
||||
.setCreationTimeForTest(DateTime.parse("2010-11-12T05:00:00Z"))
|
||||
.setCreationTimeForTest(Instant.parse("2010-11-12T05:00:00Z"))
|
||||
.setAllowedTlds(ImmutableSet.of("foo"))
|
||||
.setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar"))
|
||||
.setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED)
|
||||
|
||||
@@ -23,8 +23,11 @@ import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.loadByEntity;
|
||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
import static google.registry.util.DateTimeUtils.plusYears;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.flows.DaggerEppTestComponent;
|
||||
@@ -87,7 +90,7 @@ class DeleteExpiredDomainsActionTest {
|
||||
DatabaseHelper.newDomain("bar.tld")
|
||||
.asBuilder()
|
||||
.setAutorenewEndTime(Optional.of(clock.nowUtc().minusDays(10)))
|
||||
.setDeletionTime(clock.nowUtc().plusDays(17))
|
||||
.setDeletionTime(plusDays(clock.now(), 17))
|
||||
.build());
|
||||
|
||||
// A non-autorenewing domain that hasn't reached its expiration time and shouldn't be touched.
|
||||
@@ -168,7 +171,7 @@ class DeleteExpiredDomainsActionTest {
|
||||
new DomainHistory.Builder()
|
||||
.setType(DOMAIN_CREATE)
|
||||
.setDomain(pendingExpirationDomain)
|
||||
.setModificationTime(clock.nowUtc().minusMonths(9))
|
||||
.setModificationTime(toInstant(clock.nowUtc().minusMonths(9)))
|
||||
.setRegistrarId(pendingExpirationDomain.getCreationRegistrarId())
|
||||
.build());
|
||||
BillingRecurrence autorenewBillingEvent =
|
||||
@@ -193,8 +196,8 @@ class DeleteExpiredDomainsActionTest {
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
|
||||
.setTargetId("fizz.tld")
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(clock.nowUtc().plusYears(1))
|
||||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setEventTime(plusYears(clock.now(), 1))
|
||||
.setRecurrenceEndTime(END_INSTANT)
|
||||
.setDomainHistory(createHistoryEntry);
|
||||
}
|
||||
|
||||
@@ -203,7 +206,7 @@ class DeleteExpiredDomainsActionTest {
|
||||
return new PollMessage.Autorenew.Builder()
|
||||
.setTargetId("fizz.tld")
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(clock.nowUtc().plusYears(1))
|
||||
.setEventTime(plusYears(clock.now(), 1))
|
||||
.setAutorenewEndTime(END_OF_TIME)
|
||||
.setHistoryEntry(createHistoryEntry);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import static google.registry.testing.DatabaseHelper.persistDomainAsDeleted;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.minusYears;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -300,25 +301,25 @@ class DeleteProberDataActionTest {
|
||||
.setDomain(domain)
|
||||
.setType(HistoryEntry.Type.DOMAIN_CREATE)
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setModificationTime(DELETION_TIME.minusYears(3))
|
||||
.setModificationTime(toInstant(DELETION_TIME.minusYears(3)))
|
||||
.build());
|
||||
BillingEvent billingEvent =
|
||||
persistResource(
|
||||
new BillingEvent.Builder()
|
||||
.setDomainHistory(historyEntry)
|
||||
.setBillingTime(DELETION_TIME.plusYears(1))
|
||||
.setBillingTime(toInstant(DELETION_TIME.plusYears(1)))
|
||||
.setCost(Money.parse("USD 10"))
|
||||
.setPeriodYears(1)
|
||||
.setReason(Reason.CREATE)
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(DELETION_TIME)
|
||||
.setEventTime(toInstant(DELETION_TIME))
|
||||
.setTargetId(fqdn)
|
||||
.build());
|
||||
PollMessage.OneTime pollMessage =
|
||||
persistResource(
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setHistoryEntry(historyEntry)
|
||||
.setEventTime(DELETION_TIME)
|
||||
.setEventTime(toInstant(DELETION_TIME))
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setMsg("Domain registered")
|
||||
.build());
|
||||
@@ -327,7 +328,7 @@ class DeleteProberDataActionTest {
|
||||
GracePeriod.create(
|
||||
ADD,
|
||||
domain.getRepoId(),
|
||||
DELETION_TIME.plusDays(5),
|
||||
toInstant(DELETION_TIME.plusDays(5)),
|
||||
"TheRegistrar",
|
||||
billingEvent.createVKey()));
|
||||
domain = persistResource(domain.asBuilder().addGracePeriod(gracePeriod).build());
|
||||
|
||||
@@ -24,6 +24,7 @@ import static google.registry.testing.DatabaseHelper.newDomain;
|
||||
import static google.registry.testing.DatabaseHelper.persistDomainWithDependentResources;
|
||||
import static google.registry.testing.DatabaseHelper.persistDomainWithPendingTransfer;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
import static org.joda.time.Duration.standardDays;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
@@ -110,14 +111,14 @@ public class ResaveEntityActionTest {
|
||||
persistResource(
|
||||
newDomain
|
||||
.asBuilder()
|
||||
.setDeletionTime(clock.nowUtc().plusDays(35))
|
||||
.setDeletionTime(plusDays(clock.now(), 35))
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
.setGracePeriods(
|
||||
ImmutableSet.of(
|
||||
GracePeriod.createWithoutBillingEvent(
|
||||
GracePeriodStatus.REDEMPTION,
|
||||
newDomain.getRepoId(),
|
||||
clock.nowUtc().plusDays(30),
|
||||
plusDays(clock.now(), 30),
|
||||
"TheRegistrar")))
|
||||
.build());
|
||||
clock.advanceBy(standardDays(30));
|
||||
|
||||
@@ -23,9 +23,8 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.Instant;
|
||||
import org.apache.beam.sdk.coders.NullableCoder;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -42,8 +41,8 @@ class BillingEventTest {
|
||||
private static BillingEvent createBillingEvent(String pONumber, int years) {
|
||||
return BillingEvent.create(
|
||||
1,
|
||||
new DateTime(1508835963000L, DateTimeZone.UTC),
|
||||
new DateTime(1484870383000L, DateTimeZone.UTC),
|
||||
Instant.ofEpochMilli(1508835963000L),
|
||||
Instant.ofEpochMilli(1484870383000L),
|
||||
"myRegistrar",
|
||||
"12345-CRRHELLO",
|
||||
pONumber,
|
||||
|
||||
+16
-17
@@ -154,7 +154,7 @@ public class ExpandBillingRecurrencesPipelineTest {
|
||||
defaultOneTime(getOnlyAutoRenewHistory()),
|
||||
billingRecurrence
|
||||
.asBuilder()
|
||||
.setRecurrenceLastExpansion(plusYears(domain.getCreationTimeInstant(), 1))
|
||||
.setRecurrenceLastExpansion(plusYears(domain.getCreationTime(), 1))
|
||||
.build());
|
||||
|
||||
// Assert about Cursor.
|
||||
@@ -184,7 +184,7 @@ public class ExpandBillingRecurrencesPipelineTest {
|
||||
defaultOneTime(getOnlyAutoRenewHistory()),
|
||||
billingRecurrence
|
||||
.asBuilder()
|
||||
.setRecurrenceLastExpansion(plusYears(domain.getCreationTimeInstant(), 1))
|
||||
.setRecurrenceLastExpansion(plusYears(domain.getCreationTime(), 1))
|
||||
.build());
|
||||
|
||||
// Assert about Cursor.
|
||||
@@ -213,7 +213,7 @@ public class ExpandBillingRecurrencesPipelineTest {
|
||||
defaultOneTime(getOnlyAutoRenewHistory()),
|
||||
billingRecurrence
|
||||
.asBuilder()
|
||||
.setRecurrenceLastExpansion(plusYears(domain.getCreationTimeInstant(), 1))
|
||||
.setRecurrenceLastExpansion(plusYears(domain.getCreationTime(), 1))
|
||||
.build());
|
||||
|
||||
// Assert that the cursor did not change.
|
||||
@@ -226,8 +226,7 @@ public class ExpandBillingRecurrencesPipelineTest {
|
||||
persistResource(
|
||||
billingRecurrence
|
||||
.asBuilder()
|
||||
.setRecurrenceEndTime(
|
||||
billingRecurrence.getEventTimeInstant().minus(1, ChronoUnit.DAYS))
|
||||
.setRecurrenceEndTime(billingRecurrence.getEventTime().minus(1, ChronoUnit.DAYS))
|
||||
.build());
|
||||
runPipeline();
|
||||
assertNoExpansionsHappened();
|
||||
@@ -251,7 +250,7 @@ public class ExpandBillingRecurrencesPipelineTest {
|
||||
persistResource(
|
||||
billingRecurrence
|
||||
.asBuilder()
|
||||
.setEventTime(minusYears(billingRecurrence.getEventTimeInstant(), 1))
|
||||
.setEventTime(minusYears(billingRecurrence.getEventTime(), 1))
|
||||
.setRecurrenceEndTime(startTime.plus(6, ChronoUnit.HOURS))
|
||||
.build());
|
||||
runPipeline();
|
||||
@@ -316,7 +315,7 @@ public class ExpandBillingRecurrencesPipelineTest {
|
||||
defaultOneTime(getOnlyAutoRenewHistory()),
|
||||
billingRecurrence
|
||||
.asBuilder()
|
||||
.setRecurrenceLastExpansion(plusYears(domain.getCreationTimeInstant(), 1))
|
||||
.setRecurrenceLastExpansion(plusYears(domain.getCreationTime(), 1))
|
||||
.build());
|
||||
|
||||
// Assert that the cursor did not move.
|
||||
@@ -355,7 +354,7 @@ public class ExpandBillingRecurrencesPipelineTest {
|
||||
defaultOneTime(getOnlyAutoRenewHistory()),
|
||||
billingRecurrence
|
||||
.asBuilder()
|
||||
.setRecurrenceLastExpansion(plusYears(domain.getCreationTimeInstant(), 1))
|
||||
.setRecurrenceLastExpansion(plusYears(domain.getCreationTime(), 1))
|
||||
.build());
|
||||
assertBillingEventsForResource(
|
||||
otherDomain,
|
||||
@@ -363,7 +362,7 @@ public class ExpandBillingRecurrencesPipelineTest {
|
||||
otherDomain, getOnlyAutoRenewHistory(otherDomain), otherBillingRecurrence, 100),
|
||||
otherBillingRecurrence
|
||||
.asBuilder()
|
||||
.setRecurrenceLastExpansion(plusYears(otherDomain.getCreationTimeInstant(), 1))
|
||||
.setRecurrenceLastExpansion(plusYears(otherDomain.getCreationTime(), 1))
|
||||
.build());
|
||||
|
||||
// Assert about Cursor.
|
||||
@@ -387,7 +386,7 @@ public class ExpandBillingRecurrencesPipelineTest {
|
||||
DomainTransactionRecord.create(
|
||||
domain.getTld(),
|
||||
// We report this when the autorenew grace period ends.
|
||||
plusYears(domain.getCreationTimeInstant(), 2)
|
||||
plusYears(domain.getCreationTime(), 2)
|
||||
.plus(
|
||||
Duration.ofMillis(Tld.DEFAULT_AUTO_RENEW_GRACE_PERIOD.getMillis())),
|
||||
TransactionReportField.netRenewsFieldFromYears(1),
|
||||
@@ -404,21 +403,21 @@ public class ExpandBillingRecurrencesPipelineTest {
|
||||
h.getDomainTransactionRecords().stream()
|
||||
.findFirst()
|
||||
.get()
|
||||
.getReportingTimeInstant()))
|
||||
.getReportingTime()))
|
||||
.collect(toImmutableList());
|
||||
assertBillingEventsForResource(
|
||||
domain,
|
||||
defaultOneTime(histories.get(0)),
|
||||
defaultOneTime(histories.get(1))
|
||||
.asBuilder()
|
||||
.setEventTime(plusYears(domain.getCreationTimeInstant(), 2))
|
||||
.setEventTime(plusYears(domain.getCreationTime(), 2))
|
||||
.setBillingTime(
|
||||
plusYears(domain.getCreationTimeInstant(), 2)
|
||||
plusYears(domain.getCreationTime(), 2)
|
||||
.plus(Duration.ofMillis(Tld.DEFAULT_AUTO_RENEW_GRACE_PERIOD.getMillis())))
|
||||
.build(),
|
||||
billingRecurrence
|
||||
.asBuilder()
|
||||
.setRecurrenceLastExpansion(plusYears(domain.getCreationTimeInstant(), 2))
|
||||
.setRecurrenceLastExpansion(plusYears(domain.getCreationTime(), 2))
|
||||
.build());
|
||||
|
||||
// Assert about Cursor.
|
||||
@@ -472,7 +471,7 @@ public class ExpandBillingRecurrencesPipelineTest {
|
||||
DomainTransactionRecord.create(
|
||||
domain.getTld(),
|
||||
// We report this when the autorenew grace period ends.
|
||||
plusYears(domain.getCreationTimeInstant(), 1)
|
||||
plusYears(domain.getCreationTime(), 1)
|
||||
.plus(Duration.ofMillis(Tld.DEFAULT_AUTO_RENEW_GRACE_PERIOD.getMillis())),
|
||||
TransactionReportField.netRenewsFieldFromYears(1),
|
||||
1)))
|
||||
@@ -487,11 +486,11 @@ public class ExpandBillingRecurrencesPipelineTest {
|
||||
Domain domain, DomainHistory history, BillingRecurrence billingRecurrence, int cost) {
|
||||
return new BillingEvent.Builder()
|
||||
.setBillingTime(
|
||||
plusYears(domain.getCreationTimeInstant(), 1)
|
||||
plusYears(domain.getCreationTime(), 1)
|
||||
.plus(Duration.ofMillis(Tld.DEFAULT_AUTO_RENEW_GRACE_PERIOD.getMillis())))
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setCost(Money.of(USD, cost))
|
||||
.setEventTime(plusYears(domain.getCreationTimeInstant(), 1))
|
||||
.setEventTime(plusYears(domain.getCreationTime(), 1))
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW, Flag.SYNTHETIC))
|
||||
.setPeriodYears(1)
|
||||
.setReason(Reason.RENEW)
|
||||
|
||||
@@ -23,7 +23,7 @@ import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatabaseHelper.persistNewRegistrar;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.LogsSubject.assertAboutLogs;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
import static org.joda.money.CurrencyUnit.CAD;
|
||||
@@ -56,6 +56,7 @@ import java.io.File;
|
||||
import java.io.Serial;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Instant;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Map.Entry;
|
||||
@@ -70,7 +71,6 @@ import org.apache.beam.sdk.transforms.PTransform;
|
||||
import org.apache.beam.sdk.values.PCollection;
|
||||
import org.apache.beam.sdk.values.TypeDescriptor;
|
||||
import org.joda.money.Money;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
@@ -97,8 +97,8 @@ class InvoicingPipelineTest {
|
||||
ImmutableList.of(
|
||||
google.registry.beam.billing.BillingEvent.create(
|
||||
1,
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
"theRegistrar",
|
||||
"234",
|
||||
"",
|
||||
@@ -112,8 +112,8 @@ class InvoicingPipelineTest {
|
||||
""),
|
||||
google.registry.beam.billing.BillingEvent.create(
|
||||
2,
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
"theRegistrar",
|
||||
"234",
|
||||
"",
|
||||
@@ -127,8 +127,8 @@ class InvoicingPipelineTest {
|
||||
""),
|
||||
google.registry.beam.billing.BillingEvent.create(
|
||||
3,
|
||||
DateTime.parse("2017-10-02T00:00:00Z"),
|
||||
DateTime.parse("2017-09-29T00:00:00Z"),
|
||||
Instant.parse("2017-10-02T00:00:00Z"),
|
||||
Instant.parse("2017-09-29T00:00:00Z"),
|
||||
"theRegistrar",
|
||||
"234",
|
||||
"",
|
||||
@@ -142,8 +142,8 @@ class InvoicingPipelineTest {
|
||||
""),
|
||||
google.registry.beam.billing.BillingEvent.create(
|
||||
4,
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
"bestdomains",
|
||||
"456",
|
||||
"116688",
|
||||
@@ -157,8 +157,8 @@ class InvoicingPipelineTest {
|
||||
""),
|
||||
google.registry.beam.billing.BillingEvent.create(
|
||||
5,
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
"anotherRegistrar",
|
||||
"789",
|
||||
"",
|
||||
@@ -172,8 +172,8 @@ class InvoicingPipelineTest {
|
||||
"SUNRISE ANCHOR_TENANT"),
|
||||
google.registry.beam.billing.BillingEvent.create(
|
||||
6,
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
"theRegistrar",
|
||||
"234",
|
||||
"",
|
||||
@@ -187,8 +187,8 @@ class InvoicingPipelineTest {
|
||||
""),
|
||||
google.registry.beam.billing.BillingEvent.create(
|
||||
7,
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
"theRegistrar",
|
||||
"234",
|
||||
"",
|
||||
@@ -202,8 +202,8 @@ class InvoicingPipelineTest {
|
||||
""),
|
||||
google.registry.beam.billing.BillingEvent.create(
|
||||
15,
|
||||
DateTime.parse("2017-10-02T00:00:00.0Z"),
|
||||
DateTime.parse("2017-10-04T00:00:00.0Z"),
|
||||
Instant.parse("2017-10-02T00:00:00.0Z"),
|
||||
Instant.parse("2017-10-04T00:00:00.0Z"),
|
||||
"theRegistrarCopy",
|
||||
"234",
|
||||
"",
|
||||
@@ -217,8 +217,8 @@ class InvoicingPipelineTest {
|
||||
""),
|
||||
google.registry.beam.billing.BillingEvent.create(
|
||||
16,
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
DateTime.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
Instant.parse("2017-10-04T00:00:00Z"),
|
||||
"theRegistrarCopy",
|
||||
"234",
|
||||
"",
|
||||
@@ -478,8 +478,8 @@ AND cr.id IS NULL
|
||||
Reason.CREATE,
|
||||
5,
|
||||
Money.ofMajor(JPY, 70),
|
||||
DateTime.parse("2017-09-29T00:00:00.0Z"),
|
||||
DateTime.parse("2017-10-02T00:00:00.0Z"));
|
||||
Instant.parse("2017-09-29T00:00:00.0Z"),
|
||||
Instant.parse("2017-10-02T00:00:00.0Z"));
|
||||
persistBillingEvent(4, domain4, registrar2, Reason.RENEW, 1, Money.of(USD, 20.5));
|
||||
persistBillingEvent(
|
||||
5,
|
||||
@@ -488,8 +488,8 @@ AND cr.id IS NULL
|
||||
Reason.CREATE,
|
||||
1,
|
||||
Money.of(USD, 0),
|
||||
DateTime.parse("2017-10-04T00:00:00.0Z"),
|
||||
DateTime.parse("2017-10-04T00:00:00.0Z"),
|
||||
Instant.parse("2017-10-04T00:00:00.0Z"),
|
||||
Instant.parse("2017-10-04T00:00:00.0Z"),
|
||||
Flag.SUNRISE,
|
||||
Flag.ANCHOR_TENANT);
|
||||
persistBillingEvent(6, domain6, registrar1, Reason.SERVER_STATUS, 0, Money.of(USD, 0));
|
||||
@@ -529,8 +529,8 @@ AND cr.id IS NULL
|
||||
Reason.CREATE,
|
||||
5,
|
||||
Money.ofMajor(JPY, 70),
|
||||
DateTime.parse("2017-06-29T00:00:00.0Z"),
|
||||
DateTime.parse("2017-07-02T00:00:00.0Z"));
|
||||
Instant.parse("2017-06-29T00:00:00.0Z"),
|
||||
Instant.parse("2017-07-02T00:00:00.0Z"));
|
||||
|
||||
// Add a billing event with a corresponding cancellation
|
||||
Domain domain12 = persistActiveDomain("cancel.test");
|
||||
@@ -543,8 +543,8 @@ AND cr.id IS NULL
|
||||
.asBuilder()
|
||||
.setId(1)
|
||||
.setRegistrarId(registrar1.getRegistrarId())
|
||||
.setEventTime(DateTime.parse("2017-10-05T00:00:00.0Z"))
|
||||
.setBillingTime(DateTime.parse("2017-10-04T00:00:00.0Z"))
|
||||
.setEventTime(Instant.parse("2017-10-05T00:00:00.0Z"))
|
||||
.setBillingTime(Instant.parse("2017-10-04T00:00:00.0Z"))
|
||||
.setBillingEvent(billingEvent.createVKey())
|
||||
.setTargetId(domain12.getDomainName())
|
||||
.setReason(Reason.RENEW)
|
||||
@@ -560,11 +560,11 @@ AND cr.id IS NULL
|
||||
new BillingRecurrence()
|
||||
.asBuilder()
|
||||
.setRegistrarId(registrar1.getRegistrarId())
|
||||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setRecurrenceEndTime(END_INSTANT)
|
||||
.setId(1)
|
||||
.setDomainHistory(domainHistoryRecurrence)
|
||||
.setTargetId(domain13.getDomainName())
|
||||
.setEventTime(DateTime.parse("2017-10-04T00:00:00.0Z"))
|
||||
.setEventTime(Instant.parse("2017-10-04T00:00:00.0Z"))
|
||||
.setReason(Reason.RENEW)
|
||||
.build();
|
||||
persistResource(billingRecurrence);
|
||||
@@ -575,7 +575,7 @@ AND cr.id IS NULL
|
||||
.asBuilder()
|
||||
.setCancellationMatchingBillingEvent(billingRecurrence)
|
||||
.setFlags(ImmutableSet.of(Flag.SYNTHETIC))
|
||||
.setSyntheticCreationTime(DateTime.parse("2017-10-03T00:00:00.0Z"))
|
||||
.setSyntheticCreationTime(Instant.parse("2017-10-03T00:00:00.0Z"))
|
||||
.build();
|
||||
persistResource(billingEventRecurrence);
|
||||
|
||||
@@ -584,8 +584,8 @@ AND cr.id IS NULL
|
||||
.asBuilder()
|
||||
.setId(2)
|
||||
.setRegistrarId(registrar1.getRegistrarId())
|
||||
.setEventTime(DateTime.parse("2017-10-05T00:00:00.0Z"))
|
||||
.setBillingTime(DateTime.parse("2017-10-04T00:00:00.0Z"))
|
||||
.setEventTime(Instant.parse("2017-10-05T00:00:00.0Z"))
|
||||
.setBillingTime(Instant.parse("2017-10-04T00:00:00.0Z"))
|
||||
.setBillingRecurrence(billingRecurrence.createVKey())
|
||||
.setTargetId(domain13.getDomainName())
|
||||
.setReason(Reason.RENEW)
|
||||
@@ -604,8 +604,8 @@ AND cr.id IS NULL
|
||||
Reason.CREATE,
|
||||
5,
|
||||
Money.ofMajor(JPY, 70),
|
||||
DateTime.parse("2017-10-04T00:00:00.0Z"),
|
||||
DateTime.parse("2017-10-02T00:00:00.0Z"));
|
||||
Instant.parse("2017-10-04T00:00:00.0Z"),
|
||||
Instant.parse("2017-10-02T00:00:00.0Z"));
|
||||
persistBillingEvent(16, domain15, registrar11, Reason.RENEW, 3, Money.of(USD, 20.5));
|
||||
}
|
||||
|
||||
@@ -613,7 +613,7 @@ AND cr.id IS NULL
|
||||
DomainHistory domainHistory =
|
||||
new DomainHistory.Builder()
|
||||
.setType(HistoryEntry.Type.DOMAIN_RENEW)
|
||||
.setModificationTime(DateTime.parse("2017-10-04T00:00:00.0Z"))
|
||||
.setModificationTime(Instant.parse("2017-10-04T00:00:00.0Z"))
|
||||
.setDomain(domain)
|
||||
.setRegistrarId(registrar.getRegistrarId())
|
||||
.build();
|
||||
@@ -629,8 +629,8 @@ AND cr.id IS NULL
|
||||
reason,
|
||||
years,
|
||||
money,
|
||||
DateTime.parse("2017-10-04T00:00:00.0Z"),
|
||||
DateTime.parse("2017-10-04T00:00:00.0Z"));
|
||||
Instant.parse("2017-10-04T00:00:00.0Z"),
|
||||
Instant.parse("2017-10-04T00:00:00.0Z"));
|
||||
}
|
||||
|
||||
private static BillingEvent persistBillingEvent(
|
||||
@@ -640,8 +640,8 @@ AND cr.id IS NULL
|
||||
Reason reason,
|
||||
int years,
|
||||
Money money,
|
||||
DateTime eventTime,
|
||||
DateTime billingTime,
|
||||
Instant eventTime,
|
||||
Instant billingTime,
|
||||
Flag... flags) {
|
||||
BillingEvent.Builder billingEventBuilder =
|
||||
new BillingEvent()
|
||||
|
||||
@@ -19,7 +19,7 @@ import static google.registry.testing.DatabaseHelper.newHost;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.DatabaseHelper.persistResources;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -174,7 +174,7 @@ public class RegistryJpaReadTest {
|
||||
.setDomainName("example.com")
|
||||
.setRepoId("4-COM")
|
||||
.setCreationRegistrarId(registrar.getRegistrarId())
|
||||
.setLastEppUpdateTime(fakeClock.nowUtc())
|
||||
.setLastEppUpdateTime(fakeClock.now())
|
||||
.setLastEppUpdateRegistrarId(registrar.getRegistrarId())
|
||||
.setLastTransferTime(fakeClock.nowUtc())
|
||||
.setStatusValues(
|
||||
@@ -197,7 +197,7 @@ public class RegistryJpaReadTest {
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.ADD,
|
||||
"4-COM",
|
||||
END_OF_TIME,
|
||||
END_INSTANT,
|
||||
registrar.getRegistrarId(),
|
||||
null,
|
||||
100L))
|
||||
|
||||
@@ -159,7 +159,7 @@ public class RdePipelineTest {
|
||||
DomainTransactionRecord transactionRecord =
|
||||
new DomainTransactionRecord.Builder()
|
||||
.setTld("soy")
|
||||
.setReportingTime(clock.nowUtc())
|
||||
.setReportingTime(clock.now())
|
||||
.setReportField(TransactionReportField.NET_ADDS_1_YR)
|
||||
.setReportAmount(1)
|
||||
.build();
|
||||
@@ -168,7 +168,7 @@ public class RdePipelineTest {
|
||||
new DomainHistory.Builder()
|
||||
.setType(HistoryEntry.Type.DOMAIN_CREATE)
|
||||
.setXmlBytes("<xml></xml>".getBytes(UTF_8))
|
||||
.setModificationTime(clock.nowUtc())
|
||||
.setModificationTime(clock.now())
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setTrid(Trid.create("ABC-123", "server-trid"))
|
||||
.setBySuperuser(false)
|
||||
@@ -186,7 +186,7 @@ public class RdePipelineTest {
|
||||
new HostHistory.Builder()
|
||||
.setType(HistoryEntry.Type.HOST_CREATE)
|
||||
.setXmlBytes("<xml></xml>".getBytes(UTF_8))
|
||||
.setModificationTime(clock.nowUtc())
|
||||
.setModificationTime(clock.now())
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setTrid(Trid.create("ABC-123", "server-trid"))
|
||||
.setBySuperuser(false)
|
||||
@@ -257,7 +257,7 @@ public class RdePipelineTest {
|
||||
|
||||
// Advance time
|
||||
clock.advanceOneMilli();
|
||||
persistDomainHistory(deletedDomain.asBuilder().setDeletionTime(clock.nowUtc()).build());
|
||||
persistDomainHistory(deletedDomain.asBuilder().setDeletionTime(clock.now()).build());
|
||||
kittyDomain = kittyDomain.asBuilder().setDomainName("cat.fun").build();
|
||||
persistDomainHistory(kittyDomain);
|
||||
|
||||
@@ -276,7 +276,7 @@ public class RdePipelineTest {
|
||||
// Set the clock to 2000-01-02, any change after hereafter should not show up in the
|
||||
// resulting deposit fragments.
|
||||
clock.advanceBy(Duration.standardDays(2));
|
||||
persistDomainHistory(kittyDomain.asBuilder().setDeletionTime(clock.nowUtc()).build());
|
||||
persistDomainHistory(kittyDomain.asBuilder().setDeletionTime(clock.now()).build());
|
||||
Host futureHost = persistActiveHost("ns1.future.tld");
|
||||
persistHostHistory(futureHost);
|
||||
persistDomainHistory(
|
||||
|
||||
@@ -287,7 +287,7 @@ class Spec11PipelineTest {
|
||||
.setDomainName(domainName)
|
||||
.setRepoId(repoId)
|
||||
.setCreationRegistrarId(registrar.getRegistrarId())
|
||||
.setLastEppUpdateTime(fakeClock.nowUtc())
|
||||
.setLastEppUpdateTime(fakeClock.now())
|
||||
.setLastEppUpdateRegistrarId(registrar.getRegistrarId())
|
||||
.setLastTransferTime(fakeClock.nowUtc())
|
||||
.setPersistedCurrentSponsorRegistrarId(registrar.getRegistrarId())
|
||||
|
||||
@@ -23,6 +23,7 @@ import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatabaseHelper.persistDeletedDomain;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
@@ -176,14 +177,14 @@ class ExportDomainListsActionTest {
|
||||
GracePeriod.createWithoutBillingEvent(
|
||||
GracePeriodStatus.REDEMPTION,
|
||||
redemption.getRepoId(),
|
||||
clock.nowUtc().plusDays(20),
|
||||
plusDays(clock.now(), 20),
|
||||
redemption.getCurrentSponsorRegistrarId()))
|
||||
.build());
|
||||
persistResource(
|
||||
persistActiveDomain("pendingdelete.tld")
|
||||
.asBuilder()
|
||||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.setDeletionTime(clock.nowUtc().plusDays(3))
|
||||
.setDeletionTime(plusDays(clock.now(), 3))
|
||||
.build());
|
||||
|
||||
action.run();
|
||||
|
||||
@@ -31,6 +31,7 @@ import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.DomainSubject.assertAboutDomains;
|
||||
import static google.registry.testing.EppMetricSubject.assertThat;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -533,8 +534,8 @@ class EppLifecycleDomainTest extends EppTestCase {
|
||||
.setRegistrarId("NewRegistrar")
|
||||
.setPeriodYears(1)
|
||||
.setCost(Money.parse("USD 100.00"))
|
||||
.setEventTime(createTime)
|
||||
.setBillingTime(createTime.plus(Tld.get("tld").getRenewGracePeriodLength()))
|
||||
.setEventTime(toInstant(createTime))
|
||||
.setBillingTime(toInstant(createTime.plus(Tld.get("tld").getRenewGracePeriodLength())))
|
||||
.setDomainHistory(
|
||||
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_CREATE, DomainHistory.class))
|
||||
.build();
|
||||
|
||||
@@ -19,6 +19,7 @@ import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType;
|
||||
import static google.registry.testing.DatabaseHelper.loadAllOf;
|
||||
import static google.registry.testing.DatabaseHelper.stripBillingEventId;
|
||||
import static google.registry.testing.TestDataHelper.loadFile;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static google.registry.xml.XmlTestUtils.assertXmlEqualsWithMessage;
|
||||
import static jakarta.servlet.http.HttpServletResponse.SC_OK;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
@@ -286,8 +287,9 @@ public class EppTestCase {
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setCost(Money.parse("USD 24.00"))
|
||||
.setPeriodYears(2)
|
||||
.setEventTime(createTime)
|
||||
.setBillingTime(createTime.plus(Tld.get(domain.getTld()).getAddGracePeriodLength()))
|
||||
.setEventTime(toInstant(createTime))
|
||||
.setBillingTime(
|
||||
toInstant(createTime.plus(Tld.get(domain.getTld()).getAddGracePeriodLength())))
|
||||
.setDomainHistory(
|
||||
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_CREATE, DomainHistory.class))
|
||||
.build();
|
||||
@@ -301,8 +303,9 @@ public class EppTestCase {
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setCost(Money.parse("USD 33.00"))
|
||||
.setPeriodYears(3)
|
||||
.setEventTime(renewTime)
|
||||
.setBillingTime(renewTime.plus(Tld.get(domain.getTld()).getRenewGracePeriodLength()))
|
||||
.setEventTime(toInstant(renewTime))
|
||||
.setBillingTime(
|
||||
toInstant(renewTime.plus(Tld.get(domain.getTld()).getRenewGracePeriodLength())))
|
||||
.setDomainHistory(getOnlyHistoryEntryOfType(domain, Type.DOMAIN_RENEW, DomainHistory.class))
|
||||
.build();
|
||||
}
|
||||
@@ -335,8 +338,8 @@ public class EppTestCase {
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
|
||||
.setTargetId(domain.getDomainName())
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setEventTime(eventTime)
|
||||
.setRecurrenceEndTime(endTime)
|
||||
.setEventTime(toInstant(eventTime))
|
||||
.setRecurrenceEndTime(toInstant(endTime))
|
||||
.setDomainHistory(historyEntry)
|
||||
.build();
|
||||
}
|
||||
@@ -347,9 +350,10 @@ public class EppTestCase {
|
||||
return new BillingCancellation.Builder()
|
||||
.setTargetId(domain.getDomainName())
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setEventTime(deleteTime)
|
||||
.setEventTime(toInstant(deleteTime))
|
||||
.setBillingEvent(findKeyToActualOneTimeBillingEvent(billingEventToCancel))
|
||||
.setBillingTime(createTime.plus(Tld.get(domain.getTld()).getAddGracePeriodLength()))
|
||||
.setBillingTime(
|
||||
toInstant(createTime.plus(Tld.get(domain.getTld()).getAddGracePeriodLength())))
|
||||
.setReason(Reason.CREATE)
|
||||
.setDomainHistory(
|
||||
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_DELETE, DomainHistory.class))
|
||||
@@ -362,9 +366,10 @@ public class EppTestCase {
|
||||
return new BillingCancellation.Builder()
|
||||
.setTargetId(domain.getDomainName())
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setEventTime(deleteTime)
|
||||
.setEventTime(toInstant(deleteTime))
|
||||
.setBillingEvent(findKeyToActualOneTimeBillingEvent(billingEventToCancel))
|
||||
.setBillingTime(renewTime.plus(Tld.get(domain.getTld()).getRenewGracePeriodLength()))
|
||||
.setBillingTime(
|
||||
toInstant(renewTime.plus(Tld.get(domain.getTld()).getRenewGracePeriodLength())))
|
||||
.setReason(Reason.RENEW)
|
||||
.setDomainHistory(
|
||||
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_DELETE, DomainHistory.class))
|
||||
|
||||
@@ -182,7 +182,7 @@ public abstract class FlowTestCase<F extends Flow> {
|
||||
GracePeriod.create(
|
||||
entry.getKey().getType(),
|
||||
entry.getKey().getDomainRepoId(),
|
||||
entry.getKey().getExpirationDateTime(),
|
||||
entry.getKey().getExpirationTime(),
|
||||
entry.getKey().getRegistrarId(),
|
||||
null,
|
||||
1L),
|
||||
|
||||
@@ -56,12 +56,13 @@ import static google.registry.testing.DatabaseHelper.persistReservedList;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.DomainSubject.assertAboutDomains;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.START_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.minusDays;
|
||||
import static google.registry.util.DateTimeUtils.minusMonths;
|
||||
import static google.registry.util.DateTimeUtils.minusYears;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
import static google.registry.util.DateTimeUtils.plusMinutes;
|
||||
import static google.registry.util.DateTimeUtils.plusYears;
|
||||
import static org.joda.money.CurrencyUnit.JPY;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
@@ -334,7 +335,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
DomainHistory historyEntry = getHistoryEntries(domain, DomainHistory.class).get(0);
|
||||
VKey<BillingRecurrence> autorenewVKey = domain.getAutorenewBillingEvent();
|
||||
BillingRecurrence autorenewBR = tm().transact(() -> tm().loadByKey(autorenewVKey));
|
||||
Instant eventTime = autorenewBR.getEventTimeInstant();
|
||||
Instant eventTime = autorenewBR.getEventTime();
|
||||
assertAboutDomains()
|
||||
.that(domain)
|
||||
.hasRegistrationExpirationTime(eventTime)
|
||||
@@ -370,8 +371,8 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
|
||||
.setTargetId(getUniqueIdFromCommand())
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(domain.getRegistrationExpirationDateTime())
|
||||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setEventTime(domain.getRegistrationExpirationTime())
|
||||
.setRecurrenceEndTime(END_INSTANT)
|
||||
.setDomainHistory(historyEntry)
|
||||
.setRenewalPriceBehavior(expectedRenewalPriceBehavior)
|
||||
.setRenewalPrice(
|
||||
@@ -406,7 +407,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(domain.getDomainName())
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(domain.getRegistrationExpirationDateTime())
|
||||
.setEventTime(domain.getRegistrationExpirationTime())
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setHistoryEntry(historyEntry)
|
||||
.build());
|
||||
@@ -1730,7 +1731,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(domain.getDomainName())
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(domain.getRegistrationExpirationDateTime())
|
||||
.setEventTime(domain.getRegistrationExpirationTime())
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setHistoryEntry(historyEntry)
|
||||
.build(),
|
||||
@@ -1863,7 +1864,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(domain.getDomainName())
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(domain.getRegistrationExpirationDateTime())
|
||||
.setEventTime(domain.getRegistrationExpirationTime())
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setHistoryEntry(historyEntry)
|
||||
.build(),
|
||||
@@ -2712,7 +2713,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.containsExactly(
|
||||
DomainTransactionRecord.create(
|
||||
"tld",
|
||||
historyEntry.getModificationTime().plusMinutes(9),
|
||||
plusMinutes(historyEntry.getModificationTime(), 9),
|
||||
TransactionReportField.netAddsFieldFromYears(2),
|
||||
1));
|
||||
}
|
||||
|
||||
@@ -50,12 +50,14 @@ import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.DomainSubject.assertAboutDomains;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.START_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.minusDays;
|
||||
import static google.registry.util.DateTimeUtils.minusMonths;
|
||||
import static google.registry.util.DateTimeUtils.minusYears;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
import static google.registry.util.DateTimeUtils.plusHours;
|
||||
import static google.registry.util.DateTimeUtils.plusMonths;
|
||||
import static google.registry.util.DateTimeUtils.plusYears;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
@@ -241,7 +243,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
.setTargetId("example.tld")
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(eventTime)
|
||||
.setBillingTime(toDateTime(plusDays(TIME_BEFORE_FLOW, 1)))
|
||||
.setBillingTime(plusDays(TIME_BEFORE_FLOW, 1))
|
||||
.setBillingEvent(graceBillingEvent.createVKey())
|
||||
.setDomainHistory(historyEntryDomainDelete)
|
||||
.build());
|
||||
@@ -262,7 +264,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
.setCost(cost)
|
||||
.setPeriodYears(2)
|
||||
.setEventTime(minusDays(TIME_BEFORE_FLOW, 4))
|
||||
.setBillingTime(toDateTime(plusDays(TIME_BEFORE_FLOW, 1)))
|
||||
.setBillingTime(plusDays(TIME_BEFORE_FLOW, 1))
|
||||
.setDomainHistory(earlierHistoryEntry)
|
||||
.build();
|
||||
}
|
||||
@@ -274,7 +276,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
.setTargetId("example.tld")
|
||||
.setRegistrarId(registrarId)
|
||||
.setEventTime(A_MONTH_FROM_NOW)
|
||||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setRecurrenceEndTime(END_INSTANT)
|
||||
.setDomainHistory(earlierHistoryEntry);
|
||||
}
|
||||
|
||||
@@ -602,7 +604,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
// The poll message in the future to the gaining registrar should be gone too, but there
|
||||
// should be one at the current time to the gaining registrar.
|
||||
PollMessage gainingPollMessage = getOnlyPollMessage("NewRegistrar");
|
||||
assertThat(gainingPollMessage.getEventTime()).isEqualTo(clock.nowUtc());
|
||||
assertThat(gainingPollMessage.getEventTime()).isEqualTo(clock.now());
|
||||
assertThat(
|
||||
gainingPollMessage
|
||||
.getResponseData()
|
||||
@@ -973,10 +975,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
assertThat(persistedEntry.getDomainTransactionRecords())
|
||||
.containsExactly(
|
||||
DomainTransactionRecord.create(
|
||||
"tld",
|
||||
clock.now().plus(java.time.Duration.ofHours(3)),
|
||||
DELETED_DOMAINS_NOGRACE,
|
||||
1));
|
||||
"tld", plusHours(clock.now(), 3), DELETED_DOMAINS_NOGRACE, 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1002,10 +1001,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
assertThat(persistedEntry.getDomainTransactionRecords())
|
||||
.containsExactly(
|
||||
DomainTransactionRecord.create(
|
||||
"tld",
|
||||
clock.now().plus(java.time.Duration.ofHours(3)),
|
||||
DELETED_DOMAINS_NOGRACE,
|
||||
1));
|
||||
"tld", plusHours(clock.now(), 3), DELETED_DOMAINS_NOGRACE, 1));
|
||||
}
|
||||
|
||||
/** Verifies that if there's no add grace period, we still cancel out valid renew records */
|
||||
@@ -1033,7 +1029,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
assertThat(persistedEntry.getDomainTransactionRecords())
|
||||
.containsExactly(
|
||||
DomainTransactionRecord.create(
|
||||
"tld", clock.now().plus(java.time.Duration.ofHours(3)), DELETED_DOMAINS_NOGRACE, 1),
|
||||
"tld", plusHours(clock.now(), 3), DELETED_DOMAINS_NOGRACE, 1),
|
||||
renewRecord.asBuilder().setReportAmount(-1).build());
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
|
||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatabaseHelper.persistDomainAsDeleted;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.plusMinutes;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
|
||||
import google.registry.model.domain.Domain;
|
||||
@@ -87,7 +88,7 @@ public class DomainDeletionTimeCacheTest {
|
||||
void testCache_expires() {
|
||||
Domain domain = persistActiveDomain("domain.tld");
|
||||
assertThat(getDeletionTimeFromCache("domain.tld")).hasValue(END_OF_TIME);
|
||||
Instant elevenMinutesFromNow = clock.now().plus(java.time.Duration.ofMinutes(11));
|
||||
Instant elevenMinutesFromNow = plusMinutes(clock.now(), 11);
|
||||
persistDomainAsDeleted(domain, toDateTime(elevenMinutesFromNow));
|
||||
clock.advanceBy(Duration.standardMinutes(30));
|
||||
assertThat(getDeletionTimeFromCache("domain.tld")).hasValue(toDateTime(elevenMinutesFromNow));
|
||||
|
||||
@@ -29,7 +29,7 @@ import static google.registry.testing.DatabaseHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.TestDataHelper.updateSubstitutions;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.minusDays;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
@@ -369,7 +369,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||
.setTargetId(getUniqueIdFromCommand())
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(clock.now())
|
||||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setRecurrenceEndTime(END_INSTANT)
|
||||
.setDomainHistory(historyEntry)
|
||||
.build());
|
||||
VKey<BillingRecurrence> recurrenceVKey = renewEvent.createVKey();
|
||||
|
||||
@@ -26,7 +26,7 @@ import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.START_INSTANT;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
@@ -124,7 +124,7 @@ public class DomainPricingLogicTest {
|
||||
.setReason(Reason.RENEW)
|
||||
.setRenewalPriceBehavior(renewalPriceBehavior)
|
||||
.setRenewalPrice(renewalPrice.orElse(null))
|
||||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setRecurrenceEndTime(END_INSTANT)
|
||||
.setTargetId(domain.getDomainName())
|
||||
.build());
|
||||
persistResource(
|
||||
|
||||
@@ -45,8 +45,9 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.minusDays;
|
||||
import static google.registry.util.DateTimeUtils.minusYears;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
import static google.registry.util.DateTimeUtils.plusMinutes;
|
||||
import static google.registry.util.DateTimeUtils.plusYears;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static org.joda.money.CurrencyUnit.EUR;
|
||||
import static org.joda.money.CurrencyUnit.JPY;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
@@ -173,7 +174,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setTargetId(getUniqueIdFromCommand())
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(expirationTime)
|
||||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setRecurrenceEndTime(toInstant(END_OF_TIME))
|
||||
.setDomainHistory(historyEntryDomainCreate)
|
||||
.setRenewalPriceBehavior(renewalPriceBehavior)
|
||||
.setRenewalPrice(renewalPrice)
|
||||
@@ -262,7 +263,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
DomainHistory historyEntryDomainRenew =
|
||||
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RENEW, DomainHistory.class);
|
||||
assertThat(loadByKey(domain.getAutorenewBillingEvent()).getEventTime())
|
||||
.isEqualTo(toDateTime(newExpiration));
|
||||
.isEqualTo(newExpiration);
|
||||
assertAboutDomains()
|
||||
.that(domain)
|
||||
.isActiveAt(clock.now())
|
||||
@@ -285,8 +286,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setPeriodYears(renewalYears)
|
||||
.setEventTime(clock.now())
|
||||
.setBillingTime(
|
||||
toDateTime(
|
||||
clock.now().plusMillis(Tld.get("tld").getRenewGracePeriodLength().getMillis())))
|
||||
clock.now().plusMillis(Tld.get("tld").getRenewGracePeriodLength().getMillis()))
|
||||
.setDomainHistory(historyEntryDomainRenew)
|
||||
.build();
|
||||
assertBillingEvents(
|
||||
@@ -311,8 +311,8 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
|
||||
.setTargetId(getUniqueIdFromCommand())
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(domain.getRegistrationExpirationDateTime())
|
||||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setEventTime(toInstant(domain.getRegistrationExpirationDateTime()))
|
||||
.setRecurrenceEndTime(toInstant(END_OF_TIME))
|
||||
.setDomainHistory(historyEntryDomainRenew)
|
||||
.build());
|
||||
// There should only be the new autorenew poll message, as the old one will have been deleted
|
||||
@@ -321,7 +321,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(getUniqueIdFromCommand())
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(domain.getRegistrationExpirationDateTime())
|
||||
.setEventTime(toInstant(domain.getRegistrationExpirationDateTime()))
|
||||
.setAutorenewEndTime(END_OF_TIME)
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setHistoryEntry(historyEntryDomainRenew)
|
||||
@@ -332,8 +332,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.RENEW,
|
||||
domain.getRepoId(),
|
||||
toDateTime(
|
||||
clock.now().plusMillis(Tld.get("tld").getRenewGracePeriodLength().getMillis())),
|
||||
clock.now().plusMillis(Tld.get("tld").getRenewGracePeriodLength().getMillis()),
|
||||
renewalClientId,
|
||||
null),
|
||||
renewBillingEvent));
|
||||
@@ -1104,7 +1103,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.containsExactly(
|
||||
DomainTransactionRecord.create(
|
||||
"tld",
|
||||
historyEntry.getModificationTime().plusMinutes(9),
|
||||
plusMinutes(historyEntry.getModificationTime(), 9),
|
||||
TransactionReportField.netRenewsFieldFromYears(5),
|
||||
1));
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ import static google.registry.util.DateTimeUtils.minusDays;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
import static google.registry.util.DateTimeUtils.plusMonths;
|
||||
import static google.registry.util.DateTimeUtils.plusYears;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static org.joda.money.CurrencyUnit.EUR;
|
||||
import static org.joda.money.CurrencyUnit.JPY;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
@@ -184,7 +183,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RESTORE, DomainHistory.class);
|
||||
assertLastHistoryContainsResource(domain);
|
||||
assertThat(loadByKey(domain.getAutorenewBillingEvent()).getEventTime())
|
||||
.isEqualTo(toDateTime(expirationTime));
|
||||
.isEqualTo(expirationTime);
|
||||
assertAboutDomains()
|
||||
.that(domain)
|
||||
// New expiration time should be the same as from before the deletion.
|
||||
@@ -252,7 +251,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RESTORE, DomainHistory.class);
|
||||
assertLastHistoryContainsResource(domain);
|
||||
assertThat(loadByKey(domain.getAutorenewBillingEvent()).getEventTime())
|
||||
.isEqualTo(toDateTime(newExpirationTime));
|
||||
.isEqualTo(newExpirationTime);
|
||||
assertAboutDomains()
|
||||
.that(domain)
|
||||
// New expiration time should be exactly a year from now.
|
||||
|
||||
@@ -43,7 +43,6 @@ import static google.registry.util.DateTimeUtils.minusDays;
|
||||
import static google.registry.util.DateTimeUtils.minusYears;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
import static google.registry.util.DateTimeUtils.plusYears;
|
||||
import static google.registry.util.DateTimeUtils.toDateTime;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
@@ -214,7 +213,7 @@ class DomainTransferApproveFlowTest
|
||||
assertTransferApproved(domain, originalTransferData);
|
||||
assertAboutDomains().that(domain).hasRegistrationExpirationTime(expectedExpirationTime);
|
||||
assertThat(loadByKey(domain.getAutorenewBillingEvent()).getEventTime())
|
||||
.isEqualTo(toDateTime(expectedExpirationTime));
|
||||
.isEqualTo(expectedExpirationTime);
|
||||
// The poll message (in the future) to the losing registrar for implicit ack should be gone.
|
||||
assertThat(getPollMessages(domain, "TheRegistrar", clock.nowUtc().plusMonths(1))).isEmpty();
|
||||
|
||||
@@ -222,9 +221,7 @@ class DomainTransferApproveFlowTest
|
||||
// should be one at the current time to the gaining registrar, as well as one at the domain's
|
||||
// autorenew time.
|
||||
assertThat(getPollMessages(domain, "NewRegistrar", clock.nowUtc().plusMonths(1))).hasSize(1);
|
||||
assertThat(
|
||||
getPollMessages(
|
||||
domain, "NewRegistrar", toDateTime(domain.getRegistrationExpirationTime())))
|
||||
assertThat(getPollMessages(domain, "NewRegistrar", domain.getRegistrationExpirationTime()))
|
||||
.hasSize(2);
|
||||
|
||||
PollMessage gainingTransferPollMessage =
|
||||
@@ -233,11 +230,11 @@ class DomainTransferApproveFlowTest
|
||||
getOnlyPollMessage(
|
||||
domain,
|
||||
"NewRegistrar",
|
||||
toDateTime(domain.getRegistrationExpirationTime()),
|
||||
domain.getRegistrationExpirationTime(),
|
||||
PollMessage.Autorenew.class);
|
||||
assertThat(gainingTransferPollMessage.getEventTime()).isEqualTo(clock.nowUtc());
|
||||
assertThat(gainingTransferPollMessage.getEventTime()).isEqualTo(clock.now());
|
||||
assertThat(gainingAutorenewPollMessage.getEventTime())
|
||||
.isEqualTo(toDateTime(domain.getRegistrationExpirationTime()));
|
||||
.isEqualTo(domain.getRegistrationExpirationTime());
|
||||
DomainTransferResponse transferResponse =
|
||||
gainingTransferPollMessage
|
||||
.getResponseData()
|
||||
@@ -285,8 +282,7 @@ class DomainTransferApproveFlowTest
|
||||
.setTargetId(domain.getDomainName())
|
||||
.setEventTime(clock.now())
|
||||
.setBillingTime(
|
||||
toDateTime(
|
||||
clock.now().plusMillis(registry.getTransferGracePeriodLength().getMillis())))
|
||||
clock.now().plusMillis(registry.getTransferGracePeriodLength().getMillis()))
|
||||
.setRegistrarId("NewRegistrar")
|
||||
.setCost(Money.of(USD, 11).multipliedBy(expectedYearsToCharge))
|
||||
.setPeriodYears(expectedYearsToCharge)
|
||||
@@ -318,8 +314,7 @@ class DomainTransferApproveFlowTest
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.TRANSFER,
|
||||
domain.getRepoId(),
|
||||
toDateTime(
|
||||
clock.now().plusMillis(registry.getTransferGracePeriodLength().getMillis())),
|
||||
clock.now().plusMillis(registry.getTransferGracePeriodLength().getMillis()),
|
||||
"NewRegistrar",
|
||||
null),
|
||||
transferBillingEvent));
|
||||
@@ -517,9 +512,8 @@ class DomainTransferApproveFlowTest
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(clock.now()) // The cancellation happens at the moment of transfer.
|
||||
.setBillingTime(
|
||||
toDateTime(
|
||||
oldExpirationTime.plusMillis(
|
||||
Tld.get("tld").getAutoRenewGracePeriodLength().getMillis())))
|
||||
oldExpirationTime.plusMillis(
|
||||
Tld.get("tld").getAutoRenewGracePeriodLength().getMillis()))
|
||||
.setBillingRecurrence(domain.getAutorenewBillingEvent()));
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.DomainSubject.assertAboutDomains;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.minusDays;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
@@ -147,7 +148,7 @@ class DomainTransferCancelFlowTest
|
||||
.hasOtherRegistrarId("TheRegistrar");
|
||||
// The only billing event left should be the original autorenew event, now reopened.
|
||||
assertBillingEvents(
|
||||
getLosingClientAutorenewEvent().asBuilder().setRecurrenceEndTime(END_OF_TIME).build());
|
||||
getLosingClientAutorenewEvent().asBuilder().setRecurrenceEndTime(END_INSTANT).build());
|
||||
// The poll message (in the future) to the gaining registrar for implicit ack should be gone.
|
||||
assertThat(getPollMessages("NewRegistrar", clock.nowUtc().plusMonths(1))).isEmpty();
|
||||
// The poll message in the future to the losing registrar should be gone too, but there should
|
||||
|
||||
@@ -23,7 +23,7 @@ import static google.registry.testing.DatabaseHelper.persistDomainWithDependentR
|
||||
import static google.registry.testing.DatabaseHelper.persistDomainWithPendingTransfer;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.DomainSubject.assertAboutDomains;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.plusYears;
|
||||
|
||||
import com.google.common.base.Ascii;
|
||||
@@ -154,7 +154,7 @@ abstract class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
|
||||
.setTargetId(domain.getDomainName())
|
||||
.setRegistrarId("NewRegistrar")
|
||||
.setEventTime(EXTENDED_REGISTRATION_EXPIRATION_TIME)
|
||||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setRecurrenceEndTime(END_INSTANT)
|
||||
.setDomainHistory(
|
||||
getOnlyHistoryEntryOfType(
|
||||
domain, HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST, DomainHistory.class))
|
||||
|
||||
@@ -32,7 +32,7 @@ import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.DomainSubject.assertAboutDomains;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.minusDays;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
@@ -117,13 +117,13 @@ class DomainTransferRejectFlowTest
|
||||
assertLastHistoryContainsResource(domain);
|
||||
// The only billing event left should be the original autorenew event, now reopened.
|
||||
assertBillingEvents(
|
||||
getLosingClientAutorenewEvent().asBuilder().setRecurrenceEndTime(END_OF_TIME).build());
|
||||
getLosingClientAutorenewEvent().asBuilder().setRecurrenceEndTime(END_INSTANT).build());
|
||||
// The poll message (in the future) to the losing registrar for implicit ack should be gone.
|
||||
assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1))).isEmpty();
|
||||
// The poll message in the future to the gaining registrar should be gone too, but there
|
||||
// should be one at the current time to the gaining registrar.
|
||||
PollMessage gainingPollMessage = getOnlyPollMessage("NewRegistrar");
|
||||
assertThat(gainingPollMessage.getEventTime()).isEqualTo(clock.nowUtc());
|
||||
assertThat(gainingPollMessage.getEventTime()).isEqualTo(clock.now());
|
||||
assertThat(
|
||||
gainingPollMessage
|
||||
.getResponseData()
|
||||
|
||||
+19
-37
@@ -250,8 +250,7 @@ class DomainTransferRequestFlowTest
|
||||
.setTransferPeriod(expectedPeriod)
|
||||
.setTransferStatus(TransferStatus.SERVER_APPROVED)
|
||||
.setPendingTransferExpirationTime(automaticTransferTime)
|
||||
.setTransferredRegistrationExpirationTime(
|
||||
domain.getRegistrationExpirationDateTime())
|
||||
.setTransferredRegistrationExpirationTime(domain.getRegistrationExpirationTime())
|
||||
// Server-approve entity fields should all be nulled out.
|
||||
.build());
|
||||
}
|
||||
@@ -341,7 +340,7 @@ class DomainTransferRequestFlowTest
|
||||
// The domain's autorenew billing event should still point to the losing client's event.
|
||||
BillingRecurrence domainAutorenewEvent = loadByKey(domain.getAutorenewBillingEvent());
|
||||
assertThat(domainAutorenewEvent.getRegistrarId()).isEqualTo("TheRegistrar");
|
||||
assertThat(domainAutorenewEvent.getRecurrenceEndTimeInstant()).isEqualTo(implicitTransferTime);
|
||||
assertThat(domainAutorenewEvent.getRecurrenceEndTime()).isEqualTo(implicitTransferTime);
|
||||
// The original grace periods should remain untouched.
|
||||
assertThat(domain.getGracePeriods()).containsExactlyElementsIn(originalGracePeriods);
|
||||
// If we fast forward AUTOMATIC_TRANSFER_DAYS, the transfer should have cleared out all other
|
||||
@@ -379,8 +378,8 @@ class DomainTransferRequestFlowTest
|
||||
getOnlyPollMessage("NewRegistrar", implicitTransferTime, PollMessage.OneTime.class);
|
||||
PollMessage autorenewPollMessage =
|
||||
getOnlyPollMessage("NewRegistrar", expectedExpirationTime, PollMessage.Autorenew.class);
|
||||
assertThat(transferApprovedPollMessage.getEventTimeInstant()).isEqualTo(implicitTransferTime);
|
||||
assertThat(autorenewPollMessage.getEventTimeInstant()).isEqualTo(expectedExpirationTime);
|
||||
assertThat(transferApprovedPollMessage.getEventTime()).isEqualTo(implicitTransferTime);
|
||||
assertThat(autorenewPollMessage.getEventTime()).isEqualTo(expectedExpirationTime);
|
||||
assertThat(
|
||||
transferApprovedPollMessage.getResponseData().stream()
|
||||
.filter(TransferResponse.class::isInstance)
|
||||
@@ -407,9 +406,8 @@ class DomainTransferRequestFlowTest
|
||||
getPollMessages("TheRegistrar", implicitTransferTime).stream()
|
||||
.filter(Predicates.not(Predicates.equalTo(losingTransferPendingPollMessage)))
|
||||
.collect(onlyElement());
|
||||
assertThat(losingTransferPendingPollMessage.getEventTimeInstant()).isEqualTo(clock.now());
|
||||
assertThat(losingTransferApprovedPollMessage.getEventTimeInstant())
|
||||
.isEqualTo(implicitTransferTime);
|
||||
assertThat(losingTransferPendingPollMessage.getEventTime()).isEqualTo(clock.now());
|
||||
assertThat(losingTransferApprovedPollMessage.getEventTime()).isEqualTo(implicitTransferTime);
|
||||
assertThat(
|
||||
losingTransferPendingPollMessage.getResponseData().stream()
|
||||
.filter(TransferResponse.class::isInstance)
|
||||
@@ -451,9 +449,7 @@ class DomainTransferRequestFlowTest
|
||||
.hasLastEppUpdateTime(implicitTransferTime)
|
||||
.and()
|
||||
.hasLastEppUpdateRegistrarId("NewRegistrar");
|
||||
assertThat(
|
||||
loadByKey(domainAfterAutomaticTransfer.getAutorenewBillingEvent())
|
||||
.getEventTimeInstant())
|
||||
assertThat(loadByKey(domainAfterAutomaticTransfer.getAutorenewBillingEvent()).getEventTime())
|
||||
.isEqualTo(expectedExpirationTime);
|
||||
// And after the expected grace time, the grace period should be gone.
|
||||
Domain afterGracePeriod =
|
||||
@@ -1062,10 +1058,8 @@ class DomainTransferRequestFlowTest
|
||||
// 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.
|
||||
Instant autorenewTime =
|
||||
clock
|
||||
.now()
|
||||
.minusMillis(Tld.get("tld").getAutoRenewGracePeriodLength().getMillis())
|
||||
.plus(java.time.Duration.ofDays(1));
|
||||
plusDays(
|
||||
clock.now().minusMillis(Tld.get("tld").getAutoRenewGracePeriodLength().getMillis()), 1);
|
||||
Instant expirationTime = plusYears(autorenewTime, 1);
|
||||
domain =
|
||||
persistResource(
|
||||
@@ -1125,14 +1119,10 @@ class DomainTransferRequestFlowTest
|
||||
.setRegistrarId("TheRegistrar")
|
||||
// The cancellation happens at the moment of transfer.
|
||||
.setEventTime(
|
||||
toDateTime(
|
||||
clock
|
||||
.now()
|
||||
.plusMillis(Tld.get("tld").getAutomaticTransferLength().getMillis())))
|
||||
clock.now().plusMillis(Tld.get("tld").getAutomaticTransferLength().getMillis()))
|
||||
.setBillingTime(
|
||||
toDateTime(
|
||||
autorenewTime.plusMillis(
|
||||
Tld.get("tld").getAutoRenewGracePeriodLength().getMillis())))
|
||||
autorenewTime.plusMillis(
|
||||
Tld.get("tld").getAutoRenewGracePeriodLength().getMillis()))
|
||||
// The cancellation should refer to the old autorenew billing event.
|
||||
.setBillingRecurrence(existingAutorenewEvent));
|
||||
}
|
||||
@@ -1159,14 +1149,10 @@ class DomainTransferRequestFlowTest
|
||||
.setRegistrarId("TheRegistrar")
|
||||
// The cancellation happens at the moment of transfer.
|
||||
.setEventTime(
|
||||
toDateTime(
|
||||
clock
|
||||
.now()
|
||||
.plusMillis(Tld.get("tld").getAutomaticTransferLength().getMillis())))
|
||||
clock.now().plusMillis(Tld.get("tld").getAutomaticTransferLength().getMillis()))
|
||||
.setBillingTime(
|
||||
toDateTime(
|
||||
expirationTime.plusMillis(
|
||||
Tld.get("tld").getAutoRenewGracePeriodLength().getMillis())))
|
||||
expirationTime.plusMillis(
|
||||
Tld.get("tld").getAutoRenewGracePeriodLength().getMillis()))
|
||||
// The cancellation should refer to the old autorenew billing event.
|
||||
.setBillingRecurrence(existingAutorenewEvent));
|
||||
}
|
||||
@@ -1225,8 +1211,7 @@ class DomainTransferRequestFlowTest
|
||||
domain,
|
||||
new BillingEvent.Builder()
|
||||
.setBillingTime(
|
||||
toDateTime(
|
||||
plusDays(now, 10))) // 5 day pending transfer + 5 day billing grace period
|
||||
plusDays(now, 10)) // 5 day pending transfer + 5 day billing grace period
|
||||
.setEventTime(plusDays(now, 5))
|
||||
.setRegistrarId("NewRegistrar")
|
||||
.setCost(Money.of(USD, new BigDecimal("11.00")))
|
||||
@@ -1282,8 +1267,7 @@ class DomainTransferRequestFlowTest
|
||||
domain,
|
||||
new BillingEvent.Builder()
|
||||
.setBillingTime(
|
||||
toDateTime(
|
||||
plusDays(now, 10))) // 5 day pending transfer + 5 day billing grace period
|
||||
plusDays(now, 10)) // 5 day pending transfer + 5 day billing grace period
|
||||
.setEventTime(plusDays(now, 5))
|
||||
.setRegistrarId("NewRegistrar")
|
||||
.setCost(Money.of(USD, new BigDecimal("18.79")))
|
||||
@@ -1345,8 +1329,7 @@ class DomainTransferRequestFlowTest
|
||||
domain,
|
||||
new BillingEvent.Builder()
|
||||
.setBillingTime(
|
||||
toDateTime(
|
||||
plusDays(now, 10))) // 5 day pending transfer + 5 day billing grace period
|
||||
plusDays(now, 10)) // 5 day pending transfer + 5 day billing grace period
|
||||
.setEventTime(plusDays(now, 5))
|
||||
.setRegistrarId("NewRegistrar")
|
||||
.setCost(Money.of(USD, new BigDecimal("11.00")))
|
||||
@@ -1407,8 +1390,7 @@ class DomainTransferRequestFlowTest
|
||||
domain,
|
||||
new BillingEvent.Builder()
|
||||
.setBillingTime(
|
||||
toDateTime(
|
||||
plusDays(now, 10))) // 5 day pending transfer + 5 day billing grace period
|
||||
plusDays(now, 10)) // 5 day pending transfer + 5 day billing grace period
|
||||
.setEventTime(plusDays(now, 5))
|
||||
.setRegistrarId("NewRegistrar")
|
||||
.setCost(Money.of(USD, new BigDecimal("11.00")))
|
||||
|
||||
@@ -27,6 +27,7 @@ import static google.registry.testing.DatabaseHelper.persistDeletedHost;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.HostSubject.assertAboutHosts;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -55,7 +56,7 @@ import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** Unit tests for {@link HostCreateFlow}. */
|
||||
@@ -79,7 +80,7 @@ class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Host> {
|
||||
|
||||
HostCreateFlowTest() {
|
||||
setEppHostCreateInput("ns1.example.tld", null);
|
||||
clock.setTo(DateTime.parse("1999-04-03T22:00:00.0Z"));
|
||||
clock.setTo(Instant.parse("1999-04-03T22:00:00.0Z"));
|
||||
}
|
||||
|
||||
private void doSuccessfulTest() throws Exception {
|
||||
@@ -225,7 +226,7 @@ class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Host> {
|
||||
persistResource(
|
||||
DatabaseHelper.newDomain("example.tld")
|
||||
.asBuilder()
|
||||
.setDeletionTime(clock.nowUtc().plusDays(35))
|
||||
.setDeletionTime(plusDays(clock.now(), 35))
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
|
||||
@@ -26,6 +26,7 @@ import static google.registry.testing.DatabaseHelper.persistDeletedHost;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.HostSubject.assertAboutHosts;
|
||||
import static google.registry.util.DateTimeUtils.minusDays;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -48,7 +49,7 @@ import google.registry.model.tld.Tld;
|
||||
import google.registry.model.transfer.DomainTransferData;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.Instant;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -236,9 +237,10 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Host> {
|
||||
sessionMetadata.setRegistrarId("NewRegistrar");
|
||||
createTld("tld");
|
||||
// Setup a transfer that should have been server approved a day ago.
|
||||
DateTime now = clock.nowUtc();
|
||||
DateTime requestTime = now.minusDays(1).minus(Tld.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
DateTime transferExpirationTime = now.minusDays(1);
|
||||
Instant now = clock.now();
|
||||
Instant requestTime =
|
||||
minusDays(now, 1).minusMillis(Tld.DEFAULT_AUTOMATIC_TRANSFER_LENGTH.getMillis());
|
||||
Instant transferExpirationTime = minusDays(now, 1);
|
||||
Domain domain =
|
||||
persistResource(
|
||||
DatabaseHelper.newDomain("example.tld")
|
||||
@@ -270,9 +272,10 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Host> {
|
||||
sessionMetadata.setRegistrarId("NewRegistrar");
|
||||
createTld("tld");
|
||||
// Setup a transfer that should have been server approved a day ago.
|
||||
DateTime now = clock.nowUtc();
|
||||
DateTime requestTime = now.minusDays(1).minus(Tld.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
DateTime transferExpirationTime = now.minusDays(1);
|
||||
Instant now = clock.now();
|
||||
Instant requestTime =
|
||||
minusDays(now, 1).minusMillis(Tld.DEFAULT_AUTOMATIC_TRANSFER_LENGTH.getMillis());
|
||||
Instant transferExpirationTime = minusDays(now, 1);
|
||||
Domain domain =
|
||||
persistResource(
|
||||
DatabaseHelper.newDomain("example.tld")
|
||||
|
||||
@@ -21,6 +21,7 @@ import static google.registry.testing.DatabaseHelper.deleteResource;
|
||||
import static google.registry.testing.DatabaseHelper.persistNewRegistrar;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.util.DateTimeUtils.minusDays;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -37,8 +38,8 @@ import google.registry.model.domain.Domain;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
import java.time.Instant;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -66,9 +67,9 @@ class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, Host> {
|
||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||
.setCreationRegistrarId("NewRegistrar")
|
||||
.setLastEppUpdateRegistrarId("NewRegistrar")
|
||||
.setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z"))
|
||||
.setLastEppUpdateTime(DateTime.parse("1999-12-03T09:00:00.0Z"))
|
||||
.setLastTransferTime(DateTime.parse("2000-04-08T09:00:00.0Z"))
|
||||
.setCreationTimeForTest(Instant.parse("1999-04-03T22:00:00.0Z"))
|
||||
.setLastEppUpdateTime(Instant.parse("1999-12-03T09:00:00.0Z"))
|
||||
.setLastTransferTime(Instant.parse("2000-04-08T09:00:00.0Z"))
|
||||
.build());
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, Host> {
|
||||
}
|
||||
|
||||
private void runTest_superordinateDomain(
|
||||
DateTime domainTransferTime, @Nullable DateTime lastSuperordinateChange) throws Exception {
|
||||
Instant domainTransferTime, @Nullable Instant lastSuperordinateChange) throws Exception {
|
||||
persistNewRegistrar("superclientid");
|
||||
Domain domain =
|
||||
persistResource(
|
||||
@@ -143,18 +144,18 @@ class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, Host> {
|
||||
@Test
|
||||
void testSuccess_withSuperordinateDomain_hostMovedAfterDomainTransfer() throws Exception {
|
||||
runTest_superordinateDomain(
|
||||
DateTime.parse("2000-01-08T09:00:00.0Z"), DateTime.parse("2000-03-01T01:00:00.0Z"));
|
||||
Instant.parse("2000-01-08T09:00:00.0Z"), Instant.parse("2000-03-01T01:00:00.0Z"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_withSuperordinateDomain_hostMovedBeforeDomainTransfer() throws Exception {
|
||||
runTest_superordinateDomain(
|
||||
DateTime.parse("2000-04-08T09:00:00.0Z"), DateTime.parse("2000-02-08T09:00:00.0Z"));
|
||||
Instant.parse("2000-04-08T09:00:00.0Z"), Instant.parse("2000-02-08T09:00:00.0Z"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_withSuperordinateDomain() throws Exception {
|
||||
runTest_superordinateDomain(DateTime.parse("2000-04-08T09:00:00.0Z"), null);
|
||||
runTest_superordinateDomain(Instant.parse("2000-04-08T09:00:00.0Z"), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -166,7 +167,7 @@ class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, Host> {
|
||||
|
||||
@Test
|
||||
void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistResource(persistHost().asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
persistResource(persistHost().asBuilder().setDeletionTime(minusDays(clock.now(), 1)).build());
|
||||
ResourceDoesNotExistException thrown =
|
||||
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
|
||||
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
|
||||
@@ -36,7 +36,10 @@ import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptio
|
||||
import static google.registry.testing.GenericEppResourceSubject.assertAboutEppResources;
|
||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||
import static google.registry.testing.HostSubject.assertAboutHosts;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.END_INSTANT;
|
||||
import static google.registry.util.DateTimeUtils.minusDays;
|
||||
import static google.registry.util.DateTimeUtils.plusDays;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.cloud.tasks.v2.HttpMethod;
|
||||
@@ -83,7 +86,6 @@ import google.registry.testing.CloudTasksHelper.TaskMatcher;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
import java.time.Instant;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** Unit tests for {@link HostUpdateFlow}. */
|
||||
@@ -114,9 +116,10 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
* <p>The transfer is from "TheRegistrar" to "NewRegistrar".
|
||||
*/
|
||||
private Domain createDomainWithServerApprovedTransfer(String domainName) {
|
||||
DateTime now = clock.nowUtc();
|
||||
DateTime requestTime = now.minusDays(1).minus(Tld.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
DateTime transferExpirationTime = now.minusDays(1);
|
||||
Instant now = clock.now();
|
||||
Instant requestTime =
|
||||
minusDays(now, 1).minusMillis(Tld.DEFAULT_AUTOMATIC_TRANSFER_LENGTH.getMillis());
|
||||
Instant transferExpirationTime = minusDays(now, 1);
|
||||
return DatabaseHelper.newDomain(domainName)
|
||||
.asBuilder()
|
||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||
@@ -199,7 +202,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
persistResource(
|
||||
DatabaseHelper.newDomain("test.xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setDeletionTime(END_OF_TIME)
|
||||
.setDeletionTime(END_INSTANT)
|
||||
.setNameservers(ImmutableSet.of(host.createVKey()))
|
||||
.build());
|
||||
Host renamedHost = doSuccessfulTest();
|
||||
@@ -243,7 +246,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
sessionMetadata.setRegistrarId("NewRegistrar");
|
||||
setEppInput("host_update_name_unchanged.xml");
|
||||
createTld("tld");
|
||||
// Create a domain that will belong to NewRegistrar after cloneProjectedAtTime is called.
|
||||
// Create a domain that will belong to NewRegistrar after cloneProjectedAtInstant is called.
|
||||
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
||||
Host oldHost = persistActiveSubordinateHost(oldHostName(), domain);
|
||||
clock.advanceOneMilli();
|
||||
@@ -257,7 +260,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.and()
|
||||
.hasPersistedCurrentSponsorRegistrarId("NewRegistrar")
|
||||
.and()
|
||||
.hasLastTransferTime(domain.getTransferData().getPendingTransferExpirationDateTime())
|
||||
.hasLastTransferTime(domain.getTransferData().getPendingTransferExpirationTime())
|
||||
.and()
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.HOST_UPDATE);
|
||||
@@ -272,8 +275,8 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
"<host:addr ip=\"v4\">192.0.2.22</host:addr>",
|
||||
"<host:addr ip=\"v6\">1080:0:0:0:8:800:200C:417A</host:addr>");
|
||||
createTld("tld");
|
||||
DateTime now = clock.nowUtc();
|
||||
DateTime oneDayAgo = now.minusDays(1);
|
||||
Instant now = clock.now();
|
||||
Instant oneDayAgo = minusDays(now, 1);
|
||||
Domain domain =
|
||||
persistResource(
|
||||
DatabaseHelper.newDomain("example.tld")
|
||||
@@ -293,7 +296,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||
.and()
|
||||
.hasLastTransferTime(oneDayAgo);
|
||||
Domain reloadedDomain = loadByEntity(domain).cloneProjectedAtTime(now);
|
||||
Domain reloadedDomain = loadByEntity(domain).cloneProjectedAtInstant(now);
|
||||
assertThat(reloadedDomain.getSubordinateHosts()).containsExactly("ns2.example.tld");
|
||||
assertHostDnsRequests("ns1.example.tld", "ns2.example.tld");
|
||||
}
|
||||
@@ -317,7 +320,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
assertThat(foo.getSubordinateHosts()).containsExactly("ns2.foo.tld");
|
||||
assertThat(example.getSubordinateHosts()).isEmpty();
|
||||
Host renamedHost = doSuccessfulTest();
|
||||
DateTime now = clock.nowUtc();
|
||||
Instant now = clock.now();
|
||||
assertAboutHosts()
|
||||
.that(renamedHost)
|
||||
.hasSuperordinateDomain(example.createVKey())
|
||||
@@ -327,8 +330,8 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||
.and()
|
||||
.hasLastTransferTime(null);
|
||||
assertThat(loadByEntity(foo).cloneProjectedAtTime(now).getSubordinateHosts()).isEmpty();
|
||||
assertThat(loadByEntity(example).cloneProjectedAtTime(now).getSubordinateHosts())
|
||||
assertThat(loadByEntity(foo).cloneProjectedAtInstant(now).getSubordinateHosts()).isEmpty();
|
||||
assertThat(loadByEntity(example).cloneProjectedAtInstant(now).getSubordinateHosts())
|
||||
.containsExactly("ns2.example.tld");
|
||||
assertHostDnsRequests("ns2.foo.tld", "ns2.example.tld");
|
||||
}
|
||||
@@ -353,7 +356,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
assertThat(fooDomain.getSubordinateHosts()).containsExactly("ns1.example.foo");
|
||||
assertThat(tldDomain.getSubordinateHosts()).isEmpty();
|
||||
Host renamedHost = doSuccessfulTest();
|
||||
DateTime now = clock.nowUtc();
|
||||
Instant now = clock.now();
|
||||
assertAboutHosts()
|
||||
.that(renamedHost)
|
||||
.hasSuperordinateDomain(tldDomain.createVKey())
|
||||
@@ -363,9 +366,9 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||
.and()
|
||||
.hasLastTransferTime(null);
|
||||
Domain reloadedFooDomain = loadByEntity(fooDomain).cloneProjectedAtTime(now);
|
||||
Domain reloadedFooDomain = loadByEntity(fooDomain).cloneProjectedAtInstant(now);
|
||||
assertThat(reloadedFooDomain.getSubordinateHosts()).isEmpty();
|
||||
Domain reloadedTldDomain = loadByEntity(tldDomain).cloneProjectedAtTime(now);
|
||||
Domain reloadedTldDomain = loadByEntity(tldDomain).cloneProjectedAtInstant(now);
|
||||
assertThat(reloadedTldDomain.getSubordinateHosts()).containsExactly("ns2.example.tld");
|
||||
assertHostDnsRequests("ns1.example.foo", "ns2.example.tld");
|
||||
}
|
||||
@@ -387,7 +390,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
||||
.build());
|
||||
assertThat(domain.getCurrentSponsorRegistrarId()).isEqualTo("TheRegistrar");
|
||||
DateTime oneDayAgo = clock.nowUtc().minusDays(1);
|
||||
Instant oneDayAgo = minusDays(clock.now(), 1);
|
||||
Host oldHost =
|
||||
persistResource(
|
||||
persistActiveSubordinateHost(oldHostName(), domain)
|
||||
@@ -406,7 +409,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.and()
|
||||
.hasLastTransferTime(oneDayAgo)
|
||||
.and()
|
||||
.hasLastSuperordinateChange(clock.nowUtc());
|
||||
.hasLastSuperordinateChange(clock.now());
|
||||
assertThat(renamedHost.getLastTransferTime()).isEqualTo(oneDayAgo);
|
||||
Domain reloadedDomain = loadByEntity(domain).cloneProjectedAtInstant(clock.now());
|
||||
assertThat(reloadedDomain.getSubordinateHosts()).isEmpty();
|
||||
@@ -434,7 +437,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
persistActiveHost(oldHostName());
|
||||
assertThat(domain.getSubordinateHosts()).isEmpty();
|
||||
Host renamedHost = doSuccessfulTestAsSuperuser();
|
||||
DateTime now = clock.nowUtc();
|
||||
Instant now = clock.now();
|
||||
assertAboutHosts()
|
||||
.that(renamedHost)
|
||||
.hasSuperordinateDomain(domain.createVKey())
|
||||
@@ -444,7 +447,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||
.and()
|
||||
.hasLastTransferTime(null);
|
||||
assertThat(loadByEntity(domain).cloneProjectedAtTime(now).getSubordinateHosts())
|
||||
assertThat(loadByEntity(domain).cloneProjectedAtInstant(now).getSubordinateHosts())
|
||||
.containsExactly("ns2.example.tld");
|
||||
assertHostDnsRequests("ns2.example.tld");
|
||||
}
|
||||
@@ -505,7 +508,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
"<host:addr ip=\"v4\">192.0.2.22</host:addr>",
|
||||
"<host:addr ip=\"v6\">1080:0:0:0:8:800:200C:417A</host:addr>");
|
||||
createTld("tld");
|
||||
DateTime lastTransferTime = clock.nowUtc().minusDays(5);
|
||||
Instant lastTransferTime = minusDays(clock.now(), 5);
|
||||
Domain foo =
|
||||
persistResource(
|
||||
DatabaseHelper.newDomain("foo.tld")
|
||||
@@ -564,12 +567,12 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
newHost(oldHostName())
|
||||
.asBuilder()
|
||||
.setSuperordinateDomain(domain.createVKey())
|
||||
.setLastTransferTime(clock.nowUtc().minusDays(20))
|
||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(3))
|
||||
.setLastTransferTime(minusDays(clock.now(), 20))
|
||||
.setLastSuperordinateChange(minusDays(clock.now(), 3))
|
||||
.setInetAddresses(
|
||||
ImmutableSet.of(InetAddresses.forString("1080:0:0:0:8:800:200C:417A")))
|
||||
.build());
|
||||
DateTime lastTransferTime = host.getLastTransferTime();
|
||||
Instant lastTransferTime = host.getLastTransferTime();
|
||||
persistResource(domain.asBuilder().setSubordinateHosts(ImmutableSet.of(oldHostName())).build());
|
||||
Host renamedHost = doSuccessfulTest();
|
||||
assertAboutHosts()
|
||||
@@ -600,14 +603,14 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.asBuilder()
|
||||
.setLastTransferTime((Instant) null)
|
||||
.build());
|
||||
DateTime lastTransferTime = clock.nowUtc().minusDays(20);
|
||||
Instant lastTransferTime = minusDays(clock.now(), 20);
|
||||
|
||||
persistResource(
|
||||
newHost(oldHostName())
|
||||
.asBuilder()
|
||||
.setSuperordinateDomain(foo.createVKey())
|
||||
.setLastTransferTime(lastTransferTime)
|
||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(3))
|
||||
.setLastSuperordinateChange(minusDays(clock.now(), 3))
|
||||
.setInetAddresses(
|
||||
ImmutableSet.of(InetAddresses.forString("1080:0:0:0:8:800:200C:417A")))
|
||||
.build());
|
||||
@@ -642,14 +645,14 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.asBuilder()
|
||||
.setLastTransferTime((Instant) null)
|
||||
.build());
|
||||
DateTime lastTransferTime = clock.nowUtc().minusDays(20);
|
||||
Instant lastTransferTime = minusDays(clock.now(), 20);
|
||||
|
||||
persistResource(
|
||||
newHost(oldHostName())
|
||||
.asBuilder()
|
||||
.setSuperordinateDomain(foo.createVKey())
|
||||
.setLastTransferTime(lastTransferTime)
|
||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(10))
|
||||
.setLastSuperordinateChange(minusDays(clock.now(), 10))
|
||||
.setInetAddresses(
|
||||
ImmutableSet.of(InetAddresses.forString("1080:0:0:0:8:800:200C:417A")))
|
||||
.build());
|
||||
@@ -688,7 +691,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.asBuilder()
|
||||
.setSuperordinateDomain(foo.createVKey())
|
||||
.setLastTransferTime((Instant) null)
|
||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(3))
|
||||
.setLastSuperordinateChange(minusDays(clock.now(), 3))
|
||||
.setInetAddresses(
|
||||
ImmutableSet.of(InetAddresses.forString("1080:0:0:0:8:800:200C:417A")))
|
||||
.build());
|
||||
@@ -718,7 +721,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.setInetAddresses(
|
||||
ImmutableSet.of(InetAddresses.forString("1080:0:0:0:8:800:200C:417A")))
|
||||
.build());
|
||||
DateTime lastTransferTime = clock.nowUtc().minusDays(2);
|
||||
Instant lastTransferTime = minusDays(clock.now(), 2);
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
@@ -739,7 +742,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.and()
|
||||
// Need to add two milliseconds to account for the increment of "persist resource" and the
|
||||
// artificial increment introduced after the flow itself.
|
||||
.hasLastSuperordinateChange(clock.nowUtc().minusMillis(2));
|
||||
.hasLastSuperordinateChange(clock.now().minusMillis(2));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -751,13 +754,13 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
"<host:addr ip=\"v6\">1080:0:0:0:8:800:200C:417A</host:addr>");
|
||||
createTld("foo");
|
||||
Domain domain = persistActiveDomain("example.foo");
|
||||
DateTime lastTransferTime = clock.nowUtc().minusDays(12);
|
||||
Instant lastTransferTime = minusDays(clock.now(), 12);
|
||||
persistResource(
|
||||
newHost(oldHostName())
|
||||
.asBuilder()
|
||||
.setSuperordinateDomain(domain.createVKey())
|
||||
.setLastTransferTime(lastTransferTime)
|
||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(4))
|
||||
.setLastSuperordinateChange(minusDays(clock.now(), 4))
|
||||
.setInetAddresses(
|
||||
ImmutableSet.of(InetAddresses.forString("1080:0:0:0:8:800:200C:417A")))
|
||||
.build());
|
||||
@@ -793,8 +796,8 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
newHost(oldHostName())
|
||||
.asBuilder()
|
||||
.setSuperordinateDomain(domain.createVKey())
|
||||
.setLastTransferTime(clock.nowUtc().minusDays(12))
|
||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(4))
|
||||
.setLastTransferTime(minusDays(clock.now(), 12))
|
||||
.setLastSuperordinateChange(minusDays(clock.now(), 4))
|
||||
.setInetAddresses(
|
||||
ImmutableSet.of(InetAddresses.forString("1080:0:0:0:8:800:200C:417A")))
|
||||
.build());
|
||||
@@ -812,11 +815,11 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
.that(renamedHost)
|
||||
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||
.and()
|
||||
.hasLastTransferTime(domain.getLastTransferTime());
|
||||
.hasLastTransferTime(toInstant(domain.getLastTransferTime()));
|
||||
}
|
||||
|
||||
private void doExternalToInternalLastTransferTimeTest(
|
||||
DateTime hostTransferTime, @Nullable DateTime domainTransferTime) throws Exception {
|
||||
Instant hostTransferTime, @Nullable Instant domainTransferTime) throws Exception {
|
||||
setEppHostUpdateInput(
|
||||
"ns1.example.foo", "ns2.example.tld", "<host:addr ip=\"v4\">192.0.2.22</host:addr>", null);
|
||||
createTld("tld");
|
||||
@@ -838,21 +841,19 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
@Test
|
||||
void testSuccess_externalToSubord_lastTransferTimeNotOverridden_whenLessRecent()
|
||||
throws Exception {
|
||||
doExternalToInternalLastTransferTimeTest(
|
||||
clock.nowUtc().minusDays(2), clock.nowUtc().minusDays(1));
|
||||
doExternalToInternalLastTransferTimeTest(minusDays(clock.now(), 2), minusDays(clock.now(), 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_externalToSubord_lastTransferTimeNotOverridden_whenMoreRecent()
|
||||
throws Exception {
|
||||
doExternalToInternalLastTransferTimeTest(
|
||||
clock.nowUtc().minusDays(2), clock.nowUtc().minusDays(3));
|
||||
doExternalToInternalLastTransferTimeTest(minusDays(clock.now(), 2), minusDays(clock.now(), 3));
|
||||
}
|
||||
|
||||
/** Test when the new superordinate domain has never been transferred before. */
|
||||
@Test
|
||||
void testSuccess_externalToSubord_lastTransferTimeNotOverridden_whenNull() throws Exception {
|
||||
doExternalToInternalLastTransferTimeTest(clock.nowUtc().minusDays(2), null);
|
||||
doExternalToInternalLastTransferTimeTest(minusDays(clock.now(), 2), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -877,7 +878,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
DatabaseHelper.newDomain("example.tld")
|
||||
.asBuilder()
|
||||
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
||||
.setDeletionTime(clock.nowUtc().plusDays(35))
|
||||
.setDeletionTime(plusDays(clock.now(), 35))
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
.build());
|
||||
persistActiveSubordinateHost(oldHostName(), domain);
|
||||
@@ -1049,8 +1050,8 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
newHost(oldHostName())
|
||||
.asBuilder()
|
||||
.setSuperordinateDomain(domain.createVKey())
|
||||
.setLastTransferTime(clock.nowUtc().minusDays(12))
|
||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(4))
|
||||
.setLastTransferTime(minusDays(clock.now(), 12))
|
||||
.setLastSuperordinateChange(minusDays(clock.now(), 4))
|
||||
.setInetAddresses(
|
||||
ImmutableSet.of(InetAddresses.forString("1080:0:0:0:8:800:200C:417A")))
|
||||
.build());
|
||||
@@ -1072,8 +1073,8 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
newHost(oldHostName())
|
||||
.asBuilder()
|
||||
.setSuperordinateDomain(domain.createVKey())
|
||||
.setLastTransferTime(clock.nowUtc().minusDays(12))
|
||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(4))
|
||||
.setLastTransferTime(minusDays(clock.now(), 12))
|
||||
.setLastSuperordinateChange(minusDays(clock.now(), 4))
|
||||
.build());
|
||||
setEppHostUpdateInput(
|
||||
"ns1.example.tld",
|
||||
@@ -1234,7 +1235,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
void testSuccess_authorizedClientReadFromTransferredSuperordinate() throws Exception {
|
||||
sessionMetadata.setRegistrarId("NewRegistrar");
|
||||
createTld("tld");
|
||||
// Create a domain that will belong to NewRegistrar after cloneProjectedAtTime is called.
|
||||
// Create a domain that will belong to NewRegistrar after cloneProjectedAtInstant is called.
|
||||
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
||||
persistResource(
|
||||
newHost("ns1.example.tld")
|
||||
@@ -1252,7 +1253,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
void testFailure_unauthorizedClientReadFromTransferredSuperordinate() {
|
||||
sessionMetadata.setRegistrarId("TheRegistrar");
|
||||
createTld("tld");
|
||||
// Create a domain that will belong to NewRegistrar after cloneProjectedAtTime is called.
|
||||
// Create a domain that will belong to NewRegistrar after cloneProjectedAtInstant is called.
|
||||
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
||||
persistResource(
|
||||
newHost("ns1.example.tld")
|
||||
@@ -1293,7 +1294,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
createTld("foo");
|
||||
createTld("tld");
|
||||
Host host = persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.foo"));
|
||||
// The domain will belong to NewRegistrar after cloneProjectedAtTime is called.
|
||||
// The domain will belong to NewRegistrar after cloneProjectedAtInstant is called.
|
||||
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
||||
assertAboutDomains().that(domain).hasPersistedCurrentSponsorRegistrarId("TheRegistrar");
|
||||
assertAboutHosts().that(host).hasPersistedCurrentSponsorRegistrarId("TheRegistrar");
|
||||
@@ -1309,7 +1310,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
sessionMetadata.setRegistrarId("NewRegistrar");
|
||||
createTld("foo");
|
||||
createTld("tld");
|
||||
// The domain will belong to NewRegistrar after cloneProjectedAtTime is called.
|
||||
// The domain will belong to NewRegistrar after cloneProjectedAtInstant is called.
|
||||
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
||||
Domain superordinate =
|
||||
persistResource(
|
||||
|
||||
@@ -19,6 +19,7 @@ import static google.registry.testing.DatabaseHelper.createHistoryEntryForEppRes
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.toInstant;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -67,7 +68,7 @@ class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
|
||||
new PollMessage.Autorenew.Builder()
|
||||
.setId(MESSAGE_ID)
|
||||
.setRegistrarId(getRegistrarIdForFlow())
|
||||
.setEventTime(eventTime)
|
||||
.setEventTime(toInstant(eventTime))
|
||||
.setAutorenewEndTime(endTime)
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setTargetId("example.com")
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user