use of org.apache.jackrabbit.oak.commons.json.JsonObject in project jackrabbit-oak by apache.
the class ClusterViewTest method asJsonObject.
private JsonObject asJsonObject(final ClusterView view) {
final String json = view.asDescriptorValue();
// System.out.println(json);
JsopTokenizer t = new JsopTokenizer(json);
t.read('{');
JsonObject o = JsonObject.create(t);
return o;
}
use of org.apache.jackrabbit.oak.commons.json.JsonObject in project jackrabbit-oak by apache.
the class QueryTest method getCost.
private static double getCost(Session session, String xpath) throws RepositoryException {
QueryManager qm = session.getWorkspace().getQueryManager();
QueryResult qr = qm.createQuery("explain measure " + xpath, "xpath").execute();
Row r = qr.getRows().nextRow();
String plan = r.getValue("plan").getString();
String cost = plan.substring(plan.lastIndexOf('{'));
JsonObject json = parseJson(cost);
double c = Double.parseDouble(json.getProperties().get("a"));
return c;
}
Aggregations