use of com.orientechnologies.orient.core.command.OBasicCommandContext in project orientdb by orientechnologies.
the class OSQLFunctionShortestPathTest method testLong.
@Test
public void testLong() throws Exception {
final List<ORID> result = function.execute(null, null, null, new Object[] { vertices.get(1), vertices.get(20) }, new OBasicCommandContext());
assertEquals(11, result.size());
assertEquals(vertices.get(1).getId(), result.get(0));
assertEquals(vertices.get(3).getId(), result.get(1));
int next = 2;
for (int i = 4; i <= 20; i += 2) {
assertEquals(vertices.get(i).getId(), result.get(next++));
}
}
use of com.orientechnologies.orient.core.command.OBasicCommandContext in project orientdb by orientechnologies.
the class OSQLFunctionShortestPathTest method testMaxDepth3.
@Test
public void testMaxDepth3() throws Exception {
Map<String, Object> additionalParams = new HashMap<String, Object>();
additionalParams.put(OSQLFunctionShortestPath.PARAM_MAX_DEPTH, 10);
final List<ORID> result = function.execute(null, null, null, new Object[] { vertices.get(1), vertices.get(20), null, null, additionalParams }, new OBasicCommandContext());
assertEquals(0, result.size());
}
use of com.orientechnologies.orient.core.command.OBasicCommandContext in project orientdb by orientechnologies.
the class OSQLFunctionShortestPathTest method testExecuteOut.
@Test
public void testExecuteOut() throws Exception {
final List<ORID> result = function.execute(null, null, null, new Object[] { vertices.get(1), vertices.get(4), "out", null }, new OBasicCommandContext());
assertEquals(4, result.size());
assertEquals(vertices.get(1).getId(), result.get(0));
assertEquals(vertices.get(2).getId(), result.get(1));
assertEquals(vertices.get(3).getId(), result.get(2));
assertEquals(vertices.get(4).getId(), result.get(3));
}
use of com.orientechnologies.orient.core.command.OBasicCommandContext in project orientdb by orientechnologies.
the class CRUDDocumentValidationTest method testNullComparison.
@Test
public void testNullComparison() {
// given
ODocument doc1 = new ODocument().field("testField", (Object) null);
ODocument doc2 = new ODocument().field("testField", (Object) null);
ODocumentComparator comparator = new ODocumentComparator(Collections.singletonList(new OPair<String, String>("testField", "asc")), new OBasicCommandContext());
Assert.assertEquals(comparator.compare(doc1, doc2), 0);
}
Aggregations