use of org.neo4j.test.TestData.Title 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.TestData.Title 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.TestData.Title 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();
}
use of org.neo4j.test.TestData.Title in project neo4j by neo4j.
the class RelationshipIT 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().expectedStatus(Status.NO_CONTENT.getStatusCode()).delete(getRelationshipUri(loves)).entity();
}
use of org.neo4j.test.TestData.Title in project neo4j by neo4j.
the class SecurityRulesIT method aSimpleWildcardUriPathShould401OnAccessToProtectedSubPath.
@Test
@Title("Using Wildcards to Target Security Rules")
@Documented("In this example, a security rule is registered to deny\n" + "access to all URIs to the server by listing the rule(s) class(es) in\n" + "'neo4j.conf'.\n" + "In this case, the rule is registered\n" + "using a wildcard URI path (where `*` characters can be used to signify\n" + "any part of the path). For example `/users*` means the rule\n" + "will be bound to any resources under the `/users` root path. Similarly\n" + "`/users*type*` will bind the rule to resources matching\n" + "URIs like `/users/fred/type/premium`.\n" + "\n" + "@@config\n" + "\n" + "with the rule source code of:\n" + "\n" + "@@failingRuleWithWildcardPath\n" + "\n" + "With this rule registered, any access to URIs under /protected/ will be\n" + "denied by the server. Using wildcards allows flexible targeting of security rules to\n" + "arbitrary parts of the server's API, including any unmanaged extensions or managed\n" + "plugins that have been registered.")
public void aSimpleWildcardUriPathShould401OnAccessToProtectedSubPath() throws Exception {
String mountPoint = "/protected/tree/starts/here" + DummyThirdPartyWebService.DUMMY_WEB_SERVICE_MOUNT_POINT;
server = CommunityServerBuilder.server().withDefaultDatabaseTuning().withThirdPartyJaxRsPackage("org.dummy.web.service", mountPoint).withSecurityRules(PermanentlyFailingSecurityRuleWithWildcardPath.class.getCanonicalName()).usingDataDir(folder.directory(name.getMethodName()).getAbsolutePath()).build();
server.start();
functionalTestHelper = new FunctionalTestHelper(server);
JaxRsResponse clientResponse = gen.get().expectedStatus(401).expectedType(MediaType.APPLICATION_JSON_TYPE).expectedHeader("WWW-Authenticate").get(trimTrailingSlash(functionalTestHelper.baseUri()) + mountPoint + "/more/stuff").response();
assertEquals(401, clientResponse.getStatus());
}
Aggregations