use of javax.jcr.query.InvalidQueryException in project jackrabbit by apache.
the class ChildNodeTest method testRelativePath.
public void testRelativePath() throws RepositoryException {
try {
Query q = qf.createQuery(qf.selector(testNodeType, "s"), qf.childNode("s", testPath), null, null);
q.execute();
fail("ChildNode with relative path argument must throw InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
try {
String stmt = "SELECT * FROM [" + testNodeType + "] AS s WHERE " + "ISCHILDNODE(s, [" + testPath + "])";
qm.createQuery(stmt, Query.JCR_SQL2).execute();
fail("ISCHILDNODE() with relative path argument must throw InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
}
use of javax.jcr.query.InvalidQueryException in project jackrabbit by apache.
the class ChildNodeTest method testNotASelectorName.
public void testNotASelectorName() throws RepositoryException {
try {
Query q = qf.createQuery(qf.selector(testNodeType, "s"), qf.childNode("x", testRoot), null, null);
q.execute();
fail("ChildNode with an unknown selector name must throw InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
try {
String stmt = "SELECT * FROM [" + testNodeType + "] AS s WHERE " + "ISCHILDNODE(x, [" + testRoot + "])";
qm.createQuery(stmt, Query.JCR_SQL2).execute();
fail("ISCHILDNODE() with an unknown selector name must throw InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
}
use of javax.jcr.query.InvalidQueryException in project jackrabbit by apache.
the class NodeNameTest method testLongLiteral.
public void testLongLiteral() throws RepositoryException {
Value literal = vf.createValue(283);
try {
createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
fail("NodeName comparison with LONG must fail with InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
try {
String stmt = "SELECT * FROM [" + testNodeType + "] AS s " + "WHERE NAME(s) = CAST(" + literal.getString() + " AS LONG)";
qm.createQuery(stmt, Query.JCR_SQL2).execute();
fail("NAME() comparison with LONG must fail with InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
}
use of javax.jcr.query.InvalidQueryException in project jackrabbit by apache.
the class DescendantNodeTest method testNotASelectorName.
public void testNotASelectorName() throws RepositoryException {
try {
Query q = qf.createQuery(qf.selector(testNodeType, "s"), qf.descendantNode("x", testRoot), null, null);
q.execute();
fail("DescendantNode with an unknown selector name must throw InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
try {
String stmt = "SELECT * FROM [" + testNodeType + "] AS s WHERE " + "ISDESCENDANTNODE(x, [" + testRoot + "])";
qm.createQuery(stmt, Query.JCR_SQL2).execute();
fail("ISDESCENDANTNODE() with an unknown selector name must throw InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
}
use of javax.jcr.query.InvalidQueryException in project jackrabbit by apache.
the class NodeLocalNameTest method testURILiteral.
public void testURILiteral() throws RepositoryException {
Value literal = superuser.getValueFactory().createValue("http://example.com", PropertyType.URI);
try {
createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal).execute();
fail("NodeName comparison with URI that cannot be converted to NAME must fail with InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
}
Aggregations