* prefetch scenario with no reverse obj relationships.
*/
public void testRouteQueryWithPrefetchesNoReverse() {
EntityResolver resolver = context.getEntityResolver();
ObjEntity paintingEntity = resolver.lookupObjEntity(Painting.class);
ObjEntity galleryEntity = resolver.lookupObjEntity(Gallery.class);
ObjEntity artistExhibitEntity = resolver.lookupObjEntity(ArtistExhibit.class);
ObjEntity exhibitEntity = resolver.lookupObjEntity(Exhibit.class);
ObjRelationship paintingToArtistRel = (ObjRelationship) paintingEntity
.getRelationship("toArtist");
paintingEntity.removeRelationship("toArtist");
ObjRelationship galleryToPaintingRel = (ObjRelationship) galleryEntity
.getRelationship("paintingArray");
galleryEntity.removeRelationship("paintingArray");
ObjRelationship artistExhibitToArtistRel = (ObjRelationship) artistExhibitEntity
.getRelationship("toArtist");
artistExhibitEntity.removeRelationship("toArtist");
ObjRelationship exhibitToArtistExhibitRel = (ObjRelationship) exhibitEntity
.getRelationship("artistExhibitArray");
exhibitEntity.removeRelationship("artistExhibitArray");
Expression e = ExpressionFactory.matchExp("artistName", "artist1");
SelectQuery q = new SelectQuery("Artist", e);
q.addPrefetch("paintingArray");
q.addPrefetch("paintingArray.toGallery");
q.addPrefetch("artistExhibitArray.toExhibit");
try {
MockQueryRouter router = new MockQueryRouter();
q.route(router, resolver, null);
assertEquals(4, router.getQueryCount());
}
finally {
paintingEntity.addRelationship(paintingToArtistRel);
galleryEntity.addRelationship(galleryToPaintingRel);
artistExhibitEntity.addRelationship(artistExhibitToArtistRel);
exhibitEntity.addRelationship(exhibitToArtistExhibitRel);
}
}