mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 08:27:14 +02:00
Split ResourceAlreadyExistsException based on if this client owns the resource
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=250728711
This commit is contained in:
parent
ef9478b68c
commit
d2f955a488
10 changed files with 143 additions and 28 deletions
|
@ -40,6 +40,7 @@ import static google.registry.testing.DatastoreHelper.deleteTld;
|
|||
import static google.registry.testing.DatastoreHelper.getHistoryEntries;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.newContactResource;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainBase;
|
||||
import static google.registry.testing.DatastoreHelper.newHostResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
|
@ -134,7 +135,8 @@ import google.registry.flows.domain.token.AllocationTokenFlowUtils.AllocationTok
|
|||
import google.registry.flows.domain.token.AllocationTokenFlowUtils.AlreadyRedeemedAllocationTokenException;
|
||||
import google.registry.flows.domain.token.AllocationTokenFlowUtils.InvalidAllocationTokenException;
|
||||
import google.registry.flows.exceptions.OnlyToolCanPassMetadataException;
|
||||
import google.registry.flows.exceptions.ResourceAlreadyExistsException;
|
||||
import google.registry.flows.exceptions.ResourceAlreadyExistsForThisClientException;
|
||||
import google.registry.flows.exceptions.ResourceCreateContentionException;
|
||||
import google.registry.model.billing.BillingEvent;
|
||||
import google.registry.model.billing.BillingEvent.Flag;
|
||||
import google.registry.model.billing.BillingEvent.Reason;
|
||||
|
@ -965,8 +967,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
public void testFailure_alreadyExists() throws Exception {
|
||||
persistContactsAndHosts();
|
||||
persistActiveDomain(getUniqueIdFromCommand());
|
||||
ResourceAlreadyExistsException thrown =
|
||||
assertThrows(ResourceAlreadyExistsException.class, this::runFlow);
|
||||
ResourceAlreadyExistsForThisClientException thrown =
|
||||
assertThrows(ResourceAlreadyExistsForThisClientException.class, this::runFlow);
|
||||
assertAboutEppExceptions()
|
||||
.that(thrown)
|
||||
.marshalsToXml()
|
||||
|
@ -975,6 +977,23 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
String.format("Object with given ID (%s) already exists", getUniqueIdFromCommand()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_resourceContention() throws Exception {
|
||||
persistContactsAndHosts();
|
||||
String targetId = getUniqueIdFromCommand();
|
||||
persistResource(
|
||||
newDomainBase(targetId)
|
||||
.asBuilder()
|
||||
.setPersistedCurrentSponsorClientId("NewRegistrar")
|
||||
.build());
|
||||
ResourceCreateContentionException thrown =
|
||||
assertThrows(ResourceCreateContentionException.class, this::runFlow);
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(String.format("Object with given ID (%s) already exists", targetId));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_reserved() {
|
||||
setEppInput("domain_create_reserved.xml");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue