use of javax.jcr.query.Query in project jackrabbit by apache.
the class DescendantNodeTest method testRelativePath.
public void testRelativePath() throws RepositoryException {
try {
Query q = qf.createQuery(qf.selector(testNodeType, "s"), qf.descendantNode("s", testPath), null, null);
q.execute();
fail("DescendantNode with relative path argument must throw InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
try {
String stmt = "SELECT * FROM [" + testNodeType + "] AS s WHERE " + "ISDESCENDANTNODE(s, [" + testPath + "])";
qm.createQuery(stmt, Query.JCR_SQL2).execute();
fail("ISDESCENDANTNODE() with relative path argument must throw InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
}
use of javax.jcr.query.Query in project jackrabbit by apache.
the class DescendantNodeTest method testSyntacticallyInvalidPath.
public void testSyntacticallyInvalidPath() throws RepositoryException {
String invalidPath = testRoot + "/" + nodeName1 + "[";
try {
Query q = qf.createQuery(qf.selector(testNodeType, "s"), qf.descendantNode("s", invalidPath), null, null);
q.execute();
fail("DescendantNode with syntactically invalid path argument must throw InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
try {
String stmt = "SELECT * FROM [" + testNodeType + "] AS s WHERE " + "ISDESCENDANTNODE(s, [" + invalidPath + "])";
qm.createQuery(stmt, Query.JCR_SQL2).execute();
fail("ISDESCENDANTNODE() with syntactically invalid path argument must throw InvalidQueryException");
} catch (InvalidQueryException e) {
// expected
}
}
use of javax.jcr.query.Query 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.Query 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.Query 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
}
}
Aggregations