1
0
mirror of https://github.com/google/nomulus synced 2026-02-13 00:02:04 +00:00

Fix missing hostPendingActionNotificationResponses in PollMessage.OneTime (#1426)

This commit is contained in:
sarahcaseybot
2021-12-02 16:06:02 -05:00
committed by GitHub
parent 39b613fe81
commit f5d9ee4e4d
5 changed files with 76 additions and 4 deletions

View File

@@ -24,12 +24,14 @@ import static google.registry.testing.DatabaseHelper.persistActiveContact;
import static google.registry.testing.DatabaseHelper.persistResource;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.collect.ImmutableList;
import google.registry.model.EntityTestCase;
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainHistory;
import google.registry.model.domain.Period;
import google.registry.model.eppcommon.Trid;
import google.registry.model.poll.PendingActionNotificationResponse.HostPendingActionNotificationResponse;
import google.registry.model.reporting.HistoryEntry;
import google.registry.persistence.VKey;
import google.registry.testing.DualDatabaseTest;
@@ -119,6 +121,32 @@ public class PollMessageTest extends EntityTestCase {
assertThat(tm().transact(() -> tm().loadByEntity(pollMessage))).isEqualTo(pollMessage);
}
@TestOfyAndSql
void testPersistenceOneTime_hostPendingActionNotification() {
HostPendingActionNotificationResponse hostPendingActionNotificationResponse =
HostPendingActionNotificationResponse.create(
"test.example",
true,
Trid.create("ABC-123", "server-trid"),
fakeClock.nowUtc().minusDays(5));
PollMessage.OneTime pollMessage =
new PollMessage.OneTime.Builder()
.setRegistrarId("TheRegistrar")
.setEventTime(fakeClock.nowUtc())
.setMsg("Test poll message")
.setParent(historyEntry)
.setResponseData(ImmutableList.of(hostPendingActionNotificationResponse))
.build();
persistResource(pollMessage);
assertThat(tm().transact(() -> tm().loadByEntity(pollMessage).getMsg()))
.isEqualTo(pollMessage.msg);
assertThat(
tm().transact(() -> tm().loadByEntity(pollMessage))
.hostPendingActionNotificationResponses)
.contains(hostPendingActionNotificationResponse);
}
@TestSqlOnly
void testSerializableOneTime() {
PollMessage.OneTime pollMessage =