Search in sources :

Example 6 with Response

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

the class QueryResultsSerializationTest method shouldBeAbleToReturnDeletedRelationshipsRest.

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

Example 7 with Response

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

the class QueryResultsSerializationTest method returningADeletedPathGraph.

@Test
public void returningADeletedPathGraph() {
    // given
    graphdb().execute("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, containsNoErrors());
    assertThat(commit, graphContainsDeletedNodes(2));
    assertThat(commit, graphContainsDeletedRelationships(1));
    assertThat(commit.status(), equalTo(200));
    assertThat(nodesInDatabase(), equalTo(0L));
}
Also used : Response(org.neo4j.test.server.HTTP.Response) Test(org.junit.Test)

Example 8 with Response

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

the class QueryResultsSerializationTest method returningAPartiallyDeletedPathGraph.

@Test
public void returningAPartiallyDeletedPathGraph() {
    // given
    graphdb().execute("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, containsNoErrors());
    assertThat(commit, graphContainsDeletedNodes(1));
    assertThat(commit, graphContainsDeletedRelationships(1));
    assertThat(commit.status(), equalTo(200));
    assertThat(nodesInDatabase(), equalTo(1L));
}
Also used : Response(org.neo4j.test.server.HTTP.Response) Test(org.junit.Test)

Example 9 with Response

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

the class TransactionTerminationIT method startTx.

private static Response startTx(HTTP.Builder http) {
    Response tx = http.POST("db/data/transaction");
    assertThat(tx.status(), equalTo(201));
    assertThat(tx, containsNoErrors());
    return tx;
}
Also used : Response(org.neo4j.test.server.HTTP.Response)

Example 10 with Response

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

the class TransactionIT method status_codes_should_appear_in_response.

@Test
public void status_codes_should_appear_in_response() throws Exception {
    Response response = http.POST("/db/data/transaction/commit", quotedJson("{ 'statements': [ { 'statement': 'RETURN {n}' } ] }"));
    assertThat(response.status(), equalTo(200));
    assertThat(response, hasErrors(Status.Statement.ParameterMissing));
}
Also used : Response(org.neo4j.test.server.HTTP.Response) Test(org.junit.Test)

Aggregations

Response (org.neo4j.test.server.HTTP.Response)73 Test (org.junit.Test)69 JsonNode (org.codehaus.jackson.JsonNode)12 TransactionIdStore (org.neo4j.kernel.impl.transaction.log.TransactionIdStore)3 JsonParseException (org.neo4j.server.rest.domain.JsonParseException)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 Before (org.junit.Before)2 HTTP (org.neo4j.test.server.HTTP)2 HashSet (java.util.HashSet)1 Description (org.hamcrest.Description)1 TypeSafeMatcher (org.hamcrest.TypeSafeMatcher)1 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)1 Node (org.neo4j.graphdb.Node)1 Transaction (org.neo4j.graphdb.Transaction)1 ServerControls (org.neo4j.harness.ServerControls)1 JsonHelper.jsonNode (org.neo4j.server.rest.domain.JsonHelper.jsonNode)1