Search in sources :

Example 36 with Row

use of javax.jcr.query.Row in project jackrabbit-oak by apache.

the class HybridIndexClusterIT method queryResult.

private static List<String> queryResult(Session session, String indexedPropName, String value) throws RepositoryException {
    session.refresh(false);
    QueryManager qm = session.getWorkspace().getQueryManager();
    Query q = qm.createQuery("select * from [nt:base] where [" + indexedPropName + "] = $value", Query.JCR_SQL2);
    q.bindValue("value", session.getValueFactory().createValue(value));
    QueryResult result = q.execute();
    List<String> paths = Lists.newArrayList();
    for (Row r : JcrUtils.getRows(result)) {
        paths.add(r.getPath());
    }
    return paths;
}
Also used : QueryResult(javax.jcr.query.QueryResult) Query(javax.jcr.query.Query) QueryManager(javax.jcr.query.QueryManager) Row(javax.jcr.query.Row)

Example 37 with Row

use of javax.jcr.query.Row in project jackrabbit by apache.

the class RowTest method testGetScoreWithSelector.

public void testGetScoreWithSelector() throws RepositoryException {
    Row r = getRow();
    // value is implementation dependent, simply call method...
    r.getScore(SELECTOR_NAME);
}
Also used : Row(javax.jcr.query.Row)

Example 38 with Row

use of javax.jcr.query.Row in project jackrabbit by apache.

the class RowTest method testGetValue.

public void testGetValue() throws RepositoryException {
    Row r = getRow();
    assertEquals("property value does not match", TEST_VALUE, r.getValue(propertyName1).getString());
}
Also used : Row(javax.jcr.query.Row)

Example 39 with Row

use of javax.jcr.query.Row in project jackrabbit by apache.

the class RowTest method testGetScore.

public void testGetScore() throws RepositoryException {
    Row r = getRow();
    // value is implementation dependent, simply call method...
    r.getScore();
}
Also used : Row(javax.jcr.query.Row)

Example 40 with Row

use of javax.jcr.query.Row in project jackrabbit by apache.

the class RowTest method testGetNodeWithSelector.

public void testGetNodeWithSelector() throws RepositoryException {
    Row r = getRow();
    String expectedPath = testRootNode.getNode(nodeName1).getPath();
    assertEquals("unexpected result node", expectedPath, r.getNode(SELECTOR_NAME).getPath());
}
Also used : Row(javax.jcr.query.Row)

Aggregations

Row (javax.jcr.query.Row)52 RowIterator (javax.jcr.query.RowIterator)27 QueryResult (javax.jcr.query.QueryResult)21 QueryManager (javax.jcr.query.QueryManager)14 ArrayList (java.util.ArrayList)13 Node (javax.jcr.Node)13 Value (javax.jcr.Value)9 Query (javax.jcr.query.Query)9 Test (org.junit.Test)9 Constraint (javax.jcr.query.qom.Constraint)8 RepositoryException (javax.jcr.RepositoryException)7 Session (javax.jcr.Session)7 JackrabbitSession (org.apache.jackrabbit.api.JackrabbitSession)6 AbstractRepositoryTest (org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest)6 ValueFactory (javax.jcr.ValueFactory)5 HashSet (java.util.HashSet)4 TreeSet (java.util.TreeSet)4 HashMap (java.util.HashMap)3 NoSuchElementException (java.util.NoSuchElementException)3 NodeIterator (javax.jcr.NodeIterator)2