@Test
public void testDataAllocate() throws Exception {
final long allocateNum = 5;
Future<KeyRange> futureRange = asyncService.allocateIds(ASYNC_ENTITY, allocateNum);
KeyRange range = futureRange.get();
assertTaskIsDoneAndNotCancelled(futureRange);
Entity noParent = createTestEntity(ASYNC_ENTITY);
assertEntityNotInRange(noParent, range);
Entity parent = new Entity(ASYNC_ENTITY);
parent.setProperty("name", "parent" + new Date());
Key parentKey = service.put(parent);
Future<KeyRange> futureRange2 = asyncService.allocateIds(parentKey, ASYNC_ENTITY, allocateNum);
KeyRange range2 = futureRange2.get();
assertTaskIsDoneAndNotCancelled(futureRange2);
Entity noParent2 = createTestEntity(ASYNC_ENTITY, parentKey);
assertEntityNotInRange(noParent2, range2);
Entity child = new Entity(range2.getStart());
child.setProperty("name", "second" + new Date());
Key childKey = service.put(child);
assertEquals(parentKey, childKey.getParent());
}