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. * Application status prohibits this domain update.
* 2306 * 2306
* Cannot add and remove the same value. * 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. * More than one contact for a given role is not allowed.
* Missing type attribute for contact. * Missing type attribute for contact.
* The secDNS:all element must have value 'true' if present. * 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.validateNoDuplicateContacts;
import static google.registry.flows.domain.DomainFlowUtils.validateRegistrantAllowedOnTld; import static google.registry.flows.domain.DomainFlowUtils.validateRegistrantAllowedOnTld;
import static google.registry.flows.domain.DomainFlowUtils.validateRequiredContactsPresent; 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.verifyClientUpdateNotProhibited;
import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPendingDelete; import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPendingDelete;
import static google.registry.flows.domain.DomainFlowUtils.verifyStatusChangesAreClientSettable; 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.ResourceHasClientUpdateProhibitedException}
* @error {@link google.registry.flows.exceptions.ResourceStatusProhibitsOperationException} * @error {@link google.registry.flows.exceptions.ResourceStatusProhibitsOperationException}
* @error {@link google.registry.flows.exceptions.StatusNotClientSettableException} * @error {@link google.registry.flows.exceptions.StatusNotClientSettableException}
* @error {@link DomainFlowUtils.ApplicationDomainNameMismatchException}
* @error {@link DomainFlowUtils.DuplicateContactForRoleException} * @error {@link DomainFlowUtils.DuplicateContactForRoleException}
* @error {@link DomainFlowUtils.EmptySecDnsUpdateException} * @error {@link DomainFlowUtils.EmptySecDnsUpdateException}
* @error {@link DomainFlowUtils.LinkedResourcesDoNotExistException} * @error {@link DomainFlowUtils.LinkedResourcesDoNotExistException}
@ -133,6 +135,7 @@ public class DomainApplicationUpdateFlow extends LoggedInFlow implements Transac
Update command = cloneAndLinkReferences((Update) resourceCommand, now); Update command = cloneAndLinkReferences((Update) resourceCommand, now);
DomainApplication existingApplication = verifyExistence( DomainApplication existingApplication = verifyExistence(
DomainApplication.class, applicationId, loadDomainApplication(applicationId, now)); DomainApplication.class, applicationId, loadDomainApplication(applicationId, now));
verifyApplicationDomainMatchesTargetId(existingApplication, targetId);
verifyNoDisallowedStatuses(existingApplication, UPDATE_DISALLOWED_STATUSES); verifyNoDisallowedStatuses(existingApplication, UPDATE_DISALLOWED_STATUSES);
verifyOptionalAuthInfoForResource(authInfo, existingApplication); verifyOptionalAuthInfoForResource(authInfo, existingApplication);
verifyUpdateAllowed(existingApplication, command); 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.ResourceDoesNotExistException;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.domain.DomainApplicationUpdateFlow.ApplicationStatusProhibitsUpdateException; 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.DuplicateContactForRoleException;
import google.registry.flows.domain.DomainFlowUtils.EmptySecDnsUpdateException; import google.registry.flows.domain.DomainFlowUtils.EmptySecDnsUpdateException;
import google.registry.flows.domain.DomainFlowUtils.LinkedResourcesDoNotExistException; import google.registry.flows.domain.DomainFlowUtils.LinkedResourcesDoNotExistException;
@ -399,6 +400,14 @@ public class DomainApplicationUpdateFlowTest
runFlow(); runFlow();
} }
@Test
public void testFailure_applicationDomainNameMismatch() throws Exception {
persistReferencedEntities();
persistResource(newApplicationBuilder().setFullyQualifiedDomainName("something.tld").build());
thrown.expect(ApplicationDomainNameMismatchException.class);
runFlow();
}
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
persistReferencedEntities(); persistReferencedEntities();

View file

@ -3,7 +3,7 @@
<update> <update>
<domain:update <domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> 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:add>
<domain:contact type="tech">sh8013</domain:contact> <domain:contact type="tech">sh8013</domain:contact>
<domain:status s="clientHold" <domain:status s="clientHold"

View file

@ -3,7 +3,7 @@
<update> <update>
<domain:update <domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> 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:chg>
<domain:authInfo> <domain:authInfo>
<domain:pw>2BARfoo</domain:pw> <domain:pw>2BARfoo</domain:pw>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@
<update> <update>
<domain:update <domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> 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:add>
<domain:contact type="tech">sh8013</domain:contact> <domain:contact type="tech">sh8013</domain:contact>
</domain:add> </domain:add>

View file

@ -3,7 +3,7 @@
<update> <update>
<domain:update <domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> 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:rem>
<domain:contact type="admin">sh8013</domain:contact> <domain:contact type="admin">sh8013</domain:contact>
</domain:rem> </domain:rem>

View file

@ -3,7 +3,7 @@
<update> <update>
<domain:update <domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> 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:add>
<domain:contact type="admin">mak21</domain:contact> <domain:contact type="admin">mak21</domain:contact>
<domain:contact type="billing">mak21</domain:contact> <domain:contact type="billing">mak21</domain:contact>