}
public void testAggregateListQuerysFetchKeys() {
List<AggregateChildModel> adams = new ArrayList<AggregateChildModel>();
for(int i=0; i<100; i++){
AggregateChildModel adam = new AggregateChildModel();
adam.name = "adam"+i;
adams.add(adam);
}
AggregateChildModel eve = new AggregateChildModel();
eve.name = "eve";
AggregateParentModel god = new AggregateParentModel();
god.name = "god";
god.child.set(eve);
god.children.asList().addAll(adams);
god.insert();
assertNotNull(god.id);
assertNotNull(god.child.get().id);
// get aggregated one2many
AggregateParentModel godbis = AggregateParentModel.all().filter("name", "god").get();
List<AggregateChildModel> children = godbis.children.asQuery().fetchKeys();
for(int i=0; i<100; i++){
assertEquals(adams.get(i).id, children.get(i).id);
assertTrue(children.get(i).name == null);
}
for(int i=0; i<100; i++){
assertEquals(adams.get(i), godbis.children.asList().get(i));
}
Iterator<AggregateChildModel> it = godbis.children.asList().iterator();
int i=0;
while(it.hasNext()){
AggregateChildModel child = it.next();
assertEquals(adams.get(i++), child);
}
assertEquals(100, i);
}