client2.close();
}
@Test
public void executeExercise() throws Exception {
final RexsterClient client = getClient();
final List<Object> nullResults = client.execute("null");
assertEquals(1, nullResults.size());
final Object nullResult = nullResults.get(0);
assertEquals(null, nullResult);
final List<Map<String, Object>> mapResults = client.execute("[val:1+1]");
assertEquals(1, mapResults.size());
final Map<String, Object> mapResult = mapResults.get(0);
assertEquals("2", mapResult.get("val").toString());
final List<Long> intResults = client.execute("1+1", null);
assertEquals(1, intResults.size());
final Long intResult = intResults.get(0);
assertEquals("2", intResult.toString());
final List<Map<String, Object>> vertexResults = client.execute("g=TinkerGraphFactory.createTinkerGraph();g.v(1)", null);
assertEquals(1, vertexResults.size());
final Map<String, Object> vertexResult = vertexResults.get(0);
assertEquals("vertex", vertexResult.get("_type").toString());
assertEquals("1", vertexResult.get("_id").toString());
final Map<String, Object> vertexProperties = (Map<String, Object>) vertexResult.get("_properties");
assertEquals("marko", vertexProperties.get("name"));
assertEquals(29L, vertexProperties.get("age"));
client.close();
}