mirror of
https://github.com/google/nomulus
synced 2026-04-24 02:00:50 +00:00
Make RDE generation resilient to missing contact rows (#2883)
This will prevent RDE from failing once we delete all contacts, just as a fail-safe. BUG= http://b/439636188
This commit is contained in:
@@ -14,9 +14,11 @@
|
||||
|
||||
package google.registry.rde;
|
||||
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static com.google.common.io.BaseEncoding.base16;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth.assertWithMessage;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistEppResource;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
@@ -69,6 +71,7 @@ import google.registry.xjc.rdedomain.XjcRdeDomain;
|
||||
import google.registry.xjc.rdedomain.XjcRdeDomainElement;
|
||||
import google.registry.xjc.rgp.XjcRgpStatusType;
|
||||
import google.registry.xjc.secdns.XjcSecdnsDsDataType;
|
||||
import google.registry.xml.XmlException;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Optional;
|
||||
import org.joda.money.Money;
|
||||
@@ -198,6 +201,21 @@ public class DomainToXjcConverterTest {
|
||||
wrapDeposit(bean).marshal(new ByteArrayOutputStream(), UTF_8);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testConvertAbsentContacts() throws XmlException {
|
||||
Domain domain = makeDomain(clock);
|
||||
tm().transact(
|
||||
() ->
|
||||
tm().delete(
|
||||
domain.getAllContacts().stream()
|
||||
.map(DesignatedContact::getContactKey)
|
||||
.collect(toImmutableSet())));
|
||||
XjcRdeDomain bean = DomainToXjcConverter.convertDomain(domain, RdeMode.FULL);
|
||||
assertThat(bean.getRegistrant()).isNull();
|
||||
assertThat(bean.getContacts()).isEmpty();
|
||||
wrapDeposit(bean).marshal(new ByteArrayOutputStream(), UTF_8);
|
||||
}
|
||||
|
||||
XjcRdeDeposit wrapDeposit(XjcRdeDomain domain) {
|
||||
XjcRdeDeposit deposit = new XjcRdeDeposit();
|
||||
deposit.setId("984302");
|
||||
|
||||
Reference in New Issue
Block a user