use of com.orientechnologies.orient.core.command.traverse.OTraverse in project orientdb by orientechnologies.
the class TraverseTest method traverseAPIIterating.
@Test
public void traverseAPIIterating() {
int cycles = 0;
for (OIdentifiable id : new OTraverse().target(database.browseClass("Movie").iterator()).predicate(new OCommandPredicate() {
@Override
public Object evaluate(OIdentifiable iRecord, ODocument iCurrentResult, OCommandContext iContext) {
return ((Integer) iContext.getVariable("depth")) <= 2;
}
})) {
cycles++;
}
Assert.assertTrue(cycles > 0);
}
use of com.orientechnologies.orient.core.command.traverse.OTraverse in project orientdb by orientechnologies.
the class TraverseTest method traverseAPIAllFromActorNoWhere.
public void traverseAPIAllFromActorNoWhere() {
List<OIdentifiable> result1 = new OTraverse().fields("*").target(tomCruise.getIdentity()).execute();
Assert.assertEquals(result1.size(), totalElements);
}
use of com.orientechnologies.orient.core.command.traverse.OTraverse in project orientdb by orientechnologies.
the class TraverseTest method traverseAPIandSQLIterating.
@Test
public void traverseAPIandSQLIterating() {
int cycles = 0;
for (OIdentifiable id : new OTraverse().target(database.browseClass("Movie").iterator()).predicate(new OSQLPredicate("$depth <= 2"))) {
cycles++;
}
Assert.assertTrue(cycles > 0);
}
Aggregations