public class SimpleTransactionTest extends RestTestBase {
@Test
public void testQueryWithinTransaction() throws Exception {
GraphDatabaseService db = getRestGraphDb();
RestCypherQueryEngine cypher = new RestCypherQueryEngine(((RestAPIProvider)db).getRestAPI());
Transaction tx = db.beginTx();
QueryResult<Map<String,Object>> result = cypher.query("CREATE (person1 { personId: {id}, started: {started} }) return person1",
map("id", 1, "started", System.currentTimeMillis()));
try {
result.to(Node.class).singleOrNull();
} catch(IllegalStateException ise) { assertEquals(true, ise.getMessage().contains("finish the transaction")); }
tx.success();