use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.
the class NodeCounterIndexTest method executeXPathQuery.
protected String executeXPathQuery(String statement) throws ParseException {
Result result = qe.executeQuery(statement, "xpath", null, NO_MAPPINGS);
StringBuilder buff = new StringBuilder();
for (ResultRow row : result.getRows()) {
for (PropertyValue v : row.getValues()) {
buff.append(v);
}
}
return buff.toString();
}
use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.
the class QueryTest method queryOnStableRevision.
@Test
public void queryOnStableRevision() throws Exception {
ContentSession s = repository.login(null, null);
Root r = s.getLatestRoot();
Tree t = r.getTree("/").addChild("test");
t.addChild("node1").setProperty("jcr:primaryType", "nt:base");
t.addChild("node2").setProperty("jcr:primaryType", "nt:base");
t.addChild("node3").setProperty("jcr:primaryType", "nt:base");
r.commit();
ContentSession s2 = repository.login(null, null);
Root r2 = s2.getLatestRoot();
r.getTree("/test").getChild("node2").remove();
r.commit();
Result result = r2.getQueryEngine().executeQuery("test//element(*, nt:base)", Query.XPATH, QueryEngine.NO_BINDINGS, QueryEngine.NO_MAPPINGS);
Set<String> paths = new HashSet<String>();
for (ResultRow rr : result.getRows()) {
paths.add(rr.getPath());
}
assertEquals(new HashSet<String>(Arrays.asList("/test/node1", "/test/node2", "/test/node3")), paths);
}
use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testReferenceColumn.
@Test
public void testReferenceColumn() {
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.REFERENCE).when(value).getType();
doReturn("value").when(value).getValue(Type.REFERENCE);
ResultRow row = mock(ResultRow.class);
doReturn(value).when(row).getValue("column");
ContentRemoteResult result = createResult(row);
RemoteValue remoteValue = result.getColumnValue("column");
assertEquals("value", remoteValue.asReference());
}
use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testMultiStringColumn.
@Test
public void testMultiStringColumn() {
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.STRINGS).when(value).getType();
doReturn(asList("a", "b")).when(value).getValue(Type.STRINGS);
ResultRow row = mock(ResultRow.class);
doReturn(value).when(row).getValue("column");
ContentRemoteResult result = createResult(row);
RemoteValue remoteValue = result.getColumnValue("column");
assertEquals(asList("a", "b"), remoteValue.asMultiText());
}
use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.
the class ContentRemoteResultTest method testMultiBooleanColumn.
@Test
public void testMultiBooleanColumn() {
PropertyValue value = mock(PropertyValue.class);
doReturn(Type.BOOLEANS).when(value).getType();
doReturn(asList(true, false)).when(value).getValue(Type.BOOLEANS);
ResultRow row = mock(ResultRow.class);
doReturn(value).when(row).getValue("column");
ContentRemoteResult result = createResult(row);
RemoteValue remoteValue = result.getColumnValue("column");
assertEquals(asList(true, false), remoteValue.asMultiBoolean());
}
Aggregations