mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
When resolving a transfer to SERVER_CANCELLED (on delete) still pass in a time
Currently we pass in null. However, from the spec: <domain:acDate> element that contains the date and time of a required or completed response. For a PENDING request, the value identifies the date and time by which a response is required before an automated response action will be taken by the server. For all other status types, the value identifies the date and time when the request was completed." - https://tools.ietf.org/html/rfc5731#page-16, section 3.1.3 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=139363370
This commit is contained in:
parent
a343648b34
commit
438eeb5e38
5 changed files with 12 additions and 9 deletions
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
package google.registry.flows;
|
package google.registry.flows;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
import static com.google.common.collect.Iterables.tryFind;
|
import static com.google.common.collect.Iterables.tryFind;
|
||||||
import static com.google.common.collect.Sets.intersection;
|
import static com.google.common.collect.Sets.intersection;
|
||||||
|
@ -67,7 +68,6 @@ import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
/** Static utility functions for resource flows. */
|
/** Static utility functions for resource flows. */
|
||||||
|
@ -221,7 +221,7 @@ public final class ResourceFlowUtils {
|
||||||
.setServerApproveAutorenewEvent(null)
|
.setServerApproveAutorenewEvent(null)
|
||||||
.setServerApproveAutorenewPollMessage(null)
|
.setServerApproveAutorenewPollMessage(null)
|
||||||
.setTransferStatus(transferStatus)
|
.setTransferStatus(transferStatus)
|
||||||
.setPendingTransferExpirationTime(now)
|
.setPendingTransferExpirationTime(checkNotNull(now))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,15 +232,12 @@ public final class ResourceFlowUtils {
|
||||||
* {@link TransferStatus}, clears all the server-approve fields on the {@link TransferData}
|
* {@link TransferStatus}, clears all the server-approve fields on the {@link TransferData}
|
||||||
* including the extended registration years field, and sets the expiration time of the last
|
* including the extended registration years field, and sets the expiration time of the last
|
||||||
* pending transfer to now.
|
* pending transfer to now.
|
||||||
*
|
|
||||||
* @param now the time that the transfer was resolved, or null if the transfer was never actually
|
|
||||||
* resolved but the resource was deleted while it was still pending.
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <
|
public static <
|
||||||
R extends EppResource & ResourceWithTransferData,
|
R extends EppResource & ResourceWithTransferData,
|
||||||
B extends EppResource.Builder<R, B> & BuilderWithTransferData<B>> B resolvePendingTransfer(
|
B extends EppResource.Builder<R, B> & BuilderWithTransferData<B>> B resolvePendingTransfer(
|
||||||
R resource, TransferStatus transferStatus, @Nullable DateTime now) {
|
R resource, TransferStatus transferStatus, DateTime now) {
|
||||||
return ((B) resource.asBuilder())
|
return ((B) resource.asBuilder())
|
||||||
.removeStatusValue(StatusValue.PENDING_TRANSFER)
|
.removeStatusValue(StatusValue.PENDING_TRANSFER)
|
||||||
.setTransferData(
|
.setTransferData(
|
||||||
|
|
|
@ -319,7 +319,7 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
||||||
ContactResource contact = (ContactResource) resource;
|
ContactResource contact = (ContactResource) resource;
|
||||||
resourceToSaveBuilder = contact.asBuilder()
|
resourceToSaveBuilder = contact.asBuilder()
|
||||||
.setTransferData(createResolvedTransferData(
|
.setTransferData(createResolvedTransferData(
|
||||||
contact.getTransferData(), TransferStatus.SERVER_CANCELLED, null))
|
contact.getTransferData(), TransferStatus.SERVER_CANCELLED, now))
|
||||||
.wipeOut();
|
.wipeOut();
|
||||||
} else {
|
} else {
|
||||||
resourceToSaveBuilder = resource.asBuilder();
|
resourceToSaveBuilder = resource.asBuilder();
|
||||||
|
|
|
@ -122,7 +122,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
||||||
HistoryEntry historyEntry = buildHistoryEntry(existingDomain, now);
|
HistoryEntry historyEntry = buildHistoryEntry(existingDomain, now);
|
||||||
Builder builder =
|
Builder builder =
|
||||||
ResourceFlowUtils.<DomainResource, DomainResource.Builder>resolvePendingTransfer(
|
ResourceFlowUtils.<DomainResource, DomainResource.Builder>resolvePendingTransfer(
|
||||||
existingDomain, TransferStatus.SERVER_CANCELLED, null);
|
existingDomain, TransferStatus.SERVER_CANCELLED, now);
|
||||||
builder.setDeletionTime(now).setStatusValues(null);
|
builder.setDeletionTime(now).setStatusValues(null);
|
||||||
// If the domain is in the Add Grace Period, we delete it immediately, which is already
|
// If the domain is in the Add Grace Period, we delete it immediately, which is already
|
||||||
// reflected in the builder we just prepared. Otherwise we give it a PENDING_DELETE status.
|
// reflected in the builder we just prepared. Otherwise we give it a PENDING_DELETE status.
|
||||||
|
|
|
@ -210,9 +210,13 @@ public class DeleteContactsAndHostsActionTest
|
||||||
// Check that the contact is deleted as of now.
|
// Check that the contact is deleted as of now.
|
||||||
assertThat(loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())).isNull();
|
assertThat(loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())).isNull();
|
||||||
// Check that it's still there (it wasn't deleted yesterday) and that it has history.
|
// Check that it's still there (it wasn't deleted yesterday) and that it has history.
|
||||||
|
ContactResource softDeletedContact =
|
||||||
|
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc().minusDays(1));
|
||||||
assertAboutContacts()
|
assertAboutContacts()
|
||||||
.that(loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc().minusDays(1)))
|
.that(softDeletedContact)
|
||||||
.hasOneHistoryEntryEachOfTypes(CONTACT_TRANSFER_REQUEST, CONTACT_DELETE);
|
.hasOneHistoryEntryEachOfTypes(CONTACT_TRANSFER_REQUEST, CONTACT_DELETE);
|
||||||
|
assertThat(softDeletedContact.getTransferData().getPendingTransferExpirationTime())
|
||||||
|
.isEqualTo(softDeletedContact.getDeletionTime());
|
||||||
assertNoBillingEvents();
|
assertNoBillingEvents();
|
||||||
PollMessage deletePollMessage =
|
PollMessage deletePollMessage =
|
||||||
Iterables.getOnlyElement(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1)));
|
Iterables.getOnlyElement(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1)));
|
||||||
|
|
|
@ -537,6 +537,8 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
||||||
assertThat(domain.getTransferData().getServerApproveBillingEvent()).isNull();
|
assertThat(domain.getTransferData().getServerApproveBillingEvent()).isNull();
|
||||||
assertThat(domain.getTransferData().getServerApproveAutorenewEvent()).isNull();
|
assertThat(domain.getTransferData().getServerApproveAutorenewEvent()).isNull();
|
||||||
assertThat(domain.getTransferData().getServerApproveAutorenewPollMessage()).isNull();
|
assertThat(domain.getTransferData().getServerApproveAutorenewPollMessage()).isNull();
|
||||||
|
assertThat(domain.getTransferData().getPendingTransferExpirationTime())
|
||||||
|
.isEqualTo(clock.nowUtc());
|
||||||
assertThat(ofy().load().key(oldTransferData.getServerApproveBillingEvent()).now()).isNull();
|
assertThat(ofy().load().key(oldTransferData.getServerApproveBillingEvent()).now()).isNull();
|
||||||
assertThat(ofy().load().key(oldTransferData.getServerApproveAutorenewEvent()).now()).isNull();
|
assertThat(ofy().load().key(oldTransferData.getServerApproveAutorenewEvent()).now()).isNull();
|
||||||
assertThat(ofy().load().key(oldTransferData.getServerApproveAutorenewPollMessage()).now())
|
assertThat(ofy().load().key(oldTransferData.getServerApproveAutorenewPollMessage()).now())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue