use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class CypherIT method send_query_to_create_a_node.
@Test
@Documented("Create a node with a label and a property using Cypher. See the request for the parameter " + "sent with the query.")
@Title("Create a node")
@Graph
public void send_query_to_create_a_node() throws Exception {
data.get();
String script = "CREATE (n:Person { name : {name} }) RETURN n";
String response = cypherRestCall(script, Status.OK, Pair.of("name", "Andres"));
assertTrue(response.contains("name"));
assertTrue(response.contains("Andres"));
}
use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class CypherIT method send_query_to_create_a_node_from_a_map.
@Test
@Title("Create a node with multiple properties")
@Documented("Create a node with a label and multiple properties using Cypher. See the request for the parameter " + "sent with the query.")
@Graph
public void send_query_to_create_a_node_from_a_map() throws Exception {
data.get();
String script = "CREATE (n:Person { props } ) RETURN n";
String params = "\"props\" : { \"position\" : \"Developer\", \"name\" : \"Michael\", \"awesome\" : true, \"children\" : 3 }";
String response = cypherRestCall(script, Status.OK, params);
assertTrue(response.contains("name"));
assertTrue(response.contains("Michael"));
}
use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class DatabaseMetadataServiceIT method shouldReturn200OnGet.
@Documented("Get relationship types.")
@Test
public void shouldReturn200OnGet() {
helper.createRelationship("KNOWS");
helper.createRelationship("LOVES");
String result = gen.get().expectedStatus(200).get(functionalTestHelper.dataUri() + "relationship/types").entity();
assertThat(result, allOf(containsString("KNOWS"), containsString("LOVES")));
}
use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class GetNodePropertiesIT method shouldGet200ForProperty.
@Documented("Get property for node.\n" + "\n" + "Get a single node property from a node.")
@Test
public void shouldGet200ForProperty() throws JsonParseException {
String entity = JsonHelper.createJsonFrom(Collections.singletonMap("foo", "bar"));
JaxRsResponse createResponse = req.post(functionalTestHelper.dataUri() + "node/", entity);
JaxRsResponse response = req.get(getPropertyUri(createResponse.getLocation().toString(), "foo"));
assertEquals(200, response.getStatus());
gen.get().expectedStatus(200).get(getPropertyUri(createResponse.getLocation().toString(), "foo"));
}
use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class GetOnRootIT method streaming.
@Documented("All responses from the REST API can be transmitted as JSON streams, resulting in\n" + "better performance and lower memory overhead on the server side. To use\n" + "streaming, supply the header `X-Stream: true` with each request.")
@Test
public void streaming() throws Exception {
data.get();
ResponseEntity responseEntity = gen().withHeader(StreamingFormat.STREAM_HEADER, "true").expectedType(APPLICATION_JSON_TYPE).expectedStatus(200).get(getDataUri());
JaxRsResponse response = responseEntity.response();
// this gets the full media type, including things like
// ; stream=true at the end
String foundMediaType = response.getType().toString();
String expectedMediaType = StreamingFormat.MEDIA_TYPE.toString();
assertEquals(expectedMediaType, foundMediaType);
String body = responseEntity.entity();
Map<String, Object> map = JsonHelper.jsonToMap(body);
assertEquals(getDataUri() + "node", map.get("node"));
}
Aggregations