use of org.neo4j.test.GraphDescription.Graph in project neo4j by neo4j.
the class CypherIT method testDataColumnOrder.
/**
* Ensure that order of data and column is ok.
*/
@Test
@Graph(nodes = { @NODE(name = "I", setNameProperty = true), @NODE(name = "you", setNameProperty = true), @NODE(name = "him", setNameProperty = true, properties = { @PROP(key = "age", value = "25", type = GraphDescription.PropType.INTEGER) }) }, relationships = { @REL(start = "I", end = "him", type = "know", properties = {}), @REL(start = "I", end = "you", type = "know", properties = {}) })
public void testDataColumnOrder() throws UnsupportedEncodingException {
String script = createScript("MATCH (x)-[r]->(n) WHERE id(x) = %I% RETURN type(r), n.name, n.age");
String response = cypherRestCall(script, Status.OK);
assertThat(response.indexOf("columns") < response.indexOf("data"), is(true));
}
use of org.neo4j.test.GraphDescription.Graph 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.test.GraphDescription.Graph in project neo4j by neo4j.
the class CypherIT method array_property.
@Test
@Graph(value = { "I know you" }, autoIndexNodes = false)
public void array_property() throws Exception {
setProperty("I", "array1", new int[] { 1, 2, 3 });
setProperty("I", "array2", new String[] { "a", "b", "c" });
String script = "MATCH (n) WHERE id(n) = %I% RETURN n.array1, n.array2";
String response = cypherRestCall(script, Status.OK);
assertThat(response, anyOf(containsString("[ 1, 2, 3 ]"), containsString("[1,2,3]")));
assertThat(response, anyOf(containsString("[ \"a\", \"b\", \"c\" ]"), containsString("[\"a\",\"b\",\"c\"]")));
}
use of org.neo4j.test.GraphDescription.Graph 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.test.GraphDescription.Graph 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();
}
Aggregations