Exemplo n.º 1
0
 @Test
 public void testBadChars() {
   JcrQuery q =
       JcrQuery.builder("select * from test where name = ${name}")
           .setString("name", "' inject or ...")
           .build();
   assertEquals("select * from test where name = '\\'' inject or ...'", q.getQuery());
 }
Exemplo n.º 2
0
 @Test
 public void testQuery() {
   JcrQuery q =
       JcrQuery.builder(
               "select * from [nt:unstructured] where ISDESCENDANTNODE(${path}) AND (email = ${email} AND size = ${size}) OR (email != ${email})")
           .setString("path", "/path")
           .setString("email", "*****@*****.**")
           .setLong("size", 10)
           .build();
   assertEquals(
       "select * from [nt:unstructured] where ISDESCENDANTNODE('/path') AND (email = '*****@*****.**' AND size = 10) OR (email != '*****@*****.**')",
       q.getQuery());
 }