use of org.neo4j.server.rest.RestRequest in project neo4j by neo4j.
the class PagedTraverserIT method shouldBeAbleToTraverseAllThePagesWithDefaultPageSize.
@Documented("Paging through the results of a paged traverser.\n\n" + "Paged traversers holdstate on the server, and allow clients to page through\n" + "the results of a traversal. To progress to the next page of traversal results,\n" + "the client issues a HTTP GET request on the paged traversal URI which causes the\n" + "traversal to fill the next page (or partially fill it if insufficient\n" + "results are available).\n" + " \n" + "Note that if a traverser expires through inactivity it will cause a 404\n" + "response on the next +GET+ request. Traversers' leases are renewed on\n" + "every successful access for the same amount of time as originally\n" + "specified.\n" + " \n" + "When the paged traverser reaches the end of its results, the client can\n" + "expect a 404 response as the traverser is disposed by the server.")
@Test
public void shouldBeAbleToTraverseAllThePagesWithDefaultPageSize() {
theStartNode = createLinkedList(LONG_LIST_LENGTH, server.getDatabase());
URI traverserLocation = createPagedTraverser().getLocation();
int enoughPagesToExpireTheTraverser = 3;
for (int i = 0; i < enoughPagesToExpireTheTraverser; i++) {
gen.get().expectedType(MediaType.APPLICATION_JSON_TYPE).expectedStatus(200).payload(traverserDescription()).get(traverserLocation.toString());
}
JaxRsResponse response = new RestRequest(traverserLocation).get();
assertEquals(404, response.getStatus());
}
use of org.neo4j.server.rest.RestRequest in project neo4j by neo4j.
the class PagedTraverserIT method shouldExpireTraverserWithNonDefaultTimeout.
@Documented("Paged traverser timeout.\n\n" + "The default timeout for a paged traverser is 60\n" + "seconds, but depending on the application larger or smaller timeouts\n" + "might be appropriate. This can be set by adding a +leaseTime+ query\n" + "parameter with the number of seconds the paged traverser should last.")
@Test
public void shouldExpireTraverserWithNonDefaultTimeout() {
theStartNode = createLinkedList(SHORT_LIST_LENGTH, server.getDatabase());
URI traverserLocation = createPagedTraverserWithTimeoutInMinutes(10).getLocation();
clock.forward(11, TimeUnit.MINUTES);
JaxRsResponse response = new RestRequest(traverserLocation).get();
assertEquals(404, response.getStatus());
}
use of org.neo4j.server.rest.RestRequest in project neo4j by neo4j.
the class NeoServerJAXRSIT method shouldMakeJAXRSClassesAvailableViaHTTP.
@Test
public void shouldMakeJAXRSClassesAvailableViaHTTP() throws Exception {
CommunityServerBuilder builder = CommunityServerBuilder.server();
server = ServerHelper.createNonPersistentServer(builder);
FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(server);
JaxRsResponse response = new RestRequest().get(functionalTestHelper.managementUri());
assertEquals(200, response.getStatus());
response.close();
}
use of org.neo4j.server.rest.RestRequest in project neo4j by neo4j.
the class NeoServerStartupLoggingIT method shouldLogStartup.
@Test
public void shouldLogStartup() throws Exception {
// Check the logs
assertThat(out.toString().length(), is(greaterThan(0)));
// Check the server is alive
Client nonRedirectingClient = Client.create();
nonRedirectingClient.setFollowRedirects(false);
final JaxRsResponse response = new RestRequest(server.baseUri(), nonRedirectingClient).get();
assertThat(response.getStatus(), is(greaterThan(199)));
}
use of org.neo4j.server.rest.RestRequest in project neo4j by neo4j.
the class RedirectToBrowserTest method shouldRedirectToBrowserUsingXForwardedHeaders.
@Test
public void shouldRedirectToBrowserUsingXForwardedHeaders() throws Exception {
Client nonRedirectingClient = Client.create();
nonRedirectingClient.setFollowRedirects(false);
final JaxRsResponse response = new RestRequest(server.baseUri(), nonRedirectingClient).accept(MediaType.TEXT_HTML_TYPE).header("X-Forwarded-Host", "foo.bar:8734").header("X-Forwarded-Proto", "https").get(server.baseUri().toString());
assertEquals(303, response.getStatus());
assertEquals(new URI("https://foo.bar:8734/browser/"), response.getLocation());
response.close();
}
Aggregations