use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class QueryResultsSerializationTest method returningADeletedPathGraph.
@Test
public void returningADeletedPathGraph() {
// given
executeTransactionally("CREATE (:Start)-[:R]->(:End)");
// execute and commit
Response commit = http.POST(commitResource, queryAsJsonGraph("MATCH p=(s)-[r:R]->(e) DELETE p RETURN p"));
assertThat(commit).satisfies(containsNoErrors());
assertThat(commit).satisfies(graphContainsDeletedNodes(2));
assertThat(commit).satisfies(graphContainsDeletedRelationships(1));
assertThat(commit.status()).isEqualTo(200);
assertThat(nodesInDatabase()).isEqualTo(0L);
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class QueryResultsSerializationTest method shouldBeAbleToReturnDeletedRelationshipsGraph.
@Test
public void shouldBeAbleToReturnDeletedRelationshipsGraph() {
// given
executeTransactionally("CREATE (:Start)-[:R {p: 'a property'}]->(:End)");
// execute and commit
Response commit = http.POST(commitResource, queryAsJsonGraph("MATCH (s)-[r:R]->(e) DELETE r RETURN r"));
assertThat(commit).satisfies(containsNoErrors());
assertThat(commit).satisfies(graphContainsDeletedRelationships(1));
assertThat(commit.status()).isEqualTo(200);
assertThat(nodesInDatabase()).isEqualTo(2L);
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class RowFormatMetaFieldTestIT method metaFieldShouldGivePathInfoInList.
@Test
public void metaFieldShouldGivePathInfoInList() {
// given
executeTransactionally("CREATE (:Start)-[:R]->(:End)");
// execute and commit
Response commit = http.POST(commitResource, queryAsJsonRow("MATCH p=(s)-[r:R]->(e) RETURN p"));
assertThat(commit).satisfies(containsNoErrors());
assertThat(commit).satisfies(rowContainsAMetaListAtIndex(0));
assertThat(commit.status()).isEqualTo(200);
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class TransactionIT method begin__execute__execute__commit.
@ParameterizedTest
@MethodSource("argumentsProvider")
public void begin__execute__execute__commit(String txUri) throws Exception {
this.txUri = txUri;
long nodesInDatabaseBeforeTransaction = countNodes();
// begin
Response begin = POST(txUri);
String commitResource = begin.stringFromContent("commit");
// execute
POST(begin.location(), quotedJson("{ 'statements': [ { 'statement': 'CREATE (n)' } ] }"));
// execute
POST(begin.location(), quotedJson("{ 'statements': [ { 'statement': 'CREATE (n)' } ] }"));
// commit
POST(commitResource);
assertThat(countNodes()).isEqualTo(nodesInDatabaseBeforeTransaction + 2);
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class TransactionIT method begin_and_execute_periodic_commit_followed_by_another_statement_and_commit.
@ParameterizedTest
@MethodSource("argumentsProvider")
public void begin_and_execute_periodic_commit_followed_by_another_statement_and_commit(String txUri) throws Exception {
this.txUri = txUri;
withCSVFile(1, url -> {
// begin and execute and commit
Response response = POST(transactionCommitUri(), quotedJson("{ 'statements': [ { 'statement': 'USING PERIODIC COMMIT LOAD CSV FROM \\\"" + url + "\\\" AS line CREATE (n {id: 23}) RETURN n' }, { 'statement': 'RETURN 1' } ] }"));
assertThat(response.status()).isEqualTo(200);
assertThat(response).satisfies(hasErrors(Status.Statement.SemanticError));
});
}
Aggregations