@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()); }
@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()); }