use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class StreamingBatchOperationDocIT method shouldRollbackAllOnSingle404.
@Test
public void shouldRollbackAllOnSingle404() throws JsonParseException, ClientHandlerException, UniformInterfaceException, JSONException {
String jsonString = new PrettyJSON().array().object().key("method").value("POST").key("to").value("/node").key("body").object().key("age").value(1).endObject().endObject().object().key("method").value("POST").key("to").value("www.google.com").endObject().endArray().toString();
long originalNodeCount = countNodes();
JaxRsResponse response = RestRequest.req().accept(APPLICATION_JSON_TYPE).header(StreamingFormat.STREAM_HEADER, "true").post(batchUri(), jsonString);
assertEquals(200, response.getStatus());
assertEquals(404, singleResult(response, 1).get("status"));
assertEquals(originalNodeCount, countNodes());
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class StreamingBatchOperationDocIT method shouldBeAbleToReferToUniquelyCreatedEntities.
@Test
public void shouldBeAbleToReferToUniquelyCreatedEntities() throws Exception {
String jsonString = new PrettyJSON().array().object().key("method").value("POST").key("to").value("/index/node/Cultures?unique").key("body").object().key("key").value("ID").key("value").value("fra").key("properties").object().key("ID").value("fra").endObject().endObject().key("id").value(0).endObject().object().key("method").value("POST").key("to").value("/node").key("id").value(1).endObject().object().key("method").value("POST").key("to").value("{1}/relationships").key("body").object().key("to").value("{0}").key("type").value("has").endObject().key("id").value(2).endObject().endArray().toString();
JaxRsResponse response = RestRequest.req().accept(APPLICATION_JSON_TYPE).header(StreamingFormat.STREAM_HEADER, "true").post(batchUri(), jsonString);
assertEquals(200, response.getStatus());
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class NeoServerJAXRSDocIT method shouldMakeJAXRSClassesAvailableViaHTTP.
@Test
public void shouldMakeJAXRSClassesAvailableViaHTTP() throws Exception {
CommunityWebContainerBuilder builder = CommunityWebContainerBuilder.builder();
webContainer = WebContainerHelper.createContainer(builder, folder, true);
FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(webContainer);
JaxRsResponse response = new RestRequest().get(functionalTestHelper.baseUri().toASCIIString());
assertEquals(200, response.getStatus());
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class BatchOperationHeaderDocIT method shouldPassHeaders.
@Test
public void shouldPassHeaders() throws Exception {
String jsonData = new PrettyJSON().array().object().key("method").value("GET").key("to").value("../.." + DUMMY_WEB_SERVICE_MOUNT_POINT + "/needs-auth-header").key("body").object().endObject().endObject().endArray().toString();
JaxRsResponse response = new RestRequest(null, "user", "pass").post("http://localhost:7474/db/data/batch", jsonData);
assertEquals(200, response.getStatus());
final List<Map<String, Object>> responseData = jsonToList(response.getEntity());
Map<String, Object> res = (Map<String, Object>) responseData.get(0).get("body");
/*
* {
* Accept=[application/json],
* Content-Type=[application/json],
* Authorization=[Basic dXNlcjpwYXNz],
* User-Agent=[Java/1.6.0_27] <-- ignore that, it changes often
* Host=[localhost:7474],
* Connection=[keep-alive],
* Content-Length=[86]
* }
*/
assertEquals("Basic dXNlcjpwYXNz", res.get("Authorization"));
assertEquals("application/json", res.get("Accept"));
assertEquals("application/json", res.get("Content-Type"));
assertEquals("localhost:7474", res.get("Host"));
assertEquals("keep-alive", res.get("Connection"));
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class ServerConfigDocIT method shouldNotGenerateWADLWhenExplicitlyDisabledInConfig.
@Test
public void shouldNotGenerateWADLWhenExplicitlyDisabledInConfig() throws IOException {
server = server().withProperty(ServerSettings.wadl_enabled.name(), "false").usingDataDir(folder.directory(name.getMethodName()).getAbsolutePath()).build();
server.start();
JaxRsResponse response = new RestRequest().get("http://localhost:7474/application.wadl", MediaType.WILDCARD_TYPE);
assertEquals(404, response.getStatus());
}
Aggregations