use of org.neo4j.test.GraphDescription.Graph in project neo4j by neo4j.
the class RelationshipIT method shouldReturn204WhenPropertiesAreRemovedFromRelationship.
@Test
@Title("Remove properties from a relationship")
@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 shouldReturn204WhenPropertiesAreRemovedFromRelationship() {
Relationship loves = getFirstRelationshipFromRomeoNode();
gen().expectedStatus(Status.NO_CONTENT.getStatusCode()).delete(functionalTestHelper.relationshipPropertiesUri(loves.getId())).entity();
}
use of org.neo4j.test.GraphDescription.Graph in project neo4j by neo4j.
the class RelationshipIT 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 by neo4j.
the class RelationshipIT method set_all_properties_on_a_relationship.
@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), @PROP(key = "since", value = "1day", type = GraphDescription.PropType.STRING) }) })
public void set_all_properties_on_a_relationship() throws Exception {
Relationship loves = getFirstRelationshipFromRomeoNode();
assertThat(loves, inTx(graphdb(), hasProperty("cost").withValue("high")));
gen().expectedStatus(ClientResponse.Status.NO_CONTENT).payload(JsonHelper.createJsonFrom(MapUtil.map("happy", false))).put(getRelPropsURI(loves)).entity();
assertThat(loves, inTx(graphdb(), hasProperty("happy").withValue(false)));
assertThat(loves, inTx(graphdb(), not(hasProperty("cost"))));
}
use of org.neo4j.test.GraphDescription.Graph in project neo4j by neo4j.
the class SetNodePropertiesIT method shouldReturn204WhenPropertyIsSet.
@Documented("Set property on node.\n" + "\n" + "Setting different properties will retain the existing ones for this node.\n" + "Note that a single value are submitted not as a map but just as a value\n" + "(which is valid JSON) like in the example\n" + "below.")
@Graph(nodes = { @NODE(name = "jim", properties = { @PROP(key = "foo2", value = "bar2") }) })
@Test
public void shouldReturn204WhenPropertyIsSet() throws Exception {
Node jim = data.get().get("jim");
gen.get().payload(JsonHelper.createJsonFrom("bar")).expectedStatus(204).put(getPropertyUri(jim, "foo").toString());
assertThat(jim, inTx(graphdb(), hasProperty("foo")));
assertThat(jim, inTx(graphdb(), hasProperty("foo2")));
}
use of org.neo4j.test.GraphDescription.Graph in project neo4j by neo4j.
the class SetNodePropertiesIT method shouldReturn204WhenPropertiesAreUpdated.
@Graph("jim knows joe")
@Documented("Update node properties.\n" + "\n" + "This will replace all existing properties on the node with the new set\n" + "of attributes.")
@Test
public void shouldReturn204WhenPropertiesAreUpdated() throws JsonParseException {
Node jim = data.get().get("jim");
assertThat(jim, inTx(graphdb(), not(hasProperty("age"))));
gen.get().payload(JsonHelper.createJsonFrom(MapUtil.map("age", "18"))).expectedStatus(204).put(getPropertiesUri(jim));
assertThat(jim, inTx(graphdb(), hasProperty("age").withValue("18")));
}
Aggregations