mirror of
https://github.com/google/nomulus.git
synced 2025-07-19 17:26:09 +02:00
Make LINKED into a virtual status value
* Remove LINKED when loading an EppResource * Enforce that you can't add it to a resource * Ignore LINKED on xjc import of contacts and hosts After running ResaveAllEppResourcesAction we will no longer have persisted LINKED statuses in datastore. In the process of writing this I discovered that RDAP treats LINKED like any other status value and returns the persisted value rather than the derived one. Since this is an existing bug and is orthogonal to the changes in this CL, I am addressing it in a separate CL. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=145585227
This commit is contained in:
parent
4a730e0c9e
commit
0b1781b110
10 changed files with 68 additions and 73 deletions
|
@ -152,36 +152,21 @@ public class HostResourceTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testImplicitStatusValues() {
|
||||
// OK is implicit if there's no other statuses.
|
||||
StatusValue[] statuses = {StatusValue.OK};
|
||||
assertAboutHosts()
|
||||
.that(new HostResource.Builder().build())
|
||||
.hasExactlyStatusValues(statuses);
|
||||
StatusValue[] statuses1 = {StatusValue.OK, StatusValue.LINKED};
|
||||
// OK is also implicit if the only other status is LINKED.
|
||||
assertAboutHosts()
|
||||
.that(new HostResource.Builder()
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.LINKED)).build())
|
||||
.hasExactlyStatusValues(statuses1);
|
||||
StatusValue[] statuses2 = {StatusValue.CLIENT_HOLD};
|
||||
.hasExactlyStatusValues(StatusValue.OK);
|
||||
// If there are other status values, OK should be suppressed.
|
||||
assertAboutHosts()
|
||||
.that(new HostResource.Builder()
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_HOLD))
|
||||
.build())
|
||||
.hasExactlyStatusValues(statuses2);
|
||||
StatusValue[] statuses3 = {StatusValue.LINKED, StatusValue.CLIENT_HOLD};
|
||||
assertAboutHosts()
|
||||
.that(new HostResource.Builder()
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.LINKED, StatusValue.CLIENT_HOLD))
|
||||
.build())
|
||||
.hasExactlyStatusValues(statuses3);
|
||||
StatusValue[] statuses4 = {StatusValue.CLIENT_HOLD};
|
||||
.hasExactlyStatusValues(StatusValue.CLIENT_HOLD);
|
||||
// When OK is suppressed, it should be removed even if it was originally there.
|
||||
assertAboutHosts()
|
||||
.that(new HostResource.Builder()
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.OK, StatusValue.CLIENT_HOLD))
|
||||
.build())
|
||||
.hasExactlyStatusValues(statuses4);
|
||||
.hasExactlyStatusValues(StatusValue.CLIENT_HOLD);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue