use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class TraverserIT method shouldGetExpectedHitsWhenTraversingWithDescription.
@Documented("Traversal using a return filter.\n" + "\n" + "In this example, the +none+ prune evaluator is used and a return filter\n" + "is supplied in order to return all names containing \"t\".\n" + "The result is to be returned as nodes and the max depth is\n" + "set to 3.")
@Graph({ "Root knows Mattias", "Root knows Johan", "Johan knows Emil", "Emil knows Peter", "Emil knows Tobias", "Tobias loves Sara" })
@Test
public void shouldGetExpectedHitsWhenTraversingWithDescription() throws JsonParseException {
Node start = getNode("Root");
List<Map<String, Object>> rels = new ArrayList<>();
rels.add(map("type", "knows", "direction", "all"));
rels.add(map("type", "loves", "direction", "all"));
String description = createJsonFrom(map("order", "breadth_first", "uniqueness", "node_global", "prune_evaluator", map("language", "javascript", "body", "position.length() > 10"), "return_filter", map("language", "javascript", "body", "position.endNode().getProperty('name').toLowerCase().contains('t')"), "relationships", rels, "max_depth", 3));
String entity = gen().expectedStatus(200).payload(description).post(getTraverseUriNodes(start)).entity();
expectNodes(entity, getNodes("Root", "Mattias", "Peter", "Tobias"));
}
use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class RelationshipIT method shouldReturn204WhenPropertyIsRemovedFromRelationship.
@Test
@Title("Remove property from a relationship")
@Documented("See the example request below.")
@Graph(nodes = { @NODE(name = "Romeo", setNameProperty = true), @NODE(name = "Juliet", setNameProperty = true) }, relationships = { @REL(start = "Romeo", end = "Juliet", type = "LOVES", properties = { @PROP(key = "cost", value = "high", type = GraphDescription.PropType.STRING) }) })
public void shouldReturn204WhenPropertyIsRemovedFromRelationship() {
data.get();
Relationship loves = getFirstRelationshipFromRomeoNode();
gen().expectedStatus(Status.NO_CONTENT.getStatusCode()).delete(getPropertiesUri(loves) + "/cost").entity();
}
use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class RetrieveNodeIT method shouldGet200WhenRetrievingNode.
@Documented("Get node.\n" + "\n" + "Note that the response contains URI/templates for the available\n" + "operations for getting properties and relationships.")
@Test
public void shouldGet200WhenRetrievingNode() throws Exception {
String uri = nodeUri.toString();
gen.get().expectedStatus(200).get(uri);
}
use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class PagedTraverserIT method shouldBeAbleToTraverseAllThePagesWithDefaultPageSize.
@Documented("Paging through the results of a paged traverser.\n\n" + "Paged traversers holdstate on the server, and allow clients to page through\n" + "the results of a traversal. To progress to the next page of traversal results,\n" + "the client issues a HTTP GET request on the paged traversal URI which causes the\n" + "traversal to fill the next page (or partially fill it if insufficient\n" + "results are available).\n" + " \n" + "Note that if a traverser expires through inactivity it will cause a 404\n" + "response on the next +GET+ request. Traversers' leases are renewed on\n" + "every successful access for the same amount of time as originally\n" + "specified.\n" + " \n" + "When the paged traverser reaches the end of its results, the client can\n" + "expect a 404 response as the traverser is disposed by the server.")
@Test
public void shouldBeAbleToTraverseAllThePagesWithDefaultPageSize() {
theStartNode = createLinkedList(LONG_LIST_LENGTH, server.getDatabase());
URI traverserLocation = createPagedTraverser().getLocation();
int enoughPagesToExpireTheTraverser = 3;
for (int i = 0; i < enoughPagesToExpireTheTraverser; i++) {
gen.get().expectedType(MediaType.APPLICATION_JSON_TYPE).expectedStatus(200).payload(traverserDescription()).get(traverserLocation.toString());
}
JaxRsResponse response = new RestRequest(traverserLocation).get();
assertEquals(404, response.getStatus());
}
use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class PagedTraverserIT method shouldExpireTraverserWithNonDefaultTimeout.
@Documented("Paged traverser timeout.\n\n" + "The default timeout for a paged traverser is 60\n" + "seconds, but depending on the application larger or smaller timeouts\n" + "might be appropriate. This can be set by adding a +leaseTime+ query\n" + "parameter with the number of seconds the paged traverser should last.")
@Test
public void shouldExpireTraverserWithNonDefaultTimeout() {
theStartNode = createLinkedList(SHORT_LIST_LENGTH, server.getDatabase());
URI traverserLocation = createPagedTraverserWithTimeoutInMinutes(10).getLocation();
clock.forward(11, TimeUnit.MINUTES);
JaxRsResponse response = new RestRequest(traverserLocation).get();
assertEquals(404, response.getStatus());
}
Aggregations