Rename LrpToken to LrpTokenEntity

This is to better distinguish between an LRP "token" (the string passed along in EPP) and the datastore entity that contains the token and all metadata.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135943480
This commit is contained in:
ctingue 2016-10-12 11:52:27 -07:00 committed by Ben McIlwain
parent 1a9f91ed9e
commit dd9137fbd1
14 changed files with 104 additions and 97 deletions

View file

@ -30,11 +30,11 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
/** Unit tests for {@link LrpToken}. */
public class LrpTokenTest extends EntityTestCase {
/** Unit tests for {@link LrpTokenEntity}. */
public class LrpTokenEntityTest extends EntityTestCase {
LrpToken unredeemedToken;
LrpToken redeemedToken;
LrpTokenEntity unredeemedToken;
LrpTokenEntity redeemedToken;
@Rule
public final ExceptionRule thrown = new ExceptionRule();
@ -48,18 +48,17 @@ public class LrpTokenTest extends EntityTestCase {
.setType(HistoryEntry.Type.DOMAIN_APPLICATION_CREATE)
.build());
unredeemedToken = persistResource(
new LrpToken.Builder()
new LrpTokenEntity.Builder()
.setAssignee("1:1020304")
.setToken("a0b1c2d3e4f5g6")
.setValidTlds(ImmutableSet.of("tld"))
.setMetadata(ImmutableMap.of("foo", "bar"))
.build());
redeemedToken = persistResource(
new LrpToken.Builder()
new LrpTokenEntity.Builder()
.setAssignee("2:org.testdomain")
.setToken("h0i1j2k3l4m")
.setRedemptionHistoryEntry(
Key.create(applicationCreateHistoryEntry))
.setRedemptionHistoryEntry(Key.create(applicationCreateHistoryEntry))
.setValidTlds(ImmutableSet.of("tld"))
.setMetadata(ImmutableMap.of("bar", "foo"))
.build());
@ -72,13 +71,14 @@ public class LrpTokenTest extends EntityTestCase {
@Test
public void testSuccess_loadByToken() throws Exception {
assertThat(ofy().load().key(Key.create(LrpToken.class, "a0b1c2d3e4f5g6")).now())
assertThat(ofy().load().key(Key.create(LrpTokenEntity.class, "a0b1c2d3e4f5g6")).now())
.isEqualTo(unredeemedToken);
}
@Test
public void testSuccess_loadByAssignee() throws Exception {
assertThat(ofy().load().type(LrpToken.class).filter("assignee", "1:1020304").first().now())
assertThat(
ofy().load().type(LrpTokenEntity.class).filter("assignee", "1:1020304").first().now())
.isEqualTo(unredeemedToken);
}
@Test

View file

@ -286,7 +286,7 @@ class google.registry.model.domain.GracePeriod {
java.lang.String clientId;
org.joda.time.DateTime expirationTime;
}
class google.registry.model.domain.LrpToken {
class google.registry.model.domain.LrpTokenEntity {
@Id java.lang.String token;
com.googlecode.objectify.Key<google.registry.model.reporting.HistoryEntry> redemptionHistoryEntry;
google.registry.model.UpdateAutoTimestamp updateTimestamp;