Add domain name support to AllocationToken entities

The design doc is at []
The next step will be to tie this into the domain create flow, and if the domain
name is on a reserved list, allow it to be created if the token is specified that
has the given domain name on it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207884521
This commit is contained in:
mcilwain 2018-08-08 07:59:50 -07:00 committed by jianglai
parent e3977024f3
commit d80f431e21
5 changed files with 117 additions and 24 deletions

View file

@ -36,6 +36,7 @@ public class AllocationTokenTest extends EntityTestCase {
new AllocationToken.Builder()
.setToken("abc123")
.setRedemptionHistoryEntry(Key.create(HistoryEntry.class, 1L))
.setDomainName("foo.example")
.setCreationTime(DateTime.parse("2010-11-12T05:00:00Z"))
.build());
assertThat(ofy().load().entity(token).now()).isEqualTo(token);
@ -44,11 +45,14 @@ public class AllocationTokenTest extends EntityTestCase {
@Test
public void testIndexing() throws Exception {
verifyIndexing(
new AllocationToken.Builder()
.setToken("abc123")
.setCreationTime(DateTime.parse("2010-11-12T05:00:00Z"))
.build(),
"token");
persistResource(
new AllocationToken.Builder()
.setToken("abc123")
.setDomainName("blahdomain.fake")
.setCreationTime(DateTime.parse("2010-11-12T05:00:00Z"))
.build()),
"token",
"domainName");
}
@Test