use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class RetrieveRelationshipsFromNodeIT method shouldRespondWith200AndListOfRelationshipRepresentationsWhenGettingIncomingRelationshipsForANode.
@Documented("Get incoming relationships.")
@Test
public void shouldRespondWith200AndListOfRelationshipRepresentationsWhenGettingIncomingRelationshipsForANode() throws JsonParseException {
String entity = gen.get().expectedStatus(200).get(functionalTestHelper.nodeUri() + "/" + nodeWithRelationships + "/relationships" + "/in").entity();
verifyRelReps(1, entity);
}
use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class RetrieveRelationshipsFromNodeIT method shouldRespondWith200AndListOfRelationshipRepresentationsWhenGettingAllTypedRelationshipsForANode.
@Documented("Get typed relationships.\n" + "\n" + "Note that the \"+&+\" needs to be encoded like \"+%26+\" for example when\n" + "using http://curl.haxx.se/[cURL] from the terminal.")
@Test
public void shouldRespondWith200AndListOfRelationshipRepresentationsWhenGettingAllTypedRelationshipsForANode() throws JsonParseException {
String entity = gen.get().expectedStatus(200).get(functionalTestHelper.nodeUri() + "/" + nodeWithRelationships + "/relationships" + "/all/LIKES&HATES").entity();
verifyRelReps(3, entity);
}
use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class PagedTraverserIT method shouldBeAbleToTraverseAllThePagesWithNonDefaultPageSize.
@Documented("Paged traverser page size.\n\n" + "The default page size is 50 items, but\n" + "depending on the application larger or smaller pages sizes might be\n" + "appropriate. This can be set by adding a +pageSize+ query parameter.")
@Test
public void shouldBeAbleToTraverseAllThePagesWithNonDefaultPageSize() {
theStartNode = createLinkedList(SHORT_LIST_LENGTH, server.getDatabase());
URI traverserLocation = createPagedTraverserWithPageSize(1).getLocation();
int enoughPagesToExpireTheTraverser = 12;
for (int i = 0; i < enoughPagesToExpireTheTraverser; i++) {
JaxRsResponse response = new RestRequest(traverserLocation).get();
assertEquals(200, response.getStatus());
}
JaxRsResponse response = new RestRequest(traverserLocation).get();
assertEquals(404, response.getStatus());
}
use of org.neo4j.kernel.impl.annotations.Documented in project neo4j by neo4j.
the class PagedTraverserIT method shouldPostATraverserWithDefaultOptionsAndReceiveTheFirstPageOfResults.
@Documented("Creating a paged traverser.\n\n" + "Paged traversers are created by ++POST++-ing a\n" + "traversal description to the link identified by the +paged_traverser+ key\n" + "in a node representation. When creating a paged traverser, the same\n" + "options apply as for a regular traverser, meaning that +node+, +path+,\n" + "or +fullpath+, can be targeted.")
@Test
public void shouldPostATraverserWithDefaultOptionsAndReceiveTheFirstPageOfResults() throws Exception {
theStartNode = createLinkedList(SHORT_LIST_LENGTH, server.getDatabase());
ResponseEntity entity = gen.get().expectedType(MediaType.valueOf("application/json; charset=UTF-8")).expectedHeader("Location").expectedStatus(201).payload(traverserDescription()).payloadType(MediaType.APPLICATION_JSON_TYPE).post(functionalTestHelper.nodeUri(theStartNode.getId()) + "/paged/traverse/node");
assertEquals(201, entity.response().getStatus());
assertThat(entity.response().getLocation().toString(), containsString("/db/data/node/" + theStartNode.getId() + "/paged/traverse/node/"));
assertEquals("application/json; charset=UTF-8", entity.response().getType().toString());
}
use of org.neo4j.kernel.impl.annotations.Documented 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