Search in sources :

Example 6 with SQLTemplateDescriptor

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"));
}
Also used : SQLTemplateDescriptor(org.apache.cayenne.map.SQLTemplateDescriptor) DataMap(org.apache.cayenne.map.DataMap) Test(org.junit.Test)

Aggregations

SQLTemplateDescriptor (org.apache.cayenne.map.SQLTemplateDescriptor)6 DataMap (org.apache.cayenne.map.DataMap)3 Test (org.junit.Test)3 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 BadLocationException (javax.swing.text.BadLocationException)1 Document (javax.swing.text.Document)1 QueryEvent (org.apache.cayenne.configuration.event.QueryEvent)1 DbAttribute (org.apache.cayenne.map.DbAttribute)1 DbEntity (org.apache.cayenne.map.DbEntity)1 QueryDescriptor (org.apache.cayenne.map.QueryDescriptor)1 SelectQueryDescriptor (org.apache.cayenne.map.SelectQueryDescriptor)1 URLResource (org.apache.cayenne.resource.URLResource)1 JCayenneTextPane (org.apache.cayenne.swing.components.textpane.JCayenneTextPane)1