Exemplo n.º 1
0
 @Test
 public void testThatPrintingDoesntThrowExceptions() {
   pm.currentTransaction().commit();
   pm.currentTransaction().begin();
   ZooClassDef def = getDef(TestClass.class);
   QueryParser qp = new QueryParser("(_int > 1 && _int < 52) || _int > 50", def, null, null);
   QueryTreeNode qtn = qp.parseQuery();
   assertNotNull(qtn.print());
 }
Exemplo n.º 2
0
  private void checkAdvices(String queryFilter, int nAdv) {
    pm.currentTransaction().commit();
    pm.currentTransaction().begin();
    ZooClassDef def = getDef(TestClass.class);
    QueryParser qp = new QueryParser(queryFilter, def, null, null);
    QueryTreeNode qtn = qp.parseQuery();
    QueryOptimizer qo = new QueryOptimizer(def);

    // no indexing
    List<QueryAdvice> advices = qo.determineIndexToUse(qtn);
    //		for (QueryAdvice a: advices) {
    //			System.out.println("adv: min/max = " + a.getMin()+"/"+a.getMax()+" cls=" +
    // a.getIndex());//.getName());
    //		}
    assertEquals(nAdv, advices.size());
  }