use of org.neo4j.test.GraphDescription.Graph in project neo4j-documentation by neo4j.
the class RelationshipDocIT method shouldReturn404WhenPropertyWhichDoesNotExistRemovedFromRelationshipStreaming.
@Test
@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 shouldReturn404WhenPropertyWhichDoesNotExistRemovedFromRelationshipStreaming() {
data.get();
Relationship loves = getFirstRelationshipFromRomeoNode();
gen().withHeader(StreamingFormat.STREAM_HEADER, "true").expectedStatus(Status.NOT_FOUND.getStatusCode()).delete(getPropertiesUri(loves) + "/non-existent").entity();
}
use of org.neo4j.test.GraphDescription.Graph in project neo4j-documentation by neo4j.
the class RelationshipDocIT method removeRelationship.
@Test
@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) }) })
@Title("Delete relationship")
public void removeRelationship() {
data.get();
Relationship loves = getFirstRelationshipFromRomeoNode();
gen().description(startGraph("Delete relationship1"));
gen().expectedStatus(Status.NO_CONTENT.getStatusCode()).delete(getRelationshipUri(loves)).entity();
}
use of org.neo4j.test.GraphDescription.Graph in project neo4j-documentation by neo4j.
the class RelationshipDocIT 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().description(startGraph("Remove property from a relationship1"));
gen().expectedStatus(Status.NO_CONTENT.getStatusCode()).delete(getPropertiesUri(loves) + "/cost").entity();
}
use of org.neo4j.test.GraphDescription.Graph in project neo4j-documentation by neo4j.
the class DepthTwoDocIT method shouldReturnAllPathsAtDepthTwoOnPost.
@Documented("Get paths at depth two.")
@Test
@Graph({ "I know you", "you know him" })
public void shouldReturnAllPathsAtDepthTwoOnPost() throws JsonParseException {
Node node = data.get().get("I");
String uri = (String) getNodeLevelPluginMetadata(DepthTwo.class, node.getId()).get(PATHS_ON_DEPTH_TWO);
String result = performPost(uri);
List<Map<String, Object>> list = JsonHelper.jsonToList(result);
assertThat(list, notNullValue());
assertThat(list.size(), equalTo(1));
Map<String, Object> map = list.get(0);
assertThat((Integer) map.get("length"), equalTo(2));
}
use of org.neo4j.test.GraphDescription.Graph in project neo4j-documentation by neo4j.
the class ShortestPathDocIT method shouldReturnAllShortestPathsOnPost.
@Documented("Get shortest path.")
@Test
@Graph({ "A knows B", "B knew C", "A knows D", "D knows E", "E knows C" })
public void shouldReturnAllShortestPathsOnPost() throws JsonParseException {
Node source = data.get().get("C");
String sourceUri = functionalTestHelper.nodeUri(source.getId());
Node target = data.get().get("A");
String targetUri = functionalTestHelper.nodeUri(target.getId());
String uri = (String) getNodeLevelPluginMetadata(ShortestPath.class, source.getId()).get(SHORTEST_PATHS);
String body = "{\"target\":\"" + targetUri + "\"}";
String result = performPost(uri, body);
List<Map<String, Object>> list = JsonHelper.jsonToList(result);
assertThat(list, notNullValue());
assertThat(list.size(), equalTo(1));
Map<String, Object> map = list.get(0);
assertThat(map.get("start").toString(), containsString(sourceUri));
assertThat(map.get("end").toString(), containsString(targetUri));
assertThat((Integer) map.get("length"), equalTo(2));
}
Aggregations