mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Re-add EppException marshalling assertions in host flow tests
Apologies for the reformatting, but this refactoring is quite rote and it's definitely a bigger use of total time to perform the reformatting individually than to simply do it file-wide. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179238745
This commit is contained in:
parent
e17109a0eb
commit
34699465d5
5 changed files with 514 additions and 390 deletions
|
@ -17,8 +17,10 @@ package google.registry.flows.host;
|
|||
import static google.registry.model.eppoutput.CheckData.HostCheck.create;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedHost;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceCheckFlowTestCase;
|
||||
import google.registry.flows.exceptions.TooManyResourceChecksException;
|
||||
import google.registry.model.host.HostResource;
|
||||
|
@ -76,7 +78,8 @@ public class HostCheckFlowTest extends ResourceCheckFlowTestCase<HostCheckFlow,
|
|||
@Test
|
||||
public void testTooManyIds() throws Exception {
|
||||
setEppInput("host_check_51.xml");
|
||||
assertThrows(TooManyResourceChecksException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -24,8 +24,8 @@ import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
|||
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
||||
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
|
||||
|
@ -34,6 +34,7 @@ import com.google.common.base.Strings;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.EppXmlTransformer.IpAddressVersionMismatchException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.exceptions.ResourceAlreadyExistsException;
|
||||
|
@ -60,9 +61,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
private void setEppHostCreateInput(String hostName, String hostAddrs) {
|
||||
setEppInput(
|
||||
"host_create.xml",
|
||||
ImmutableMap.of(
|
||||
"HOSTNAME", hostName,
|
||||
"HOSTADDRS", (hostAddrs == null) ? "" : hostAddrs));
|
||||
ImmutableMap.of("HOSTNAME", hostName, "HOSTADDRS", (hostAddrs == null) ? "" : hostAddrs));
|
||||
}
|
||||
|
||||
private void setEppHostCreateInputWithIps(String hostName) {
|
||||
|
@ -83,8 +82,10 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
assertTransactionalFlow(true);
|
||||
runFlowAssertResponse(loadFile("host_create_response.xml"));
|
||||
// Check that the host was created and persisted with a history entry.
|
||||
assertAboutHosts().that(reloadResourceByForeignKey())
|
||||
.hasLastSuperordinateChange(null).and()
|
||||
assertAboutHosts()
|
||||
.that(reloadResourceByForeignKey())
|
||||
.hasLastSuperordinateChange(null)
|
||||
.and()
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.HOST_CREATE);
|
||||
assertNoBillingEvents();
|
||||
|
@ -126,7 +127,8 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
createTlds("bar.tld", "tld");
|
||||
|
||||
setEppHostCreateInputWithIps("ns1.bar.tld");
|
||||
assertThrows(HostNameTooShallowException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(HostNameTooShallowException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -154,7 +156,8 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
setEppHostCreateInput("ns1.example.tld", null);
|
||||
createTld("tld");
|
||||
persistActiveDomain("example.tld");
|
||||
assertThrows(SubordinateHostMustHaveIpException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(SubordinateHostMustHaveIpException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -162,7 +165,8 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
setEppHostCreateInputWithIps("ns1.example.external");
|
||||
createTld("tld");
|
||||
persistActiveDomain("example.tld");
|
||||
assertThrows(UnexpectedExternalHostIpException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnexpectedExternalHostIpException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -178,7 +182,8 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
public void testFailure_superordinateInPendingDelete() throws Exception {
|
||||
setEppHostCreateInputWithIps("ns1.example.tld");
|
||||
createTld("tld");
|
||||
persistResource(newDomainResource("example.tld")
|
||||
persistResource(
|
||||
newDomainResource("example.tld")
|
||||
.asBuilder()
|
||||
.setDeletionTime(clock.nowUtc().plusDays(35))
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
|
@ -206,7 +211,8 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
@Test
|
||||
public void testFailure_nonLowerCaseHostname() throws Exception {
|
||||
setEppHostCreateInput("ns1.EXAMPLE.tld", null);
|
||||
assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -220,13 +226,15 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
@Test
|
||||
public void testFailure_nonCanonicalHostname() throws Exception {
|
||||
setEppHostCreateInput("ns1.example.tld.", null);
|
||||
assertThrows(HostNameNotNormalizedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_longHostName() throws Exception {
|
||||
setEppHostCreateInputWithIps("a" + Strings.repeat(".labelpart", 25) + ".tld");
|
||||
assertThrows(HostNameTooLongException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(HostNameTooLongException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -236,13 +244,15 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
"<host:addr ip=\"v4\">192.0.2.2</host:addr>\n"
|
||||
+ "<host:addr ip=\"v6\">192.0.2.29</host:addr>\n"
|
||||
+ "<host:addr ip=\"v6\">1080:0:0:0:8:800:200C:417A</host:addr>");
|
||||
assertThrows(IpAddressVersionMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(IpAddressVersionMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
private void doFailingHostNameTest(String hostName, Class<? extends Throwable> exception)
|
||||
private void doFailingHostNameTest(String hostName, Class<? extends EppException> exception)
|
||||
throws Exception {
|
||||
setEppHostCreateInputWithIps(hostName);
|
||||
assertThrows(exception, this::runFlow);
|
||||
EppException thrown = expectThrows(exception, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -279,7 +289,8 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
public void testFailure_ccTldInBailiwick() throws Exception {
|
||||
createTld("co.uk");
|
||||
setEppHostCreateInputWithIps("foo.co.uk");
|
||||
assertThrows(HostNameTooShallowException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(HostNameTooShallowException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -23,14 +23,15 @@ import static google.registry.testing.DatastoreHelper.newHostResource;
|
|||
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
|
@ -75,7 +76,8 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
assertAboutHosts().that(deletedHost).hasStatusValue(StatusValue.PENDING_DELETE);
|
||||
assertAsyncDeletionTaskEnqueued(
|
||||
deletedHost, "TheRegistrar", Trid.create("ABC-12345", "server-trid"), false);
|
||||
assertAboutHosts().that(deletedHost)
|
||||
assertAboutHosts()
|
||||
.that(deletedHost)
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.HOST_PENDING_DELETE);
|
||||
assertNoBillingEvents();
|
||||
|
@ -130,7 +132,8 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
public void testFailure_unauthorizedClient() throws Exception {
|
||||
sessionMetadata.setClientId("NewRegistrar");
|
||||
persistActiveHost("ns1.example.tld");
|
||||
assertThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -144,7 +147,8 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
assertAboutHosts().that(deletedHost).hasStatusValue(StatusValue.PENDING_DELETE);
|
||||
assertAsyncDeletionTaskEnqueued(
|
||||
deletedHost, "NewRegistrar", Trid.create("ABC-12345", "server-trid"), true);
|
||||
assertAboutHosts().that(deletedHost)
|
||||
assertAboutHosts()
|
||||
.that(deletedHost)
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.HOST_PENDING_DELETE);
|
||||
assertNoBillingEvents();
|
||||
|
@ -155,12 +159,15 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
public void testSuccess_authorizedClientReadFromSuperordinate() throws Exception {
|
||||
sessionMetadata.setClientId("TheRegistrar");
|
||||
createTld("tld");
|
||||
DomainResource domain = persistResource(
|
||||
newDomainResource("example.tld").asBuilder()
|
||||
DomainResource domain =
|
||||
persistResource(
|
||||
newDomainResource("example.tld")
|
||||
.asBuilder()
|
||||
.setPersistedCurrentSponsorClientId("TheRegistrar")
|
||||
.build());
|
||||
persistResource(
|
||||
newHostResource("ns1.example.tld").asBuilder()
|
||||
newHostResource("ns1.example.tld")
|
||||
.asBuilder()
|
||||
.setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't hurt.
|
||||
.setSuperordinateDomain(Key.create(domain))
|
||||
.build());
|
||||
|
@ -172,16 +179,20 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
public void testFailure_unauthorizedClientReadFromSuperordinate() throws Exception {
|
||||
sessionMetadata.setClientId("TheRegistrar");
|
||||
createTld("tld");
|
||||
DomainResource domain = persistResource(
|
||||
newDomainResource("example.tld").asBuilder()
|
||||
DomainResource domain =
|
||||
persistResource(
|
||||
newDomainResource("example.tld")
|
||||
.asBuilder()
|
||||
.setPersistedCurrentSponsorClientId("NewRegistrar")
|
||||
.build());
|
||||
persistResource(
|
||||
newHostResource("ns1.example.tld").asBuilder()
|
||||
newHostResource("ns1.example.tld")
|
||||
.asBuilder()
|
||||
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't help.
|
||||
.setSuperordinateDomain(Key.create(domain))
|
||||
.build());
|
||||
assertThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -192,10 +203,14 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
DateTime now = clock.nowUtc();
|
||||
DateTime requestTime = now.minusDays(1).minus(Registry.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
DateTime transferExpirationTime = now.minusDays(1);
|
||||
DomainResource domain = persistResource(newDomainResource("example.tld").asBuilder()
|
||||
DomainResource domain =
|
||||
persistResource(
|
||||
newDomainResource("example.tld")
|
||||
.asBuilder()
|
||||
.setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't hurt.
|
||||
.addStatusValue(StatusValue.PENDING_TRANSFER)
|
||||
.setTransferData(new TransferData.Builder()
|
||||
.setTransferData(
|
||||
new TransferData.Builder()
|
||||
.setTransferStatus(TransferStatus.PENDING)
|
||||
.setGainingClientId("NewRegistrar")
|
||||
.setTransferRequestTime(requestTime)
|
||||
|
@ -204,7 +219,8 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
.build())
|
||||
.build());
|
||||
persistResource(
|
||||
newHostResource("ns1.example.tld").asBuilder()
|
||||
newHostResource("ns1.example.tld")
|
||||
.asBuilder()
|
||||
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't hurt.
|
||||
.setSuperordinateDomain(Key.create(domain))
|
||||
.build());
|
||||
|
@ -220,10 +236,14 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
DateTime now = clock.nowUtc();
|
||||
DateTime requestTime = now.minusDays(1).minus(Registry.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
DateTime transferExpirationTime = now.minusDays(1);
|
||||
DomainResource domain = persistResource(newDomainResource("example.tld").asBuilder()
|
||||
DomainResource domain =
|
||||
persistResource(
|
||||
newDomainResource("example.tld")
|
||||
.asBuilder()
|
||||
.setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't help.
|
||||
.addStatusValue(StatusValue.PENDING_TRANSFER)
|
||||
.setTransferData(new TransferData.Builder()
|
||||
.setTransferData(
|
||||
new TransferData.Builder()
|
||||
.setTransferStatus(TransferStatus.PENDING)
|
||||
.setGainingClientId("TheRegistrar")
|
||||
.setTransferRequestTime(requestTime)
|
||||
|
@ -232,37 +252,44 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
.build())
|
||||
.build());
|
||||
persistResource(
|
||||
newHostResource("ns1.example.tld").asBuilder()
|
||||
newHostResource("ns1.example.tld")
|
||||
.asBuilder()
|
||||
.setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't help.
|
||||
.setSuperordinateDomain(Key.create(domain))
|
||||
.build());
|
||||
assertThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_failfastWhenLinkedToDomain() throws Exception {
|
||||
createTld("tld");
|
||||
persistResource(newDomainResource("example.tld").asBuilder()
|
||||
.setNameservers(ImmutableSet.of(
|
||||
Key.create(persistActiveHost("ns1.example.tld"))))
|
||||
persistResource(
|
||||
newDomainResource("example.tld")
|
||||
.asBuilder()
|
||||
.setNameservers(ImmutableSet.of(Key.create(persistActiveHost("ns1.example.tld"))))
|
||||
.build());
|
||||
assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_failfastWhenLinkedToApplication() throws Exception {
|
||||
createTld("tld");
|
||||
persistResource(newDomainApplication("example.tld").asBuilder()
|
||||
.setNameservers(ImmutableSet.of(
|
||||
Key.create(persistActiveHost("ns1.example.tld"))))
|
||||
persistResource(
|
||||
newDomainApplication("example.tld")
|
||||
.asBuilder()
|
||||
.setNameservers(ImmutableSet.of(Key.create(persistActiveHost("ns1.example.tld"))))
|
||||
.build());
|
||||
assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nonLowerCaseHostname() throws Exception {
|
||||
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "NS1.EXAMPLE.NET"));
|
||||
assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -276,7 +303,8 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
@Test
|
||||
public void testFailure_nonCanonicalHostname() throws Exception {
|
||||
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld."));
|
||||
assertThrows(HostNameNotNormalizedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -19,13 +19,14 @@ import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.net.InetAddresses;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||
import google.registry.flows.host.HostFlowUtils.HostNameNotLowerCaseException;
|
||||
|
@ -57,9 +58,9 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
|
|||
.setFullyQualifiedHostName(getUniqueIdFromCommand())
|
||||
.setRepoId("1FF-FOOBAR")
|
||||
.setPersistedCurrentSponsorClientId("my sponsor")
|
||||
.setStatusValues(
|
||||
ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
||||
.setInetAddresses(ImmutableSet.of(
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
||||
.setInetAddresses(
|
||||
ImmutableSet.of(
|
||||
InetAddresses.forString("192.0.2.2"),
|
||||
InetAddresses.forString("1080:0:0:0:8:800:200C:417A"),
|
||||
InetAddresses.forString("192.0.2.29")))
|
||||
|
@ -89,7 +90,8 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
|
|||
public void testSuccess_linked() throws Exception {
|
||||
persistHostResource();
|
||||
persistResource(
|
||||
newDomainResource("example.foobar").asBuilder()
|
||||
newDomainResource("example.foobar")
|
||||
.asBuilder()
|
||||
.addNameservers(ImmutableSet.of(Key.create(persistHostResource())))
|
||||
.build());
|
||||
assertTransactionalFlow(false);
|
||||
|
@ -102,16 +104,19 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
|
|||
assertNoBillingEvents();
|
||||
}
|
||||
|
||||
private void runTest_superordinateDomain(DateTime domainTransferTime,
|
||||
@Nullable DateTime lastSuperordinateChange) throws Exception {
|
||||
DomainResource domain = persistResource(
|
||||
newDomainResource("parent.foobar").asBuilder()
|
||||
private void runTest_superordinateDomain(
|
||||
DateTime domainTransferTime, @Nullable DateTime lastSuperordinateChange) throws Exception {
|
||||
DomainResource domain =
|
||||
persistResource(
|
||||
newDomainResource("parent.foobar")
|
||||
.asBuilder()
|
||||
.setRepoId("BEEF-FOOBAR")
|
||||
.setLastTransferTime(domainTransferTime)
|
||||
.setPersistedCurrentSponsorClientId("superclientid")
|
||||
.build());
|
||||
persistResource(
|
||||
persistHostResource().asBuilder()
|
||||
persistHostResource()
|
||||
.asBuilder()
|
||||
.setRepoId("CEEF-FOOBAR")
|
||||
.setSuperordinateDomain(Key.create(domain))
|
||||
.setLastSuperordinateChange(lastSuperordinateChange)
|
||||
|
@ -126,17 +131,15 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_withSuperordinateDomain_hostMovedAfterDomainTransfer()
|
||||
throws Exception {
|
||||
runTest_superordinateDomain(DateTime.parse("2000-01-08T09:00:00.0Z"),
|
||||
DateTime.parse("2000-03-01T01:00:00.0Z"));
|
||||
public void testSuccess_withSuperordinateDomain_hostMovedAfterDomainTransfer() throws Exception {
|
||||
runTest_superordinateDomain(
|
||||
DateTime.parse("2000-01-08T09:00:00.0Z"), DateTime.parse("2000-03-01T01:00:00.0Z"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_withSuperordinateDomain_hostMovedBeforeDomainTransfer()
|
||||
throws Exception {
|
||||
runTest_superordinateDomain(DateTime.parse("2000-04-08T09:00:00.0Z"),
|
||||
DateTime.parse("2000-02-08T09:00:00.0Z"));
|
||||
public void testSuccess_withSuperordinateDomain_hostMovedBeforeDomainTransfer() throws Exception {
|
||||
runTest_superordinateDomain(
|
||||
DateTime.parse("2000-04-08T09:00:00.0Z"), DateTime.parse("2000-02-08T09:00:00.0Z"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -163,7 +166,8 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
|
|||
@Test
|
||||
public void testFailure_nonLowerCaseHostname() throws Exception {
|
||||
setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "NS1.EXAMPLE.NET"));
|
||||
assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -177,7 +181,8 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
|
|||
@Test
|
||||
public void testFailure_nonCanonicalHostname() throws Exception {
|
||||
setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld."));
|
||||
assertThrows(HostNameNotNormalizedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue