use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class TransactionIT method begin_and_execute_multiple_periodic_commit_last_and_commit.
@Test
public void begin_and_execute_multiple_periodic_commit_last_and_commit() throws Exception {
ServerTestUtils.withCSVFile(1, url -> {
Response response = http.POST("/db/data/transaction/commit", quotedJson("{ 'statements': [ { 'statement': 'CREATE ()' }, " + "{ 'statement': 'USING PERIODIC COMMIT LOAD CSV FROM \\\"" + url + "\\\" AS line " + "CREATE ()' } ] }"));
assertThat(response, hasErrors(Status.Statement.SemanticError));
});
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class TransactionIT method should_serialize_collect_correctly.
@Test
public void should_serialize_collect_correctly() throws Exception {
// given
http.POST("/db/data/transaction/commit", singleStatement("CREATE (n:Foo)"));
// when
Response response = http.POST("/db/data/transaction/commit", quotedJson("{ 'statements': [ { 'statement': 'MATCH (n:Foo) RETURN COLLECT(n)' } ] }"));
// then
assertThat(response.status(), equalTo(200));
JsonNode data = response.get("results").get(0);
assertThat(data.get("columns").get(0).asText(), equalTo("COLLECT(n)"));
assertThat(data.get("data").get(0).get("row").size(), equalTo(1));
assertThat(data.get("data").get(0).get("row").get(0).get(0).size(), equalTo(0));
assertThat(response.get("errors").size(), equalTo(0));
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class TransactionIT method begin_and_execute_invalid_query_and_commit.
@Test
public void begin_and_execute_invalid_query_and_commit() throws Exception {
// begin and execute and commit
Response response = http.POST("/db/data/transaction/commit", quotedJson("{ 'statements': [ { 'statement': 'MATCH n RETURN m' } ] }"));
assertThat(response.status(), equalTo(200));
assertThat(response, hasErrors(Status.Statement.SyntaxError));
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class QueryResultsSerializationTest method returningAPartiallyDeletedPathRow.
@Test
public void returningAPartiallyDeletedPathRow() {
// given
graphdb().execute("CREATE (:Start)-[:R]->(:End)");
// execute and commit
Response commit = http.POST(commitResource, queryAsJsonRow("MATCH p=(s)-[r:R]->(e) DELETE s,r RETURN p"));
assertThat(commit, containsNoErrors());
assertThat(commit, rowContainsDeletedEntitiesInPath(1, 1));
assertThat(commit.status(), equalTo(200));
assertThat(nodesInDatabase(), equalTo(1L));
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class QueryResultsSerializationTest method nestedShouldWorkGraph.
@Test
public void nestedShouldWorkGraph() {
// given
graphdb().execute("CREATE ()");
// execute and commit
Response commit = http.POST(commitResource, queryAsJsonGraph("MATCH (n) DELETE (n) RETURN [n, {someKey: n}]"));
assertThat(commit, containsNoErrors());
assertThat(commit.status(), equalTo(200));
assertThat(commit, graphContainsDeletedNodes(1));
assertThat(nodesInDatabase(), equalTo(0L));
}
Aggregations