use of org.apache.cayenne.map.SQLTemplateDescriptor in project cayenne by apache.
the class PrefetchTypeForSqlTemplateHandlerTest method testLoad.
@Test
public void testLoad() throws Exception {
final DataMap map = new DataMap();
parse("query", new HandlerFactory() {
@Override
public NamespaceAwareNestedTagHandler createHandler(NamespaceAwareNestedTagHandler parent) {
return new QueryDescriptorHandler(parent, map);
}
});
SQLTemplateDescriptor sqlTemplateDescriptor = (SQLTemplateDescriptor) map.getQueryDescriptor("query");
assertEquals(3, sqlTemplateDescriptor.getPrefetchesMap().size());
assertEquals(1, (int) sqlTemplateDescriptor.getPrefetchesMap().get("paintings"));
assertEquals(2, (int) sqlTemplateDescriptor.getPrefetchesMap().get("paintings.artist"));
assertEquals(3, (int) sqlTemplateDescriptor.getPrefetchesMap().get("paintings.gallery"));
}
Aggregations