mirror of
https://github.com/google/nomulus.git
synced 2025-07-09 12:43:24 +02:00
Convert some Host and Contact flows to tm() (#921)
* Convert HostDeleteFlow to tm() * Add query for contact linked domain
This commit is contained in:
parent
84d2b82050
commit
c45129f9ac
10 changed files with 137 additions and 73 deletions
|
@ -15,8 +15,8 @@
|
||||||
package google.registry.flows;
|
package google.registry.flows;
|
||||||
|
|
||||||
import static com.google.common.collect.Sets.intersection;
|
import static com.google.common.collect.Sets.intersection;
|
||||||
|
import static google.registry.model.EppResourceUtils.getLinkedDomainKeys;
|
||||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||||
import static google.registry.model.EppResourceUtils.queryForLinkedDomains;
|
|
||||||
import static google.registry.model.index.ForeignKeyIndex.loadAndGetKey;
|
import static google.registry.model.index.ForeignKeyIndex.loadAndGetKey;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
|
@ -94,14 +94,13 @@ public final class ResourceFlowUtils {
|
||||||
* actual reference then we can reliably fail. If we don't find any, we can't
|
* actual reference then we can reliably fail. If we don't find any, we can't
|
||||||
* trust the query and need to do the full mapreduce.
|
* trust the query and need to do the full mapreduce.
|
||||||
*/
|
*/
|
||||||
Iterable<Key<DomainBase>> keys =
|
Iterable<VKey<DomainBase>> keys =
|
||||||
queryForLinkedDomains(fki.getResourceKey().getOfyKey(), now)
|
getLinkedDomainKeys(fki.getResourceKey(), now, FAILFAST_CHECK_COUNT);
|
||||||
.limit(FAILFAST_CHECK_COUNT)
|
|
||||||
.keys();
|
|
||||||
VKey<R> resourceVKey = fki.getResourceKey();
|
VKey<R> resourceVKey = fki.getResourceKey();
|
||||||
Predicate<DomainBase> predicate =
|
Predicate<DomainBase> predicate =
|
||||||
domain -> getPotentialReferences.apply(domain).contains(resourceVKey);
|
domain -> getPotentialReferences.apply(domain).contains(resourceVKey);
|
||||||
return ofy().load().keys(keys).values().stream().anyMatch(predicate)
|
return tm().loadByKeys(keys).values().stream().anyMatch(predicate)
|
||||||
? new ResourceToDeleteIsReferencedException()
|
? new ResourceToDeleteIsReferencedException()
|
||||||
: null;
|
: null;
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,7 +21,6 @@ import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses
|
||||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||||
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
||||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
|
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -101,7 +100,8 @@ public final class ContactDeleteFlow implements TransactionalFlow {
|
||||||
.setType(HistoryEntry.Type.CONTACT_PENDING_DELETE)
|
.setType(HistoryEntry.Type.CONTACT_PENDING_DELETE)
|
||||||
.setModificationTime(now)
|
.setModificationTime(now)
|
||||||
.setParent(Key.create(existingContact));
|
.setParent(Key.create(existingContact));
|
||||||
ofy().save().<Object>entities(newContact, historyBuilder.build());
|
tm().insert(historyBuilder.build().toChildHistoryEntity());
|
||||||
|
tm().update(newContact);
|
||||||
return responseBuilder.setResultFromCode(SUCCESS_WITH_ACTION_PENDING).build();
|
return responseBuilder.setResultFromCode(SUCCESS_WITH_ACTION_PENDING).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
||||||
import static google.registry.model.EppResourceUtils.isLinked;
|
import static google.registry.model.EppResourceUtils.isLinked;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.googlecode.objectify.Key;
|
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.ExtensionManager;
|
import google.registry.flows.ExtensionManager;
|
||||||
import google.registry.flows.Flow;
|
import google.registry.flows.Flow;
|
||||||
|
@ -77,7 +76,7 @@ public final class ContactInfoFlow implements Flow {
|
||||||
clientId.equals(contact.getCurrentSponsorClientId()) || authInfo.isPresent();
|
clientId.equals(contact.getCurrentSponsorClientId()) || authInfo.isPresent();
|
||||||
ImmutableSet.Builder<StatusValue> statusValues = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<StatusValue> statusValues = new ImmutableSet.Builder<>();
|
||||||
statusValues.addAll(contact.getStatusValues());
|
statusValues.addAll(contact.getStatusValues());
|
||||||
if (isLinked(Key.create(contact), now)) {
|
if (isLinked(contact.createVKey(), now)) {
|
||||||
statusValues.add(StatusValue.LINKED);
|
statusValues.add(StatusValue.LINKED);
|
||||||
}
|
}
|
||||||
return responseBuilder
|
return responseBuilder
|
||||||
|
|
|
@ -21,7 +21,6 @@ import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses
|
||||||
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
||||||
import static google.registry.flows.host.HostFlowUtils.validateHostName;
|
import static google.registry.flows.host.HostFlowUtils.validateHostName;
|
||||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
|
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -108,7 +107,8 @@ public final class HostDeleteFlow implements TransactionalFlow {
|
||||||
.setType(HistoryEntry.Type.HOST_PENDING_DELETE)
|
.setType(HistoryEntry.Type.HOST_PENDING_DELETE)
|
||||||
.setModificationTime(now)
|
.setModificationTime(now)
|
||||||
.setParent(Key.create(existingHost));
|
.setParent(Key.create(existingHost));
|
||||||
ofy().save().<Object>entities(newHost, historyBuilder.build());
|
tm().insert(historyBuilder.build().toChildHistoryEntity());
|
||||||
|
tm().update(newHost);
|
||||||
return responseBuilder.setResultFromCode(SUCCESS_WITH_ACTION_PENDING).build();
|
return responseBuilder.setResultFromCode(SUCCESS_WITH_ACTION_PENDING).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ import static google.registry.model.EppResourceUtils.isLinked;
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.googlecode.objectify.Key;
|
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.ExtensionManager;
|
import google.registry.flows.ExtensionManager;
|
||||||
import google.registry.flows.Flow;
|
import google.registry.flows.Flow;
|
||||||
|
@ -68,7 +67,7 @@ public final class HostInfoFlow implements Flow {
|
||||||
HostResource host = loadAndVerifyExistence(HostResource.class, targetId, now);
|
HostResource host = loadAndVerifyExistence(HostResource.class, targetId, now);
|
||||||
ImmutableSet.Builder<StatusValue> statusValues = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<StatusValue> statusValues = new ImmutableSet.Builder<>();
|
||||||
statusValues.addAll(host.getStatusValues());
|
statusValues.addAll(host.getStatusValues());
|
||||||
if (isLinked(Key.create(host), now)) {
|
if (isLinked(host.createVKey(), now)) {
|
||||||
statusValues.add(StatusValue.LINKED);
|
statusValues.add(StatusValue.LINKED);
|
||||||
}
|
}
|
||||||
HostInfoData.Builder hostInfoDataBuilder = HostInfoData.newBuilder();
|
HostInfoData.Builder hostInfoDataBuilder = HostInfoData.newBuilder();
|
||||||
|
|
|
@ -17,6 +17,7 @@ package google.registry.model;
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
|
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
import static google.registry.persistence.transaction.TransactionManagerUtil.transactIfJpaTm;
|
import static google.registry.persistence.transaction.TransactionManagerUtil.transactIfJpaTm;
|
||||||
import static google.registry.util.DateTimeUtils.isAtOrAfter;
|
import static google.registry.util.DateTimeUtils.isAtOrAfter;
|
||||||
|
@ -28,7 +29,6 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.flogger.FluentLogger;
|
import com.google.common.flogger.FluentLogger;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import com.googlecode.objectify.Result;
|
import com.googlecode.objectify.Result;
|
||||||
import com.googlecode.objectify.cmd.Query;
|
|
||||||
import com.googlecode.objectify.util.ResultNow;
|
import com.googlecode.objectify.util.ResultNow;
|
||||||
import google.registry.config.RegistryConfig;
|
import google.registry.config.RegistryConfig;
|
||||||
import google.registry.model.EppResource.BuilderWithTransferData;
|
import google.registry.model.EppResource.BuilderWithTransferData;
|
||||||
|
@ -37,6 +37,7 @@ import google.registry.model.EppResource.ResourceWithTransferData;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.index.ForeignKeyIndex;
|
import google.registry.model.index.ForeignKeyIndex;
|
||||||
import google.registry.model.ofy.CommitLogManifest;
|
import google.registry.model.ofy.CommitLogManifest;
|
||||||
import google.registry.model.ofy.CommitLogMutation;
|
import google.registry.model.ofy.CommitLogMutation;
|
||||||
|
@ -44,11 +45,13 @@ import google.registry.model.registry.Registry;
|
||||||
import google.registry.model.transfer.DomainTransferData;
|
import google.registry.model.transfer.DomainTransferData;
|
||||||
import google.registry.model.transfer.TransferData;
|
import google.registry.model.transfer.TransferData;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
|
import google.registry.persistence.VKey;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.persistence.Query;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.Interval;
|
import org.joda.time.Interval;
|
||||||
|
|
||||||
|
@ -57,6 +60,22 @@ public final class EppResourceUtils {
|
||||||
|
|
||||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||||
|
|
||||||
|
private static final String CONTACT_LINKED_DOMAIN_QUERY =
|
||||||
|
"SELECT repoId FROM Domain "
|
||||||
|
+ "WHERE (adminContact = :fkRepoId "
|
||||||
|
+ "OR billingContact = :fkRepoId "
|
||||||
|
+ "OR techContact = :fkRepoId "
|
||||||
|
+ "OR registrantContact = :fkRepoId) "
|
||||||
|
+ "AND deletionTime > :now";
|
||||||
|
|
||||||
|
// We have to use the native SQL query here because DomainHost table doesn't have its entity
|
||||||
|
// class so we cannot reference its property like domainHost.hostRepoId in a JPQL query.
|
||||||
|
private static final String HOST_LINKED_DOMAIN_QUERY =
|
||||||
|
"SELECT d.repo_id FROM \"Domain\" d "
|
||||||
|
+ "JOIN \"DomainHost\" dh ON dh.domain_repo_id = d.repo_id "
|
||||||
|
+ "WHERE d.deletion_time > :now "
|
||||||
|
+ "AND dh.host_repo_id = :fkRepoId";
|
||||||
|
|
||||||
/** Returns the full domain repoId in the format HEX-TLD for the specified long id and tld. */
|
/** Returns the full domain repoId in the format HEX-TLD for the specified long id and tld. */
|
||||||
public static String createDomainRepoId(long repoId, String tld) {
|
public static String createDomainRepoId(long repoId, String tld) {
|
||||||
return createRepoId(repoId, Registry.get(tld).getRoidSuffix());
|
return createRepoId(repoId, Registry.get(tld).getRoidSuffix());
|
||||||
|
@ -365,21 +384,63 @@ public final class EppResourceUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a query for domains or applications that reference a specified contact or host.
|
* Returns a set of {@link VKey} for domains that reference a specified contact or host.
|
||||||
*
|
*
|
||||||
* <p>This is an eventually consistent query.
|
* <p>This is an eventually consistent query if used for Datastore.
|
||||||
*
|
*
|
||||||
* @param key the referent key
|
* @param key the referent key
|
||||||
* @param now the logical time of the check
|
* @param now the logical time of the check
|
||||||
|
* @param limit the maximum number of returned keys
|
||||||
*/
|
*/
|
||||||
public static Query<DomainBase> queryForLinkedDomains(
|
public static ImmutableSet<VKey<DomainBase>> getLinkedDomainKeys(
|
||||||
Key<? extends EppResource> key, DateTime now) {
|
VKey<? extends EppResource> key, DateTime now, int limit) {
|
||||||
boolean isContactKey = key.getKind().equals(Key.getKind(ContactResource.class));
|
checkArgument(
|
||||||
return ofy()
|
key.getKind().equals(ContactResource.class) || key.getKind().equals(HostResource.class),
|
||||||
.load()
|
"key must be either VKey<ContactResource> or VKey<HostResource>, but it is %s",
|
||||||
.type(DomainBase.class)
|
key);
|
||||||
.filter(isContactKey ? "allContacts.contact" : "nsHosts", key)
|
boolean isContactKey = key.getKind().equals(ContactResource.class);
|
||||||
.filter("deletionTime >", now);
|
if (tm().isOfy()) {
|
||||||
|
return ofy()
|
||||||
|
.load()
|
||||||
|
.type(DomainBase.class)
|
||||||
|
.filter(isContactKey ? "allContacts.contact" : "nsHosts", key.getOfyKey())
|
||||||
|
.filter("deletionTime >", now)
|
||||||
|
.limit(limit)
|
||||||
|
.keys()
|
||||||
|
.list()
|
||||||
|
.stream()
|
||||||
|
.map(DomainBase::createVKey)
|
||||||
|
.collect(toImmutableSet());
|
||||||
|
} else {
|
||||||
|
return tm().transact(
|
||||||
|
() -> {
|
||||||
|
Query query;
|
||||||
|
if (isContactKey) {
|
||||||
|
query =
|
||||||
|
jpaTm()
|
||||||
|
.getEntityManager()
|
||||||
|
.createQuery(CONTACT_LINKED_DOMAIN_QUERY, String.class)
|
||||||
|
.setParameter("fkRepoId", key)
|
||||||
|
.setParameter("now", now);
|
||||||
|
} else {
|
||||||
|
query =
|
||||||
|
jpaTm()
|
||||||
|
.getEntityManager()
|
||||||
|
.createNativeQuery(HOST_LINKED_DOMAIN_QUERY)
|
||||||
|
.setParameter("fkRepoId", key.getSqlKey())
|
||||||
|
.setParameter("now", now.toDate());
|
||||||
|
}
|
||||||
|
return (ImmutableSet<VKey<DomainBase>>)
|
||||||
|
query
|
||||||
|
.setMaxResults(limit)
|
||||||
|
.getResultStream()
|
||||||
|
.map(
|
||||||
|
repoId ->
|
||||||
|
DomainBase.createVKey(
|
||||||
|
Key.create(DomainBase.class, (String) repoId)))
|
||||||
|
.collect(toImmutableSet());
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -390,8 +451,8 @@ public final class EppResourceUtils {
|
||||||
* @param key the referent key
|
* @param key the referent key
|
||||||
* @param now the logical time of the check
|
* @param now the logical time of the check
|
||||||
*/
|
*/
|
||||||
public static boolean isLinked(Key<? extends EppResource> key, DateTime now) {
|
public static boolean isLinked(VKey<? extends EppResource> key, DateTime now) {
|
||||||
return queryForLinkedDomains(key, now).limit(1).count() > 0;
|
return getLinkedDomainKeys(key, now, 1).size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private EppResourceUtils() {}
|
private EppResourceUtils() {}
|
||||||
|
|
|
@ -425,7 +425,7 @@ public class RdapJsonFormatter {
|
||||||
if (outputDataType == OutputDataType.FULL) {
|
if (outputDataType == OutputDataType.FULL) {
|
||||||
ImmutableSet.Builder<StatusValue> statuses = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<StatusValue> statuses = new ImmutableSet.Builder<>();
|
||||||
statuses.addAll(hostResource.getStatusValues());
|
statuses.addAll(hostResource.getStatusValues());
|
||||||
if (isLinked(Key.create(hostResource), getRequestTime())) {
|
if (isLinked(hostResource.createVKey(), getRequestTime())) {
|
||||||
statuses.add(StatusValue.LINKED);
|
statuses.add(StatusValue.LINKED);
|
||||||
}
|
}
|
||||||
if (hostResource.isSubordinate()
|
if (hostResource.isSubordinate()
|
||||||
|
@ -562,7 +562,7 @@ public class RdapJsonFormatter {
|
||||||
.statusBuilder()
|
.statusBuilder()
|
||||||
.addAll(
|
.addAll(
|
||||||
makeStatusValueList(
|
makeStatusValueList(
|
||||||
isLinked(Key.create(contactResource), getRequestTime())
|
isLinked(contactResource.createVKey(), getRequestTime())
|
||||||
? union(contactResource.getStatusValues(), StatusValue.LINKED)
|
? union(contactResource.getStatusValues(), StatusValue.LINKED)
|
||||||
: contactResource.getStatusValues(),
|
: contactResource.getStatusValues(),
|
||||||
false,
|
false,
|
||||||
|
|
|
@ -37,10 +37,12 @@ import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
|
import google.registry.testing.DualDatabaseTest;
|
||||||
|
import google.registry.testing.TestOfyAndSql;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
/** Unit tests for {@link ContactDeleteFlow}. */
|
/** Unit tests for {@link ContactDeleteFlow}. */
|
||||||
|
@DualDatabaseTest
|
||||||
class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, ContactResource> {
|
class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, ContactResource> {
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
|
@ -48,13 +50,13 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, Cont
|
||||||
setEppInput("contact_delete.xml");
|
setEppInput("contact_delete.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testDryRun() throws Exception {
|
void testDryRun() throws Exception {
|
||||||
persistActiveContact(getUniqueIdFromCommand());
|
persistActiveContact(getUniqueIdFromCommand());
|
||||||
dryRunFlowAssertResponse(loadFile("contact_delete_response.xml"));
|
dryRunFlowAssertResponse(loadFile("contact_delete_response.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess() throws Exception {
|
void testSuccess() throws Exception {
|
||||||
persistActiveContact(getUniqueIdFromCommand());
|
persistActiveContact(getUniqueIdFromCommand());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
@ -71,7 +73,7 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, Cont
|
||||||
assertNoBillingEvents();
|
assertNoBillingEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess_clTridNotSpecified() throws Exception {
|
void testSuccess_clTridNotSpecified() throws Exception {
|
||||||
setEppInput("contact_delete_no_cltrid.xml");
|
setEppInput("contact_delete_no_cltrid.xml");
|
||||||
persistActiveContact(getUniqueIdFromCommand());
|
persistActiveContact(getUniqueIdFromCommand());
|
||||||
|
@ -89,7 +91,7 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, Cont
|
||||||
assertNoBillingEvents();
|
assertNoBillingEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_neverExisted() throws Exception {
|
void testFailure_neverExisted() throws Exception {
|
||||||
ResourceDoesNotExistException thrown =
|
ResourceDoesNotExistException thrown =
|
||||||
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
|
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
|
||||||
|
@ -97,7 +99,7 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, Cont
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_existedButWasDeleted() throws Exception {
|
void testFailure_existedButWasDeleted() throws Exception {
|
||||||
persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
|
persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
|
||||||
ResourceDoesNotExistException thrown =
|
ResourceDoesNotExistException thrown =
|
||||||
|
@ -106,19 +108,19 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, Cont
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_existedButWasClientDeleteProhibited() throws Exception {
|
void testFailure_existedButWasClientDeleteProhibited() throws Exception {
|
||||||
doFailingStatusTest(
|
doFailingStatusTest(
|
||||||
StatusValue.CLIENT_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class);
|
StatusValue.CLIENT_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_existedButWasServerDeleteProhibited() throws Exception {
|
void testFailure_existedButWasServerDeleteProhibited() throws Exception {
|
||||||
doFailingStatusTest(
|
doFailingStatusTest(
|
||||||
StatusValue.SERVER_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class);
|
StatusValue.SERVER_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_existedButWasPendingDelete() throws Exception {
|
void testFailure_existedButWasPendingDelete() throws Exception {
|
||||||
doFailingStatusTest(
|
doFailingStatusTest(
|
||||||
StatusValue.PENDING_DELETE, ResourceStatusProhibitsOperationException.class);
|
StatusValue.PENDING_DELETE, ResourceStatusProhibitsOperationException.class);
|
||||||
|
@ -135,7 +137,7 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, Cont
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_unauthorizedClient() throws Exception {
|
void testFailure_unauthorizedClient() throws Exception {
|
||||||
sessionMetadata.setClientId("NewRegistrar");
|
sessionMetadata.setClientId("NewRegistrar");
|
||||||
persistActiveContact(getUniqueIdFromCommand());
|
persistActiveContact(getUniqueIdFromCommand());
|
||||||
|
@ -143,7 +145,7 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, Cont
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess_superuserUnauthorizedClient() throws Exception {
|
void testSuccess_superuserUnauthorizedClient() throws Exception {
|
||||||
sessionMetadata.setClientId("NewRegistrar");
|
sessionMetadata.setClientId("NewRegistrar");
|
||||||
persistActiveContact(getUniqueIdFromCommand());
|
persistActiveContact(getUniqueIdFromCommand());
|
||||||
|
@ -161,7 +163,7 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, Cont
|
||||||
assertNoBillingEvents();
|
assertNoBillingEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_failfastWhenLinkedToDomain() throws Exception {
|
void testFailure_failfastWhenLinkedToDomain() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -170,7 +172,7 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, Cont
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_failfastWhenLinkedToApplication() throws Exception {
|
void testFailure_failfastWhenLinkedToApplication() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -179,7 +181,7 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, Cont
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testIcannActivityReportField_getsLogged() throws Exception {
|
void testIcannActivityReportField_getsLogged() throws Exception {
|
||||||
persistActiveContact(getUniqueIdFromCommand());
|
persistActiveContact(getUniqueIdFromCommand());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
|
|
@ -38,10 +38,12 @@ import google.registry.model.contact.PostalInfo.Type;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.PresenceMarker;
|
import google.registry.model.eppcommon.PresenceMarker;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
|
import google.registry.testing.DualDatabaseTest;
|
||||||
|
import google.registry.testing.TestOfyAndSql;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
/** Unit tests for {@link ContactInfoFlow}. */
|
/** Unit tests for {@link ContactInfoFlow}. */
|
||||||
|
@DualDatabaseTest
|
||||||
class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, ContactResource> {
|
class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, ContactResource> {
|
||||||
|
|
||||||
ContactInfoFlowTest() {
|
ContactInfoFlowTest() {
|
||||||
|
@ -94,7 +96,7 @@ class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, ContactR
|
||||||
return contact;
|
return contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess() throws Exception {
|
void testSuccess() throws Exception {
|
||||||
persistContactResource(true);
|
persistContactResource(true);
|
||||||
// Check that the persisted contact info was returned.
|
// Check that the persisted contact info was returned.
|
||||||
|
@ -107,7 +109,7 @@ class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, ContactR
|
||||||
assertNoBillingEvents();
|
assertNoBillingEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess_linked() throws Exception {
|
void testSuccess_linked() throws Exception {
|
||||||
createTld("foobar");
|
createTld("foobar");
|
||||||
persistResource(newDomainBase("example.foobar", persistContactResource(true)));
|
persistResource(newDomainBase("example.foobar", persistContactResource(true)));
|
||||||
|
@ -121,7 +123,7 @@ class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, ContactR
|
||||||
assertNoBillingEvents();
|
assertNoBillingEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess_owningRegistrarWithoutAuthInfo_seesAuthInfo() throws Exception {
|
void testSuccess_owningRegistrarWithoutAuthInfo_seesAuthInfo() throws Exception {
|
||||||
setEppInput("contact_info_no_authinfo.xml");
|
setEppInput("contact_info_no_authinfo.xml");
|
||||||
persistContactResource(true);
|
persistContactResource(true);
|
||||||
|
@ -135,7 +137,7 @@ class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, ContactR
|
||||||
assertNoBillingEvents();
|
assertNoBillingEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_otherRegistrar_notAuthorized() throws Exception {
|
void testFailure_otherRegistrar_notAuthorized() throws Exception {
|
||||||
setClientIdForFlow("NewRegistrar");
|
setClientIdForFlow("NewRegistrar");
|
||||||
persistContactResource(true);
|
persistContactResource(true);
|
||||||
|
@ -145,7 +147,7 @@ class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, ContactR
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess_otherRegistrarWithoutAuthInfoAsSuperuser_doesNotSeeAuthInfo() throws Exception {
|
void testSuccess_otherRegistrarWithoutAuthInfoAsSuperuser_doesNotSeeAuthInfo() throws Exception {
|
||||||
setClientIdForFlow("NewRegistrar");
|
setClientIdForFlow("NewRegistrar");
|
||||||
setEppInput("contact_info_no_authinfo.xml");
|
setEppInput("contact_info_no_authinfo.xml");
|
||||||
|
@ -162,7 +164,7 @@ class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, ContactR
|
||||||
assertNoBillingEvents();
|
assertNoBillingEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess_otherRegistrarWithAuthInfoAsSuperuser_seesAuthInfo() throws Exception {
|
void testSuccess_otherRegistrarWithAuthInfoAsSuperuser_seesAuthInfo() throws Exception {
|
||||||
setClientIdForFlow("NewRegistrar");
|
setClientIdForFlow("NewRegistrar");
|
||||||
persistContactResource(true);
|
persistContactResource(true);
|
||||||
|
@ -178,7 +180,7 @@ class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, ContactR
|
||||||
assertNoBillingEvents();
|
assertNoBillingEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_neverExisted() throws Exception {
|
void testFailure_neverExisted() throws Exception {
|
||||||
ResourceDoesNotExistException thrown =
|
ResourceDoesNotExistException thrown =
|
||||||
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
|
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
|
||||||
|
@ -186,7 +188,7 @@ class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, ContactR
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_existedButWasDeleted() throws Exception {
|
void testFailure_existedButWasDeleted() throws Exception {
|
||||||
persistContactResource(false);
|
persistContactResource(false);
|
||||||
ResourceDoesNotExistException thrown =
|
ResourceDoesNotExistException thrown =
|
||||||
|
@ -195,7 +197,7 @@ class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, ContactR
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testIcannActivityReportField_getsLogged() throws Exception {
|
void testIcannActivityReportField_getsLogged() throws Exception {
|
||||||
persistContactResource(true);
|
persistContactResource(true);
|
||||||
runFlow();
|
runFlow();
|
||||||
|
|
|
@ -46,11 +46,13 @@ import google.registry.model.registry.Registry;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.transfer.DomainTransferData;
|
import google.registry.model.transfer.DomainTransferData;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
|
import google.registry.testing.DualDatabaseTest;
|
||||||
|
import google.registry.testing.TestOfyAndSql;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
/** Unit tests for {@link HostDeleteFlow}. */
|
/** Unit tests for {@link HostDeleteFlow}. */
|
||||||
|
@DualDatabaseTest
|
||||||
class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResource> {
|
class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResource> {
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
|
@ -58,13 +60,13 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld"));
|
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testDryRun() throws Exception {
|
void testDryRun() throws Exception {
|
||||||
persistActiveHost("ns1.example.tld");
|
persistActiveHost("ns1.example.tld");
|
||||||
dryRunFlowAssertResponse(loadFile("host_delete_response.xml"));
|
dryRunFlowAssertResponse(loadFile("host_delete_response.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess() throws Exception {
|
void testSuccess() throws Exception {
|
||||||
persistActiveHost("ns1.example.tld");
|
persistActiveHost("ns1.example.tld");
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
@ -82,7 +84,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
assertNoDnsTasksEnqueued();
|
assertNoDnsTasksEnqueued();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess_clTridNotSpecified() throws Exception {
|
void testSuccess_clTridNotSpecified() throws Exception {
|
||||||
setEppInput("host_delete_no_cltrid.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld"));
|
setEppInput("host_delete_no_cltrid.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld"));
|
||||||
persistActiveHost("ns1.example.tld");
|
persistActiveHost("ns1.example.tld");
|
||||||
|
@ -101,14 +103,14 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
assertNoDnsTasksEnqueued();
|
assertNoDnsTasksEnqueued();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_neverExisted() {
|
void testFailure_neverExisted() {
|
||||||
ResourceDoesNotExistException thrown =
|
ResourceDoesNotExistException thrown =
|
||||||
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
|
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
|
||||||
assertThat(thrown).hasMessageThat().contains("(ns1.example.tld)");
|
assertThat(thrown).hasMessageThat().contains("(ns1.example.tld)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_existedButWasDeleted() {
|
void testFailure_existedButWasDeleted() {
|
||||||
persistDeletedHost("ns1.example.tld", clock.nowUtc().minusDays(1));
|
persistDeletedHost("ns1.example.tld", clock.nowUtc().minusDays(1));
|
||||||
ResourceDoesNotExistException thrown =
|
ResourceDoesNotExistException thrown =
|
||||||
|
@ -126,25 +128,25 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
assertThat(e).hasMessageThat().contains(statusValue.getXmlName());
|
assertThat(e).hasMessageThat().contains(statusValue.getXmlName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_existedButWasClientDeleteProhibited() {
|
void testFailure_existedButWasClientDeleteProhibited() {
|
||||||
doFailingStatusTest(
|
doFailingStatusTest(
|
||||||
StatusValue.CLIENT_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class);
|
StatusValue.CLIENT_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_existedButWasServerDeleteProhibited() {
|
void testFailure_existedButWasServerDeleteProhibited() {
|
||||||
doFailingStatusTest(
|
doFailingStatusTest(
|
||||||
StatusValue.SERVER_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class);
|
StatusValue.SERVER_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_existedButWasPendingDelete() {
|
void testFailure_existedButWasPendingDelete() {
|
||||||
doFailingStatusTest(
|
doFailingStatusTest(
|
||||||
StatusValue.PENDING_DELETE, ResourceStatusProhibitsOperationException.class);
|
StatusValue.PENDING_DELETE, ResourceStatusProhibitsOperationException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_unauthorizedClient() {
|
void testFailure_unauthorizedClient() {
|
||||||
sessionMetadata.setClientId("NewRegistrar");
|
sessionMetadata.setClientId("NewRegistrar");
|
||||||
persistActiveHost("ns1.example.tld");
|
persistActiveHost("ns1.example.tld");
|
||||||
|
@ -152,7 +154,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess_superuserUnauthorizedClient() throws Exception {
|
void testSuccess_superuserUnauthorizedClient() throws Exception {
|
||||||
sessionMetadata.setClientId("NewRegistrar");
|
sessionMetadata.setClientId("NewRegistrar");
|
||||||
persistActiveHost("ns1.example.tld");
|
persistActiveHost("ns1.example.tld");
|
||||||
|
@ -171,7 +173,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
assertNoDnsTasksEnqueued();
|
assertNoDnsTasksEnqueued();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess_authorizedClientReadFromSuperordinate() throws Exception {
|
void testSuccess_authorizedClientReadFromSuperordinate() throws Exception {
|
||||||
sessionMetadata.setClientId("TheRegistrar");
|
sessionMetadata.setClientId("TheRegistrar");
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
|
@ -191,7 +193,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
runFlowAssertResponse(loadFile("host_delete_response.xml"));
|
runFlowAssertResponse(loadFile("host_delete_response.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_unauthorizedClientReadFromSuperordinate() {
|
void testFailure_unauthorizedClientReadFromSuperordinate() {
|
||||||
sessionMetadata.setClientId("TheRegistrar");
|
sessionMetadata.setClientId("TheRegistrar");
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
|
@ -211,7 +213,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testSuccess_authorizedClientReadFromTransferredSuperordinate() throws Exception {
|
void testSuccess_authorizedClientReadFromTransferredSuperordinate() throws Exception {
|
||||||
sessionMetadata.setClientId("NewRegistrar");
|
sessionMetadata.setClientId("NewRegistrar");
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
|
@ -244,7 +246,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
runFlowAssertResponse(loadFile("host_delete_response.xml"));
|
runFlowAssertResponse(loadFile("host_delete_response.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_unauthorizedClientReadFromTransferredSuperordinate() {
|
void testFailure_unauthorizedClientReadFromTransferredSuperordinate() {
|
||||||
sessionMetadata.setClientId("NewRegistrar");
|
sessionMetadata.setClientId("NewRegistrar");
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
|
@ -277,7 +279,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_failfastWhenLinkedToDomain() {
|
void testFailure_failfastWhenLinkedToDomain() {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -289,14 +291,14 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_nonLowerCaseHostname() {
|
void testFailure_nonLowerCaseHostname() {
|
||||||
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "NS1.EXAMPLE.NET"));
|
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "NS1.EXAMPLE.NET"));
|
||||||
EppException thrown = assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
|
EppException thrown = assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_nonPunyCodedHostname() {
|
void testFailure_nonPunyCodedHostname() {
|
||||||
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.çauçalito.tld"));
|
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.çauçalito.tld"));
|
||||||
HostNameNotPunyCodedException thrown =
|
HostNameNotPunyCodedException thrown =
|
||||||
|
@ -304,14 +306,14 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld");
|
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testFailure_nonCanonicalHostname() {
|
void testFailure_nonCanonicalHostname() {
|
||||||
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld."));
|
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld."));
|
||||||
EppException thrown = assertThrows(HostNameNotNormalizedException.class, this::runFlow);
|
EppException thrown = assertThrows(HostNameNotNormalizedException.class, this::runFlow);
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestOfyAndSql
|
||||||
void testIcannActivityReportField_getsLogged() throws Exception {
|
void testIcannActivityReportField_getsLogged() throws Exception {
|
||||||
persistActiveHost("ns1.example.tld");
|
persistActiveHost("ns1.example.tld");
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue