Search in sources :

Example 56 with Documented

use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.

the class LabelsIT method removing_a_non_existent_label_from_a_node.

@Documented("Removing a non-existent label from a node.")
@Test
@GraphDescription.Graph(nodes = { @NODE(name = "Clint Eastwood", setNameProperty = true) })
public void removing_a_non_existent_label_from_a_node() throws PropertyValueException {
    Map<String, Node> nodes = data.get();
    Node node = nodes.get("Clint Eastwood");
    String nodeUri = getNodeUri(node);
    String labelName = "Person";
    gen.get().expectedStatus(204).delete(nodeUri + "/labels/" + labelName);
    assertThat(node, inTx(graphdb(), not(hasLabel(label(labelName)))));
}
Also used : Node(org.neo4j.graphdb.Node) Documented(org.neo4j.kernel.impl.annotations.Documented) Test(org.junit.Test)

Example 57 with Documented

use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.

the class LabelsIT method removing_a_label_from_a_node.

@Documented("Removing a label from a node.")
@Test
@GraphDescription.Graph(nodes = { @NODE(name = "Clint Eastwood", setNameProperty = true, labels = { @LABEL("Person") }) })
public void removing_a_label_from_a_node() throws PropertyValueException {
    Map<String, Node> nodes = data.get();
    Node node = nodes.get("Clint Eastwood");
    String nodeUri = getNodeUri(node);
    String labelName = "Person";
    gen.get().expectedStatus(204).delete(nodeUri + "/labels/" + labelName);
    assertThat(node, inTx(graphdb(), not(hasLabel(label(labelName)))));
}
Also used : Node(org.neo4j.graphdb.Node) Documented(org.neo4j.kernel.impl.annotations.Documented) Test(org.junit.Test)

Example 58 with Documented

use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.

the class RelationshipIT method shouldReturn404WhenPropertyWhichDoesNotExistRemovedFromRelationship.

@Test
@Title("Remove non-existent property from a relationship")
@Documented("Attempting to remove a property that doesn't exist results in an error.")
@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 shouldReturn404WhenPropertyWhichDoesNotExistRemovedFromRelationship() {
    data.get();
    Relationship loves = getFirstRelationshipFromRomeoNode();
    gen().expectedStatus(Status.NOT_FOUND.getStatusCode()).delete(getPropertiesUri(loves) + "/non-existent").entity();
}
Also used : Relationship(org.neo4j.graphdb.Relationship) Graph(org.neo4j.test.GraphDescription.Graph) Documented(org.neo4j.kernel.impl.annotations.Documented) Test(org.junit.Test) Title(org.neo4j.test.TestData.Title)

Example 59 with Documented

use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.

the class RetrieveRelationshipsFromNodeIT method shouldRespondWith200AndListOfRelationshipRepresentationsWhenGettingAllRelationshipsForANode.

@Documented("Get all relationships.")
@Test
public void shouldRespondWith200AndListOfRelationshipRepresentationsWhenGettingAllRelationshipsForANode() throws JsonParseException {
    String entity = gen.get().expectedStatus(200).get(functionalTestHelper.nodeUri() + "/" + nodeWithRelationships + "/relationships" + "/all").entity();
    verifyRelReps(3, entity);
}
Also used : Matchers.containsString(org.hamcrest.Matchers.containsString) Documented(org.neo4j.kernel.impl.annotations.Documented) RelationshipRepresentationTest(org.neo4j.server.rest.repr.RelationshipRepresentationTest) Test(org.junit.Test)

Example 60 with Documented

use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.

the class RetrieveNodeIT method shouldGet200WhenRetrievingNodeCompact.

@Documented("Get node -- compact.\n" + "\n" + "Specifying the subformat in the requests media type yields a more compact\n" + "JSON response without metadata and templates.")
@Test
public void shouldGet200WhenRetrievingNodeCompact() {
    String uri = nodeUri.toString();
    ResponseEntity entity = gen.get().expectedType(CompactJsonFormat.MEDIA_TYPE).expectedStatus(200).get(uri);
    assertTrue(entity.entity().contains("self"));
}
Also used : ResponseEntity(org.neo4j.server.rest.RESTRequestGenerator.ResponseEntity) Matchers.containsString(org.hamcrest.Matchers.containsString) Documented(org.neo4j.kernel.impl.annotations.Documented) Test(org.junit.Test)

Aggregations

Documented (org.neo4j.kernel.impl.annotations.Documented)71 Test (org.junit.Test)70 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)26 Graph (org.neo4j.test.GraphDescription.Graph)21 ResponseEntity (org.neo4j.server.rest.RESTRequestGenerator.ResponseEntity)20 Title (org.neo4j.test.TestData.Title)19 Node (org.neo4j.graphdb.Node)14 Matchers.containsString (org.hamcrest.Matchers.containsString)11 Transaction (org.neo4j.graphdb.Transaction)8 RelationshipRepresentationTest (org.neo4j.server.rest.repr.RelationshipRepresentationTest)7 JsonNode (org.codehaus.jackson.JsonNode)6 JaxRsResponse (org.neo4j.server.rest.JaxRsResponse)6 RESTRequestGenerator (org.neo4j.server.rest.RESTRequestGenerator)6 ArrayList (java.util.ArrayList)5 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)5 Relationship (org.neo4j.graphdb.Relationship)5 Map (java.util.Map)4 URI (java.net.URI)3 FunctionalTestHelper (org.neo4j.server.helpers.FunctionalTestHelper)3 RestRequest (org.neo4j.server.rest.RestRequest)3