mirror of
https://github.com/google/nomulus.git
synced 2025-05-24 21:20:08 +02:00
Save the RDAP request time globally instead of passing it around
Also removed the rdapWhoisServer value, as it's just null and will likely stay that way (it isn't mentioned in the RDAP response profile) If it'll ever become required, we can add it back. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=247643981
This commit is contained in:
parent
b10f880b7f
commit
a0040c5eda
15 changed files with 197 additions and 320 deletions
|
@ -86,14 +86,12 @@ public class RdapJsonFormatterTest {
|
|||
private ContactResource contactResourceTech;
|
||||
private ContactResource contactResourceNotLinked;
|
||||
|
||||
// Do not set a port43 whois server, as per Gustavo Lozano.
|
||||
private static final String WHOIS_SERVER = null;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
inject.setStaticField(Ofy.class, "clock", clock);
|
||||
|
||||
rdapJsonFormatter = RdapTestHelper.getTestRdapJsonFormatter();
|
||||
rdapJsonFormatter = RdapTestHelper.getTestRdapJsonFormatter(clock);
|
||||
rdapJsonFormatter.rdapAuthorization =
|
||||
RdapAuthorization.create(RdapAuthorization.Role.REGISTRAR, "unicoderegistrar");
|
||||
|
||||
|
@ -315,51 +313,35 @@ public class RdapJsonFormatterTest {
|
|||
|
||||
@Test
|
||||
public void testRegistrar() {
|
||||
assertThat(
|
||||
rdapJsonFormatter
|
||||
.makeRdapJsonForRegistrar(
|
||||
registrar, WHOIS_SERVER, clock.nowUtc(), OutputDataType.FULL)
|
||||
.toJson())
|
||||
assertThat(rdapJsonFormatter.makeRdapJsonForRegistrar(registrar, OutputDataType.FULL).toJson())
|
||||
.isEqualTo(loadJson("rdapjson_registrar.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistrar_summary() {
|
||||
assertThat(
|
||||
rdapJsonFormatter
|
||||
.makeRdapJsonForRegistrar(
|
||||
registrar, WHOIS_SERVER, clock.nowUtc(), OutputDataType.SUMMARY)
|
||||
.toJson())
|
||||
rdapJsonFormatter.makeRdapJsonForRegistrar(registrar, OutputDataType.SUMMARY).toJson())
|
||||
.isEqualTo(loadJson("rdapjson_registrar_summary.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHost_ipv4() {
|
||||
assertThat(
|
||||
rdapJsonFormatter
|
||||
.makeRdapJsonForHost(
|
||||
hostResourceIpv4, WHOIS_SERVER, clock.nowUtc(), OutputDataType.FULL)
|
||||
.toJson())
|
||||
rdapJsonFormatter.makeRdapJsonForHost(hostResourceIpv4, OutputDataType.FULL).toJson())
|
||||
.isEqualTo(loadJson("rdapjson_host_ipv4.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHost_ipv6() {
|
||||
assertThat(
|
||||
rdapJsonFormatter
|
||||
.makeRdapJsonForHost(
|
||||
hostResourceIpv6, WHOIS_SERVER, clock.nowUtc(), OutputDataType.FULL)
|
||||
.toJson())
|
||||
rdapJsonFormatter.makeRdapJsonForHost(hostResourceIpv6, OutputDataType.FULL).toJson())
|
||||
.isEqualTo(loadJson("rdapjson_host_ipv6.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHost_both() {
|
||||
assertThat(
|
||||
rdapJsonFormatter
|
||||
.makeRdapJsonForHost(
|
||||
hostResourceBoth, WHOIS_SERVER, clock.nowUtc(), OutputDataType.FULL)
|
||||
.toJson())
|
||||
rdapJsonFormatter.makeRdapJsonForHost(hostResourceBoth, OutputDataType.FULL).toJson())
|
||||
.isEqualTo(loadJson("rdapjson_host_both.json"));
|
||||
}
|
||||
|
||||
|
@ -367,8 +349,7 @@ public class RdapJsonFormatterTest {
|
|||
public void testHost_both_summary() {
|
||||
assertThat(
|
||||
rdapJsonFormatter
|
||||
.makeRdapJsonForHost(
|
||||
hostResourceBoth, WHOIS_SERVER, clock.nowUtc(), OutputDataType.SUMMARY)
|
||||
.makeRdapJsonForHost(hostResourceBoth, OutputDataType.SUMMARY)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_host_both_summary.json"));
|
||||
}
|
||||
|
@ -377,8 +358,7 @@ public class RdapJsonFormatterTest {
|
|||
public void testHost_noAddresses() {
|
||||
assertThat(
|
||||
rdapJsonFormatter
|
||||
.makeRdapJsonForHost(
|
||||
hostResourceNoAddresses, WHOIS_SERVER, clock.nowUtc(), OutputDataType.FULL)
|
||||
.makeRdapJsonForHost(hostResourceNoAddresses, OutputDataType.FULL)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_host_no_addresses.json"));
|
||||
}
|
||||
|
@ -387,8 +367,7 @@ public class RdapJsonFormatterTest {
|
|||
public void testHost_notLinked() {
|
||||
assertThat(
|
||||
rdapJsonFormatter
|
||||
.makeRdapJsonForHost(
|
||||
hostResourceNotLinked, WHOIS_SERVER, clock.nowUtc(), OutputDataType.FULL)
|
||||
.makeRdapJsonForHost(hostResourceNotLinked, OutputDataType.FULL)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_host_not_linked.json"));
|
||||
}
|
||||
|
@ -397,11 +376,7 @@ public class RdapJsonFormatterTest {
|
|||
public void testHost_superordinateHasPendingTransfer() {
|
||||
assertThat(
|
||||
rdapJsonFormatter
|
||||
.makeRdapJsonForHost(
|
||||
hostResourceSuperordinatePendingTransfer,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL)
|
||||
.makeRdapJsonForHost(hostResourceSuperordinatePendingTransfer, OutputDataType.FULL)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_host_pending_transfer.json"));
|
||||
}
|
||||
|
@ -413,8 +388,6 @@ public class RdapJsonFormatterTest {
|
|||
.makeRdapJsonForContact(
|
||||
contactResourceRegistrant,
|
||||
Optional.of(DesignatedContact.Type.REGISTRANT),
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_registrant.json"));
|
||||
|
@ -427,8 +400,6 @@ public class RdapJsonFormatterTest {
|
|||
.makeRdapJsonForContact(
|
||||
contactResourceRegistrant,
|
||||
Optional.of(DesignatedContact.Type.REGISTRANT),
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.SUMMARY)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_registrant_summary.json"));
|
||||
|
@ -442,8 +413,6 @@ public class RdapJsonFormatterTest {
|
|||
.makeRdapJsonForContact(
|
||||
contactResourceRegistrant,
|
||||
Optional.of(DesignatedContact.Type.REGISTRANT),
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_registrant_logged_out.json"));
|
||||
|
@ -463,8 +432,6 @@ public class RdapJsonFormatterTest {
|
|||
.makeRdapJsonForContact(
|
||||
contactResourceRegistrant,
|
||||
Optional.of(DesignatedContact.Type.REGISTRANT),
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_registrant.json"));
|
||||
|
@ -477,8 +444,6 @@ public class RdapJsonFormatterTest {
|
|||
.makeRdapJsonForContact(
|
||||
contactResourceAdmin,
|
||||
Optional.of(DesignatedContact.Type.ADMIN),
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_admincontact.json"));
|
||||
|
@ -491,8 +456,6 @@ public class RdapJsonFormatterTest {
|
|||
.makeRdapJsonForContact(
|
||||
contactResourceTech,
|
||||
Optional.of(DesignatedContact.Type.TECH),
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_techcontact.json"));
|
||||
|
@ -505,8 +468,6 @@ public class RdapJsonFormatterTest {
|
|||
.makeRdapJsonForContact(
|
||||
contactResourceTech,
|
||||
Optional.empty(),
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_rolelesscontact.json"));
|
||||
|
@ -519,8 +480,6 @@ public class RdapJsonFormatterTest {
|
|||
.makeRdapJsonForContact(
|
||||
contactResourceNotLinked,
|
||||
Optional.empty(),
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_unlinkedcontact.json"));
|
||||
|
@ -532,8 +491,6 @@ public class RdapJsonFormatterTest {
|
|||
rdapJsonFormatter
|
||||
.makeRdapJsonForDomain(
|
||||
domainBaseFull,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_domain_full.json"));
|
||||
|
@ -543,11 +500,7 @@ public class RdapJsonFormatterTest {
|
|||
public void testDomain_summary() {
|
||||
assertThat(
|
||||
rdapJsonFormatter
|
||||
.makeRdapJsonForDomain(
|
||||
domainBaseFull,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.SUMMARY)
|
||||
.makeRdapJsonForDomain(domainBaseFull, OutputDataType.SUMMARY)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_domain_summary.json"));
|
||||
}
|
||||
|
@ -556,13 +509,7 @@ public class RdapJsonFormatterTest {
|
|||
public void testDomain_logged_out() {
|
||||
rdapJsonFormatter.rdapAuthorization = RdapAuthorization.PUBLIC_AUTHORIZATION;
|
||||
assertThat(
|
||||
rdapJsonFormatter
|
||||
.makeRdapJsonForDomain(
|
||||
domainBaseFull,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL)
|
||||
.toJson())
|
||||
rdapJsonFormatter.makeRdapJsonForDomain(domainBaseFull, OutputDataType.FULL).toJson())
|
||||
.isEqualTo(loadJson("rdapjson_domain_logged_out.json"));
|
||||
}
|
||||
|
||||
|
@ -570,11 +517,7 @@ public class RdapJsonFormatterTest {
|
|||
public void testDomain_noNameserversNoTransfers() {
|
||||
assertThat(
|
||||
rdapJsonFormatter
|
||||
.makeRdapJsonForDomain(
|
||||
domainBaseNoNameserversNoTransfers,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL)
|
||||
.makeRdapJsonForDomain(domainBaseNoNameserversNoTransfers, OutputDataType.FULL)
|
||||
.toJson())
|
||||
.isEqualTo(loadJson("rdapjson_domain_no_nameservers.json"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue