Search in sources :

Example 1 with Response

use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.

the class QueryResultsSerializationTest method returningAPartiallyDeletedPathRest.

@Test
public void returningAPartiallyDeletedPathRest() {
    // given
    graphdb().execute("CREATE (:Start)-[:R]->(:End)");
    // execute and commit
    Response commit = http.POST(commitResource, queryAsJsonRest("MATCH p=(s)-[r:R]->(e) DELETE s,r RETURN p"));
    assertThat(commit, containsNoErrors());
    assertThat(commit.status(), equalTo(200));
    assertThat(nodesInDatabase(), equalTo(1L));
}
Also used : Response(org.neo4j.test.server.HTTP.Response) Test(org.junit.Test)

Example 2 with Response

use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.

the class QueryResultsSerializationTest method shouldBeAbleToReturnDeletedNodesRow.

@Test
public void shouldBeAbleToReturnDeletedNodesRow() {
    // given
    graphdb().execute("CREATE (:NodeToDelete {p: 'a property'})");
    // execute and commit
    Response commit = http.POST(commitResource, queryAsJsonRow("MATCH (n:NodeToDelete) DELETE n RETURN n"));
    assertThat(commit, containsNoErrors());
    assertThat(commit, rowContainsDeletedEntities(1, 0));
    assertThat(commit.status(), equalTo(200));
    assertThat(nodesInDatabase(), equalTo(0L));
}
Also used : Response(org.neo4j.test.server.HTTP.Response) Test(org.junit.Test)

Example 3 with Response

use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.

the class QueryResultsSerializationTest method nestedShouldWorkRest.

@Test
public void nestedShouldWorkRest() {
    // given
    graphdb().execute("CREATE ()");
    // execute and commit
    Response commit = http.POST(commitResource, queryAsJsonRest("MATCH (n) DELETE (n) RETURN [n, {someKey: n}]"));
    assertThat(commit, containsNoErrors());
    assertThat(commit.status(), equalTo(200));
    assertThat(commit, restContainsNestedDeleted());
    assertThat(nodesInDatabase(), equalTo(0L));
}
Also used : Response(org.neo4j.test.server.HTTP.Response) Test(org.junit.Test)

Example 4 with Response

use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.

the class QueryResultsSerializationTest method shouldNotMarkNormalEntitiesAsDeletedRow.

@Test
public void shouldNotMarkNormalEntitiesAsDeletedRow() {
    // given
    graphdb().execute("CREATE (:Start)-[:R]->(:End)");
    // execute and commit
    Response commit = http.POST(commitResource, queryAsJsonRow("MATCH (s:Start)-[r:R]->(e:End) RETURN *"));
    assertThat(commit, containsNoErrors());
    assertThat(commit, rowContainsNoDeletedEntities());
    assertThat(commit.status(), equalTo(200));
}
Also used : Response(org.neo4j.test.server.HTTP.Response) Test(org.junit.Test)

Example 5 with Response

use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.

the class QueryResultsSerializationTest method shouldBeAbleToReturnDeletedNodesGraph.

@Test
public void shouldBeAbleToReturnDeletedNodesGraph() {
    // given
    graphdb().execute("CREATE (:NodeToDelete {p: 'a property'})");
    // execute and commit
    Response commit = http.POST(commitResource, queryAsJsonGraph("MATCH (n:NodeToDelete) DELETE n RETURN n"));
    assertThat(commit, containsNoErrors());
    assertThat(commit, graphContainsDeletedNodes(1));
    assertThat(commit.status(), equalTo(200));
    assertThat(nodesInDatabase(), equalTo(0L));
}
Also used : Response(org.neo4j.test.server.HTTP.Response) Test(org.junit.Test)

Aggregations

Response (org.neo4j.test.server.HTTP.Response)151 Test (org.junit.Test)69 Test (org.junit.jupiter.api.Test)43 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)30 MethodSource (org.junit.jupiter.params.provider.MethodSource)30 JsonNode (com.fasterxml.jackson.databind.JsonNode)19 HTTP (org.neo4j.test.server.HTTP)13 JsonNode (org.codehaus.jackson.JsonNode)12 Node (org.neo4j.graphdb.Node)11 Transaction (org.neo4j.graphdb.Transaction)11 JsonParseException (org.neo4j.server.rest.domain.JsonParseException)6 Duration (java.time.Duration)5 ZonedDateTime (java.time.ZonedDateTime)5 CountDownLatch (java.util.concurrent.CountDownLatch)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 TransactionIdStore (org.neo4j.kernel.impl.transaction.log.TransactionIdStore)3 HttpResponse (java.net.http.HttpResponse)2 HashSet (java.util.HashSet)2 Before (org.junit.Before)2 TransactionIdStore (org.neo4j.storageengine.api.TransactionIdStore)2