use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class QueryResultsSerializationTest method shouldFailIfTryingToReturnPropsOfDeletedRelationshipRow.
@Test
public void shouldFailIfTryingToReturnPropsOfDeletedRelationshipRow() {
// given
executeTransactionally("CREATE (:Start)-[:R {p: 'a property'}]->(:End)");
// execute and commit
Response commit = http.POST(commitResource, queryAsJsonRow("MATCH (s)-[r:R]->(e) DELETE r RETURN r.p"));
assertThat(commit).satisfies(hasErrors(Status.Statement.EntityNotFound));
assertThat(commit.status()).isEqualTo(200);
assertThat(nodesInDatabase()).isEqualTo(2L);
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class QueryResultsSerializationTest method shouldFailIfTryingToReturnPropsOfDeletedRelationshipRest.
@Test
public void shouldFailIfTryingToReturnPropsOfDeletedRelationshipRest() {
// given
executeTransactionally("CREATE (:Start)-[:MARKER {p: 'a property'}]->(:End)");
// execute and commit
Response commit = http.POST(commitResource, queryAsJsonRest("MATCH (s)-[r:MARKER]->(e) DELETE r RETURN r.p"));
assertThat(commit).as("Error raw response: " + commit.rawContent()).satisfies(hasErrors(Status.Statement.EntityNotFound));
assertThat(commit.status()).isEqualTo(200);
assertThat(nodesInDatabase()).isEqualTo(2L);
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class QueryResultsSerializationTest method returningAPartiallyDeletedPathGraph.
@Test
public void returningAPartiallyDeletedPathGraph() {
// given
executeTransactionally("CREATE (:Start)-[:R]->(:End)");
// execute and commit
Response commit = http.POST(commitResource, queryAsJsonGraph("MATCH p=(s)-[r:R]->(e) DELETE s,r RETURN p"));
assertThat(commit).satisfies(containsNoErrors());
assertThat(commit).satisfies(graphContainsDeletedNodes(1));
assertThat(commit).satisfies(graphContainsDeletedRelationships(1));
assertThat(commit.status()).isEqualTo(200);
assertThat(nodesInDatabase()).isEqualTo(1L);
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class QueryResultsSerializationTest method nestedShouldWorkRow.
@Test
public void nestedShouldWorkRow() {
// given
executeTransactionally("CREATE ()");
// execute and commit
Response commit = http.POST(commitResource, queryAsJsonRow("MATCH (n) DELETE (n) RETURN [n, {someKey: n}]"));
assertThat(commit).satisfies(containsNoErrors());
assertThat(commit.status()).isEqualTo(200);
assertThat(commit).satisfies(rowContainsDeletedEntities(2, 0));
assertThat(nodesInDatabase()).isEqualTo(0L);
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class QueryResultsSerializationTest method shouldHandleTemporalArraysUsingGraphResultDataContent.
@Test
public void shouldHandleTemporalArraysUsingGraphResultDataContent() throws Exception {
// Given
var db = getDefaultDatabase();
ZonedDateTime date = ZonedDateTime.of(1980, 3, 11, 0, 0, 0, 0, ZoneId.of("Europe/Stockholm"));
try (Transaction tx = db.beginTx()) {
Node node = tx.createNode(label("N"));
node.setProperty("dates", new ZonedDateTime[] { date });
tx.commit();
}
// When
HTTP.Response response = runQuery("MATCH (n:N) RETURN n", "graph");
// Then
assertEquals(200, response.status());
assertNoErrors(response);
JsonNode row = response.get("results").get(0).get("data").get(0).get("graph").get("nodes").get(0).get("properties").get("dates").get(0);
assertEquals("\"1980-03-11T00:00+01:00[Europe/Stockholm]\"", row.toString());
}
Aggregations