use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class TransactionIT method begin__execute__execute_and_periodic_commit.
@Test
public void begin__execute__execute_and_periodic_commit() throws Exception {
ServerTestUtils.withCSVFile(1, url -> {
Response begin = http.POST("/db/data/transaction");
http.POST(begin.location(), quotedJson("{ 'statements': [ { 'statement': 'CREATE ()' } ] }"));
Response response = http.POST(begin.location(), quotedJson("{ 'statements': [ { '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 correctStatusCodeWhenUsingHintWithoutAnyIndex.
@Test
public void correctStatusCodeWhenUsingHintWithoutAnyIndex() throws Exception {
// begin and execute and commit
Response begin = http.POST("/db/data/transaction/commit", quotedJson("{ 'statements': [ { 'statement': " + "'MATCH (n:Test) USING INDEX n:Test(foo) WHERE n.foo = 42 RETURN n.foo' } ] }"));
assertThat(begin, hasErrors(Status.Request.Schema.IndexNotFound));
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class TransactionIT method begin__execute_and_commit.
@Test
public void begin__execute_and_commit() throws Exception {
long nodesInDatabaseBeforeTransaction = countNodes();
// begin
Response begin = http.POST("/db/data/transaction");
assertThat(begin.status(), equalTo(201));
assertHasTxLocation(begin);
String commitResource = begin.stringFromContent("commit");
assertThat(commitResource, equalTo(begin.location() + "/commit"));
// execute and commit
Response commit = http.POST(commitResource, quotedJson("{ 'statements': [ { 'statement': 'CREATE (n)' } ] }"));
assertThat(commit, containsNoErrors());
assertThat(commit.status(), equalTo(200));
assertThat(countNodes(), equalTo(nodesInDatabaseBeforeTransaction + 1));
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class TransactionIT method begin__execute_multiple__commit.
@Test
public void begin__execute_multiple__commit() throws Exception {
long nodesInDatabaseBeforeTransaction = countNodes();
// begin
Response begin = http.POST("/db/data/transaction");
String commitResource = begin.stringFromContent("commit");
// execute
http.POST(begin.location(), quotedJson("{ 'statements': [ { 'statement': 'CREATE (n)' }, " + "{ 'statement': 'CREATE (n)' } ] }"));
// commit
Response commit = http.POST(commitResource);
assertThat(commit, containsNoErrors());
assertThat(countNodes(), equalTo(nodesInDatabaseBeforeTransaction + 2));
}
use of org.neo4j.test.server.HTTP.Response in project neo4j by neo4j.
the class TransactionIT method begin__execute__commit__execute.
@Test
public void begin__execute__commit__execute() throws Exception {
// begin
Response begin = http.POST("/db/data/transaction");
String commitResource = begin.stringFromContent("commit");
// execute
http.POST(begin.location(), quotedJson("{ 'statements': [ { 'statement': 'CREATE (n)' } ] }"));
// commit
http.POST(commitResource);
// execute
Response execute2 = http.POST(begin.location(), quotedJson("{ 'statements': [ { 'statement': 'CREATE (n)' } ]" + " }"));
assertThat(execute2.status(), equalTo(404));
assertThat(execute2, hasErrors(Status.Transaction.TransactionNotFound));
}
Aggregations