mirror of
https://github.com/google/nomulus.git
synced 2025-06-28 15:23:34 +02:00
Fix missing hostPendingActionNotificationResponses in PollMessage.OneTime (#1426)
This commit is contained in:
parent
18d051ef87
commit
cff8f9a1cd
5 changed files with 76 additions and 4 deletions
|
@ -354,6 +354,10 @@ public abstract class PollMessage extends ImmutableObject
|
|||
@Column(name = "transfer_response_contact_id")
|
||||
String contactId;
|
||||
|
||||
@Ignore
|
||||
@Column(name = "transfer_response_host_id")
|
||||
String hostId;
|
||||
|
||||
@Override
|
||||
public VKey<OneTime> createVKey() {
|
||||
return VKey.create(OneTime.class, getId(), Key.create(this));
|
||||
|
@ -393,6 +397,9 @@ public abstract class PollMessage extends ImmutableObject
|
|||
if (!isNullOrEmpty(contactPendingActionNotificationResponses)) {
|
||||
pendingActionNotificationResponse = contactPendingActionNotificationResponses.get(0);
|
||||
}
|
||||
if (!isNullOrEmpty(hostPendingActionNotificationResponses)) {
|
||||
pendingActionNotificationResponse = hostPendingActionNotificationResponses.get(0);
|
||||
}
|
||||
if (!isNullOrEmpty(contactTransferResponses)) {
|
||||
contactId = contactTransferResponses.get(0).getContactId();
|
||||
transferResponse = contactTransferResponses.get(0);
|
||||
|
@ -433,6 +440,16 @@ public abstract class PollMessage extends ImmutableObject
|
|||
pendingActionNotificationResponse.processedDate);
|
||||
pendingActionNotificationResponse = domainPendingResponse;
|
||||
domainPendingActionNotificationResponses = ImmutableList.of(domainPendingResponse);
|
||||
} else if (hostId != null) {
|
||||
HostPendingActionNotificationResponse hostPendingActionNotificationResponse =
|
||||
HostPendingActionNotificationResponse.create(
|
||||
pendingActionNotificationResponse.nameOrId.value,
|
||||
pendingActionNotificationResponse.getActionResult(),
|
||||
pendingActionNotificationResponse.getTrid(),
|
||||
pendingActionNotificationResponse.processedDate);
|
||||
pendingActionNotificationResponse = hostPendingActionNotificationResponse;
|
||||
hostPendingActionNotificationResponses =
|
||||
ImmutableList.of(hostPendingActionNotificationResponse);
|
||||
}
|
||||
}
|
||||
if (transferResponse != null) {
|
||||
|
@ -527,6 +544,7 @@ public abstract class PollMessage extends ImmutableObject
|
|||
} else if (instance.hostPendingActionNotificationResponses != null) {
|
||||
instance.pendingActionNotificationResponse =
|
||||
instance.hostPendingActionNotificationResponses.get(0);
|
||||
instance.hostId = instance.hostPendingActionNotificationResponses.get(0).nameOrId.value;
|
||||
}
|
||||
// Set the generic transfer response field as appropriate
|
||||
if (instance.contactTransferResponses != null) {
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -261,11 +261,19 @@ td.section {
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">generated on</td>
|
||||
<<<<<<< HEAD
|
||||
<td class="property_value">2021-11-23 20:43:41.968049</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">last flyway file</td>
|
||||
<td id="lastFlywayFile" class="property_value">V104__add_transfer_response_host_id_to_poll_message.sql</td>
|
||||
=======
|
||||
<td class="property_value">2021-11-17 21:23:12.62481</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">last flyway file</td>
|
||||
<td id="lastFlywayFile" class="property_value">V103__add_transfer_response_host_id_to_poll_message.sql</td>
|
||||
>>>>>>> 19aa29939 (Fix missing hostPendingActionNotificationResponses in PollMessage.OneTime)
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -274,19 +282,24 @@ td.section {
|
|||
<svg viewbox="0.00 0.00 4249.00 2901.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="erDiagram" style="overflow: hidden; width: 100%; height: 800px"> <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 2897.5)">
|
||||
<title>SchemaCrawler_Diagram</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-2897.5 4245,-2897.5 4245,4 -4,4" />
|
||||
<text text-anchor="start" x="3972.5" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||
<text text-anchor="start" x="3980.5" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||
generated by
|
||||
</text>
|
||||
<text text-anchor="start" x="4055.5" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||
<text text-anchor="start" x="4063.5" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||
SchemaCrawler 16.10.1
|
||||
</text>
|
||||
<text text-anchor="start" x="3971.5" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||
<text text-anchor="start" x="3979.5" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||
generated on
|
||||
</text>
|
||||
<<<<<<< HEAD
|
||||
<text text-anchor="start" x="4055.5" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||
2021-11-23 20:43:41.968049
|
||||
=======
|
||||
<text text-anchor="start" x="4063.5" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||
2021-11-17 21:23:12.62481
|
||||
>>>>>>> 19aa29939 (Fix missing hostPendingActionNotificationResponses in PollMessage.OneTime)
|
||||
</text>
|
||||
<polygon fill="none" stroke="#888888" points="3968,-4 3968,-44 4233,-44 4233,-4 3968,-4" /> <!-- allocationtoken_a08ccbef -->
|
||||
<polygon fill="none" stroke="#888888" points="3976,-4 3976,-44 4233,-44 4233,-4 3976,-4" /> <!-- allocationtoken_a08ccbef -->
|
||||
<g id="node1" class="node">
|
||||
<title>allocationtoken_a08ccbef</title>
|
||||
<polygon fill="#ebcef2" stroke="transparent" points="2538.5,-233 2538.5,-252 2691.5,-252 2691.5,-233 2538.5,-233" />
|
||||
|
|
|
@ -261,11 +261,19 @@ td.section {
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">generated on</td>
|
||||
<<<<<<< HEAD
|
||||
<td class="property_value">2021-11-23 20:43:39.672931</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">last flyway file</td>
|
||||
<td id="lastFlywayFile" class="property_value">V104__add_transfer_response_host_id_to_poll_message.sql</td>
|
||||
=======
|
||||
<td class="property_value">2021-11-17 21:23:10.198048</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">last flyway file</td>
|
||||
<td id="lastFlywayFile" class="property_value">V103__add_transfer_response_host_id_to_poll_message.sql</td>
|
||||
>>>>>>> 19aa29939 (Fix missing hostPendingActionNotificationResponses in PollMessage.OneTime)
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -284,7 +292,11 @@ td.section {
|
|||
generated on
|
||||
</text>
|
||||
<text text-anchor="start" x="4755.52" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||
<<<<<<< HEAD
|
||||
2021-11-23 20:43:39.672931
|
||||
=======
|
||||
2021-11-17 21:23:10.198048
|
||||
>>>>>>> 19aa29939 (Fix missing hostPendingActionNotificationResponses in PollMessage.OneTime)
|
||||
</text>
|
||||
<polygon fill="none" stroke="#888888" points="4668.02,-4 4668.02,-44 4933.02,-44 4933.02,-4 4668.02,-4" /> <!-- allocationtoken_a08ccbef -->
|
||||
<g id="node1" class="node">
|
||||
|
|
|
@ -523,6 +523,7 @@
|
|||
transfer_response_contact_id text,
|
||||
transfer_response_domain_expiration_time timestamptz,
|
||||
transfer_response_domain_name text,
|
||||
transfer_response_host_id text,
|
||||
pending_action_response_action_result boolean,
|
||||
pending_action_response_name_or_id text,
|
||||
pending_action_response_processed_date timestamptz,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue