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

@ -34,7 +34,7 @@ import google.registry.model.billing.RegistrarCredit;
import google.registry.model.billing.RegistrarCreditBalance;
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DomainBase;
import google.registry.model.domain.LrpToken;
import google.registry.model.domain.LrpTokenEntity;
import google.registry.model.host.HostResource;
import google.registry.model.index.DomainApplicationIndex;
import google.registry.model.index.EppResourceIndex;
@ -53,7 +53,7 @@ public final class ExportConstants {
/** Set of entity classes to export into BigQuery for reporting purposes. */
@VisibleForTesting
@SuppressWarnings("unchecked") // varargs
@SuppressWarnings("unchecked") // varargs
static final ImmutableSet<Class<? extends ImmutableObject>> REPORTING_ENTITY_CLASSES =
ImmutableSet.of(
Cancellation.class,
@ -66,7 +66,7 @@ public final class ExportConstants {
ForeignKeyHostIndex.class,
HistoryEntry.class,
HostResource.class,
LrpToken.class,
LrpTokenEntity.class,
Modification.class,
OneTime.class,
PremiumList.class,

View file

@ -57,7 +57,7 @@ import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainBase.Builder;
import google.registry.model.domain.DomainCommand.Create;
import google.registry.model.domain.DomainResource;
import google.registry.model.domain.LrpToken;
import google.registry.model.domain.LrpTokenEntity;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.flags.FlagsCreateCommandExtension;
import google.registry.model.domain.launch.LaunchCreateExtension;
@ -94,7 +94,7 @@ public abstract class BaseDomainCreateFlow<R extends DomainBase, B extends Build
protected SignedMark signedMark;
protected boolean isAnchorTenantViaReservation;
protected TldState tldState;
protected Optional<LrpToken> lrpToken;
protected Optional<LrpTokenEntity> lrpToken;
protected Optional<RegistryExtraFlowLogic> extraFlowLogic;
@ -206,7 +206,7 @@ public abstract class BaseDomainCreateFlow<R extends DomainBase, B extends Build
&& !isAnchorTenantViaReservation;
lrpToken = isLrpApplication
? TldSpecificLogicProxy.getMatchingLrpToken(command, tld)
: Optional.<LrpToken>absent();
: Optional.<LrpTokenEntity>absent();
// Superusers can create reserved domains, force creations on domains that require a claims
// notice without specifying a claims key, and override blocks on registering premium domains.
if (!isSuperuser) {

View file

@ -29,7 +29,7 @@ import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
import google.registry.model.ImmutableObject;
import google.registry.model.domain.DomainCommand.Create;
import google.registry.model.domain.DomainResource;
import google.registry.model.domain.LrpToken;
import google.registry.model.domain.LrpTokenEntity;
import google.registry.model.domain.fee.BaseFee;
import google.registry.model.domain.fee.BaseFee.FeeType;
import google.registry.model.domain.fee.Credit;
@ -266,18 +266,18 @@ public final class TldSpecificLogicProxy {
}
/**
* Checks whether a {@link Create} command has a valid {@link LrpToken} for a particular TLD, and
* return that token (wrapped in an {@link Optional}) if one exists.
* Checks whether a {@link Create} command has a valid {@link LrpTokenEntity} for a particular
* TLD, and return that token (wrapped in an {@link Optional}) if one exists.
*
* <p>This method has no knowledge of whether or not an auth code (interpreted here as an LRP
* token) has already been checked against the reserved list for QLP (anchor tenant), as auth
* codes are used for both types of registrations.
*/
public static Optional<LrpToken> getMatchingLrpToken(Create createCommand, String tld) {
public static Optional<LrpTokenEntity> getMatchingLrpToken(Create createCommand, String tld) {
// Note that until the actual per-TLD logic is built out, what's being done here is a basic
// domain-name-to-assignee match.
String lrpToken = createCommand.getAuthInfo().getPw().getValue();
LrpToken token = ofy().load().key(Key.create(LrpToken.class, lrpToken)).now();
LrpTokenEntity token = ofy().load().key(Key.create(LrpTokenEntity.class, lrpToken)).now();
if (token != null) {
if (token.getAssignee().equalsIgnoreCase(createCommand.getFullyQualifiedDomainName())
&& token.getRedemptionHistoryEntry() == null
@ -285,6 +285,6 @@ public final class TldSpecificLogicProxy {
return Optional.of(token);
}
}
return Optional.<LrpToken>absent();
return Optional.<LrpTokenEntity>absent();
}
}

View file

@ -28,7 +28,7 @@ import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DomainApplication;
import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainResource;
import google.registry.model.domain.LrpToken;
import google.registry.model.domain.LrpTokenEntity;
import google.registry.model.export.LogsExportCursor;
import google.registry.model.host.HostResource;
import google.registry.model.index.DomainApplicationIndex;
@ -60,7 +60,7 @@ import google.registry.model.tmch.TmchCrl;
public final class EntityClasses {
/** Set of entity classes. */
@SuppressWarnings("unchecked") // varargs
@SuppressWarnings("unchecked") // varargs
public static final ImmutableSet<Class<? extends ImmutableObject>> ALL_CLASSES =
ImmutableSet.<Class<? extends ImmutableObject>>of(
BillingEvent.Cancellation.class,
@ -92,7 +92,7 @@ public final class EntityClasses {
HostResource.class,
Lock.class,
LogsExportCursor.class,
LrpToken.class,
LrpTokenEntity.class,
PollMessage.class,
PollMessage.Autorenew.class,
PollMessage.OneTime.class,

View file

@ -28,11 +28,9 @@ import google.registry.model.reporting.HistoryEntry;
import java.util.Map;
import java.util.Set;
/**
* An entity representing a token distributed to eligible LRP registrants.
*/
/** An entity representing a token distributed to eligible LRP registrants. */
@Entity
public class LrpToken extends BackupGroupRoot implements Buildable {
public class LrpTokenEntity extends BackupGroupRoot implements Buildable {
/**
* The secret token assigned to a registrant for the purposes of LRP registration.
@ -94,11 +92,11 @@ public class LrpToken extends BackupGroupRoot implements Buildable {
return new Builder(clone(this));
}
/** A builder for constructing {@link LrpToken} objects, since they are immutable. */
public static class Builder extends Buildable.Builder<LrpToken> {
/** A builder for constructing {@link LrpTokenEntity} objects, since they are immutable. */
public static class Builder extends Buildable.Builder<LrpTokenEntity> {
public Builder() {}
private Builder(LrpToken instance) {
private Builder(LrpTokenEntity instance) {
super(instance);
}

View file

@ -32,7 +32,7 @@ import com.google.common.io.Files;
import com.google.common.io.LineReader;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.Work;
import google.registry.model.domain.LrpToken;
import google.registry.model.domain.LrpTokenEntity;
import google.registry.tools.Command.RemoteApiCommand;
import google.registry.tools.params.PathParameter;
import google.registry.util.StringGenerator;
@ -92,11 +92,11 @@ public final class CreateLrpTokensCommand implements RemoteApiCommand {
String line = null;
do {
ImmutableSet.Builder<LrpToken> tokensToSave = new ImmutableSet.Builder<>();
ImmutableSet.Builder<LrpTokenEntity> tokensToSave = new ImmutableSet.Builder<>();
for (String token : generateTokens(BATCH_SIZE)) {
line = reader.readLine();
if (!isNullOrEmpty(line)) {
tokensToSave.add(new LrpToken.Builder()
tokensToSave.add(new LrpTokenEntity.Builder()
.setAssignee(line)
.setToken(token)
.setValidTlds(validTlds)
@ -107,13 +107,14 @@ public final class CreateLrpTokensCommand implements RemoteApiCommand {
} while (line != null);
}
private void saveTokens(final ImmutableSet<LrpToken> tokens) {
Collection<LrpToken> savedTokens = ofy().transact(new Work<Collection<LrpToken>>() {
@Override
public Collection<LrpToken> run() {
return ofy().save().entities(tokens).now().values();
}});
for (LrpToken token : savedTokens) {
private void saveTokens(final ImmutableSet<LrpTokenEntity> tokens) {
Collection<LrpTokenEntity> savedTokens =
ofy().transact(new Work<Collection<LrpTokenEntity>>() {
@Override
public Collection<LrpTokenEntity> run() {
return ofy().save().entities(tokens).now().values();
}});
for (LrpTokenEntity token : savedTokens) {
System.out.printf("%s,%s%n", token.getAssignee(), token.getToken());
}
}
@ -128,18 +129,18 @@ public final class CreateLrpTokensCommand implements RemoteApiCommand {
private ImmutableSet<String> generateTokens(int count) {
final ImmutableSet<String> candidates =
ImmutableSet.copyOf(TokenUtils.createTokens(LRP, stringGenerator, count));
ImmutableSet<Key<LrpToken>> existingTokenKeys = FluentIterable.from(candidates)
.transform(new Function<String, Key<LrpToken>>() {
ImmutableSet<Key<LrpTokenEntity>> existingTokenKeys = FluentIterable.from(candidates)
.transform(new Function<String, Key<LrpTokenEntity>>() {
@Override
public Key<LrpToken> apply(String input) {
return Key.create(LrpToken.class, input);
public Key<LrpTokenEntity> apply(String input) {
return Key.create(LrpTokenEntity.class, input);
}})
.toSet();
ImmutableSet<String> existingTokenStrings = FluentIterable
.from(ofy().load().keys(existingTokenKeys).values())
.transform(new Function<LrpToken, String>() {
.transform(new Function<LrpTokenEntity, String>() {
@Override
public String apply(LrpToken input) {
public String apply(LrpTokenEntity input) {
return input.getToken();
}})
.toSet();

View file

@ -21,7 +21,7 @@ import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
import google.registry.model.domain.LrpToken;
import google.registry.model.domain.LrpTokenEntity;
import google.registry.tools.Command.RemoteApiCommand;
/** Command to show token information for LRP participants. */
@ -51,19 +51,20 @@ public final class GetLrpTokenCommand implements RemoteApiCommand {
checkArgument(
(tokenString == null) == (assignee != null),
"Exactly one of either token or assignee must be specified.");
ImmutableSet.Builder<LrpToken> tokensBuilder = new ImmutableSet.Builder<>();
ImmutableSet.Builder<LrpTokenEntity> tokensBuilder = new ImmutableSet.Builder<>();
if (tokenString != null) {
LrpToken token = ofy().load().key(Key.create(LrpToken.class, tokenString)).now();
LrpTokenEntity token =
ofy().load().key(Key.create(LrpTokenEntity.class, tokenString)).now();
if (token != null) {
tokensBuilder.add(token);
}
} else {
tokensBuilder.addAll(ofy().load().type(LrpToken.class).filter("assignee", assignee));
tokensBuilder.addAll(ofy().load().type(LrpTokenEntity.class).filter("assignee", assignee));
}
ImmutableSet<LrpToken> tokens = tokensBuilder.build();
ImmutableSet<LrpTokenEntity> tokens = tokensBuilder.build();
if (!tokens.isEmpty()) {
for (LrpToken token : tokens) {
for (LrpTokenEntity token : tokens) {
System.out.println(token);
if (includeHistory && token.getRedemptionHistoryEntry() != null) {
System.out.println(

View file

@ -12,7 +12,7 @@ ForeignKeyHostIndex
HistoryEntry
HostResource
LogsExportCursor
LrpToken
LrpTokenEntity
Modification
OneTime
PollMessage

View file

@ -104,7 +104,7 @@ import google.registry.flows.domain.DomainFlowUtils.TrailingDashException;
import google.registry.flows.domain.DomainFlowUtils.UnsupportedFeeAttributeException;
import google.registry.model.domain.DomainApplication;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.LrpToken;
import google.registry.model.domain.LrpTokenEntity;
import google.registry.model.domain.launch.ApplicationStatus;
import google.registry.model.domain.launch.LaunchNotice;
import google.registry.model.domain.launch.LaunchPhase;
@ -878,11 +878,12 @@ public class DomainApplicationCreateFlowTest
persistResource(Registry.get("tld").asBuilder()
.setLrpTldStates(ImmutableSet.of(TldState.LANDRUSH))
.build());
LrpToken token = persistResource(new LrpToken.Builder()
.setToken("lrptokentest")
.setAssignee("test-validate.tld")
.setValidTlds(ImmutableSet.of("tld"))
.build());
LrpTokenEntity token = persistResource(
new LrpTokenEntity.Builder()
.setToken("lrptokentest")
.setAssignee("test-validate.tld")
.setValidTlds(ImmutableSet.of("tld"))
.build());
setEppInput("domain_create_landrush_lrp.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
@ -910,11 +911,12 @@ public class DomainApplicationCreateFlowTest
persistResource(Registry.get("tld").asBuilder()
.setLrpTldStates(ImmutableSet.of(TldState.LANDRUSH))
.build());
LrpToken token = persistResource(new LrpToken.Builder()
.setToken("lrptokentest")
.setAssignee("test-validate.tld")
.setValidTlds(ImmutableSet.of("tld"))
.build());
LrpTokenEntity token = persistResource(
new LrpTokenEntity.Builder()
.setToken("lrptokentest")
.setAssignee("test-validate.tld")
.setValidTlds(ImmutableSet.of("tld"))
.build());
setEppInput("domain_create_landrush_lrp.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
@ -928,7 +930,7 @@ public class DomainApplicationCreateFlowTest
persistResource(Registry.get("tld").asBuilder()
.setLrpTldStates(ImmutableSet.of(TldState.LANDRUSH))
.build());
persistResource(new LrpToken.Builder()
persistResource(new LrpTokenEntity.Builder()
.setToken("lrptokentest2")
.setAssignee("test-validate.tld")
.setValidTlds(ImmutableSet.of("tld"))
@ -946,7 +948,7 @@ public class DomainApplicationCreateFlowTest
persistResource(Registry.get("tld").asBuilder()
.setLrpTldStates(ImmutableSet.of(TldState.LANDRUSH))
.build());
persistResource(new LrpToken.Builder()
persistResource(new LrpTokenEntity.Builder()
.setToken("lrptokentest")
// The below assignee doesn't really make sense here, but as of right now the validation
// in TldSpecificLogicProxy is just a match on the domain name, so this test ensures that
@ -967,11 +969,12 @@ public class DomainApplicationCreateFlowTest
persistResource(Registry.get("tld").asBuilder()
.setLrpTldStates(ImmutableSet.of(TldState.LANDRUSH))
.build());
persistResource(new LrpToken.Builder()
persistResource(new LrpTokenEntity.Builder()
.setToken("lrptokentest")
.setAssignee("test-validate.tld")
.setValidTlds(ImmutableSet.of("tld"))
.setRedemptionHistoryEntry(Key.create(HistoryEntry.class, "1")) // as long as it's not null
.setRedemptionHistoryEntry(
Key.create(HistoryEntry.class, "1")) // as long as it's not null
.build());
setEppInput("domain_create_landrush_lrp.xml");
persistContactsAndHosts();
@ -983,11 +986,13 @@ public class DomainApplicationCreateFlowTest
@Test
public void testSuccess_landrushApplicationWithLrpToken_notInLrp() throws Exception {
createTld("tld", TldState.LANDRUSH);
LrpToken token = persistResource(new LrpToken.Builder()
.setToken("lrptokentest")
.setAssignee("test-validate.tld")
.setValidTlds(ImmutableSet.of("tld"))
.build());
LrpTokenEntity token =
persistResource(
new LrpTokenEntity.Builder()
.setToken("lrptokentest")
.setAssignee("test-validate.tld")
.setValidTlds(ImmutableSet.of("tld"))
.build());
setEppInput("domain_create_landrush_lrp.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
@ -1006,11 +1011,12 @@ public class DomainApplicationCreateFlowTest
START_OF_TIME, TldState.SUNRISE,
clock.nowUtc(), TldState.LANDRUSH))
.build());
LrpToken token = persistResource(new LrpToken.Builder()
.setToken("lrptokentest")
.setAssignee("test-validate.tld")
.setValidTlds(ImmutableSet.of("tld"))
.build());
LrpTokenEntity token = persistResource(
new LrpTokenEntity.Builder()
.setToken("lrptokentest")
.setAssignee("test-validate.tld")
.setValidTlds(ImmutableSet.of("tld"))
.build());
setEppInput("domain_create_landrush_lrp.xml");
persistContactsAndHosts();
clock.advanceOneMilli();

View file

@ -103,7 +103,7 @@ import google.registry.model.billing.BillingEvent.Flag;
import google.registry.model.billing.BillingEvent.Reason;
import google.registry.model.domain.DomainResource;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.LrpToken;
import google.registry.model.domain.LrpTokenEntity;
import google.registry.model.domain.TestExtraLogicManager;
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
import google.registry.model.domain.launch.ApplicationStatus;
@ -823,7 +823,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
"tld-reserved",
"anchor,RESERVED_FOR_ANCHOR_TENANT,2fooBAR"))
.build());
LrpToken token = persistResource(new LrpToken.Builder()
LrpTokenEntity token = persistResource(new LrpTokenEntity.Builder()
.setToken("2fooBAR")
.setAssignee("anchor.tld")
.build());

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;

View file

@ -24,7 +24,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.io.Files;
import com.googlecode.objectify.Key;
import google.registry.model.domain.LrpToken;
import google.registry.model.domain.LrpTokenEntity;
import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.DeterministicStringGenerator;
import google.registry.testing.DeterministicStringGenerator.Rule;
@ -61,7 +61,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
@Test
public void testSuccess_oneAssignee_tokenCollision() throws Exception {
LrpToken existingToken = persistResource(new LrpToken.Builder()
LrpTokenEntity existingToken = persistResource(new LrpTokenEntity.Builder()
.setToken("LRP_abcdefghijklmnop")
.setAssignee("otherdomain.tld")
.setValidTlds(ImmutableSet.of("tld"))
@ -120,7 +120,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
@Test
public void testSuccess_largeFile() throws Exception {
int numberOfTokens = 67;
LrpToken[] expectedTokens = new LrpToken[numberOfTokens];
LrpTokenEntity[] expectedTokens = new LrpTokenEntity[numberOfTokens];
// Prepend a counter to avoid collisions, 16-char alphabet will always generate the same string.
stringGenerator =
new DeterministicStringGenerator("abcdefghijklmnop", Rule.PREPEND_COUNTER);
@ -165,18 +165,19 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
runCommand("--assignee=domain.tld", "--tlds=foo");
}
private void assertLrpTokens(LrpToken... expected) throws Exception {
private void assertLrpTokens(LrpTokenEntity... expected) throws Exception {
// Using ImmutableObject comparison here is tricky because updateTimestamp is not set on the
// expected LrpToken objects and will cause the assert to fail.
Iterable<LrpToken> actual = ofy().load().type(LrpToken.class);
ImmutableMap.Builder<String, LrpToken> actualTokenMapBuilder = new ImmutableMap.Builder<>();
for (LrpToken token : actual) {
Iterable<LrpTokenEntity> actual = ofy().load().type(LrpTokenEntity.class);
ImmutableMap.Builder<String, LrpTokenEntity> actualTokenMapBuilder =
new ImmutableMap.Builder<>();
for (LrpTokenEntity token : actual) {
actualTokenMapBuilder.put(token.getToken(), token);
}
ImmutableMap<String, LrpToken> actualTokenMap = actualTokenMapBuilder.build();
ImmutableMap<String, LrpTokenEntity> actualTokenMap = actualTokenMapBuilder.build();
assertThat(actualTokenMap).hasSize(expected.length);
for (LrpToken expectedToken : expected) {
LrpToken match = actualTokenMap.get(expectedToken.getToken());
for (LrpTokenEntity expectedToken : expected) {
LrpTokenEntity match = actualTokenMap.get(expectedToken.getToken());
assertThat(match).isNotNull();
assertThat(match.getAssignee()).isEqualTo(expectedToken.getAssignee());
assertThat(match.getValidTlds()).containsExactlyElementsIn(expectedToken.getValidTlds());
@ -185,12 +186,12 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
}
}
private LrpToken createToken(
private LrpTokenEntity createToken(
String token,
String assignee,
Set<String> validTlds,
@Nullable Key<HistoryEntry> redemptionHistoryEntry) {
LrpToken.Builder tokenBuilder = new LrpToken.Builder()
LrpTokenEntity.Builder tokenBuilder = new LrpTokenEntity.Builder()
.setAssignee(assignee)
.setValidTlds(validTlds)
.setToken(token);

View file

@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import com.googlecode.objectify.Key;
import google.registry.model.domain.DomainApplication;
import google.registry.model.domain.LrpToken;
import google.registry.model.domain.LrpTokenEntity;
import google.registry.model.reporting.HistoryEntry;
import org.junit.Before;
import org.junit.Test;
@ -37,7 +37,7 @@ public class GetLrpTokenCommandTest extends CommandTestCase<GetLrpTokenCommand>
.setType(HistoryEntry.Type.DOMAIN_APPLICATION_CREATE)
.build());
persistResource(
new LrpToken.Builder()
new LrpTokenEntity.Builder()
.setAssignee("domain.tld")
.setToken("domain_token")
.setRedemptionHistoryEntry(Key.create(applicationCreateHistoryEntry))