Add a missing verification to DomainApplicationUpdateFlow.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135712711
This commit is contained in:
cgoldfeder 2016-10-10 13:25:12 -07:00 committed by Ben McIlwain
parent dfe0ba32cb
commit 049c636966
17 changed files with 27 additions and 14 deletions

View file

@ -752,6 +752,7 @@ application. Updates cannot change the domain name that is being applied for.
* Application status prohibits this domain update.
* 2306
* Cannot add and remove the same value.
* Application referenced does not match specified domain name.
* More than one contact for a given role is not allowed.
* Missing type attribute for contact.
* The secDNS:all element must have value 'true' if present.

View file

@ -30,6 +30,7 @@ import static google.registry.flows.domain.DomainFlowUtils.validateNameserversCo
import static google.registry.flows.domain.DomainFlowUtils.validateNoDuplicateContacts;
import static google.registry.flows.domain.DomainFlowUtils.validateRegistrantAllowedOnTld;
import static google.registry.flows.domain.DomainFlowUtils.validateRequiredContactsPresent;
import static google.registry.flows.domain.DomainFlowUtils.verifyApplicationDomainMatchesTargetId;
import static google.registry.flows.domain.DomainFlowUtils.verifyClientUpdateNotProhibited;
import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPendingDelete;
import static google.registry.flows.domain.DomainFlowUtils.verifyStatusChangesAreClientSettable;
@ -79,6 +80,7 @@ import javax.inject.Inject;
* @error {@link google.registry.flows.exceptions.ResourceHasClientUpdateProhibitedException}
* @error {@link google.registry.flows.exceptions.ResourceStatusProhibitsOperationException}
* @error {@link google.registry.flows.exceptions.StatusNotClientSettableException}
* @error {@link DomainFlowUtils.ApplicationDomainNameMismatchException}
* @error {@link DomainFlowUtils.DuplicateContactForRoleException}
* @error {@link DomainFlowUtils.EmptySecDnsUpdateException}
* @error {@link DomainFlowUtils.LinkedResourcesDoNotExistException}
@ -133,6 +135,7 @@ public class DomainApplicationUpdateFlow extends LoggedInFlow implements Transac
Update command = cloneAndLinkReferences((Update) resourceCommand, now);
DomainApplication existingApplication = verifyExistence(
DomainApplication.class, applicationId, loadDomainApplication(applicationId, now));
verifyApplicationDomainMatchesTargetId(existingApplication, targetId);
verifyNoDisallowedStatuses(existingApplication, UPDATE_DISALLOWED_STATUSES);
verifyOptionalAuthInfoForResource(authInfo, existingApplication);
verifyUpdateAllowed(existingApplication, command);

View file

@ -35,6 +35,7 @@ import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.domain.DomainApplicationUpdateFlow.ApplicationStatusProhibitsUpdateException;
import google.registry.flows.domain.DomainFlowUtils.ApplicationDomainNameMismatchException;
import google.registry.flows.domain.DomainFlowUtils.DuplicateContactForRoleException;
import google.registry.flows.domain.DomainFlowUtils.EmptySecDnsUpdateException;
import google.registry.flows.domain.DomainFlowUtils.LinkedResourcesDoNotExistException;
@ -399,6 +400,14 @@ public class DomainApplicationUpdateFlowTest
runFlow();
}
@Test
public void testFailure_applicationDomainNameMismatch() throws Exception {
persistReferencedEntities();
persistResource(newApplicationBuilder().setFullyQualifiedDomainName("something.tld").build());
thrown.expect(ApplicationDomainNameMismatchException.class);
runFlow();
}
@Test
public void testFailure_neverExisted() throws Exception {
persistReferencedEntities();

View file

@ -3,7 +3,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
<domain:add>
<domain:contact type="tech">sh8013</domain:contact>
<domain:status s="clientHold"

View file

@ -3,7 +3,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
<domain:chg>
<domain:authInfo>
<domain:pw>2BARfoo</domain:pw>

View file

@ -5,7 +5,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
</domain:update>
</update>
<extension>

View file

@ -5,7 +5,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
</domain:update>
</update>
<extension>

View file

@ -5,7 +5,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
</domain:update>
</update>
<extension>

View file

@ -5,7 +5,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
</domain:update>
</update>
<extension>

View file

@ -5,7 +5,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
</domain:update>
</update>
<extension>

View file

@ -5,7 +5,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
</domain:update>
</update>
<extension>

View file

@ -5,7 +5,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
</domain:update>
</update>
<extension>

View file

@ -5,7 +5,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
</domain:update>
</update>
<extension>

View file

@ -5,7 +5,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
</domain:update>
</update>
<extension>

View file

@ -3,7 +3,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
<domain:add>
<domain:contact type="tech">sh8013</domain:contact>
</domain:add>

View file

@ -3,7 +3,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
<domain:rem>
<domain:contact type="admin">sh8013</domain:contact>
</domain:rem>

View file

@ -3,7 +3,7 @@
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.tld</domain:name>
<domain:add>
<domain:contact type="admin">mak21</domain:contact>
<domain:contact type="billing">mak21</domain:contact>