use of org.neo4j.server.rest.RestRequest in project neo4j by neo4j.
the class ServerConfigIT method shouldDisableConsoleServiceWhenAskedTo.
@Test
public void shouldDisableConsoleServiceWhenAskedTo() throws IOException {
// Given
server = server().withProperty(ServerSettings.console_module_enabled.name(), "false").usingDataDir(folder.directory(name.getMethodName()).getAbsolutePath()).build();
server.start();
// When & then
assertEquals(404, new RestRequest().get("http://localhost:7474/db/manage/server/console").getStatus());
}
use of org.neo4j.server.rest.RestRequest in project neo4j by neo4j.
the class ServerConfigIT method shouldPickupRelativeUrisForMangementApiAndRestApi.
@Test
public void shouldPickupRelativeUrisForMangementApiAndRestApi() throws IOException {
String dataUri = "/a/different/data/uri/";
String managementUri = "/a/different/management/uri/";
server = server().withRelativeRestApiUriPath(dataUri).usingDataDir(folder.directory(name.getMethodName()).getAbsolutePath()).withRelativeManagementApiUriPath(managementUri).build();
server.start();
JaxRsResponse response = new RestRequest().get("http://localhost:7474" + dataUri, MediaType.TEXT_HTML_TYPE);
assertEquals(200, response.getStatus());
response = new RestRequest().get("http://localhost:7474" + managementUri);
assertEquals(200, response.getStatus());
response.close();
}
use of org.neo4j.server.rest.RestRequest 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.server.rest.RestRequest in project neo4j by neo4j.
the class PagedTraverserIT method shouldExpireTheTraverserAfterDefaultTimeoutAndGetA404Response.
@Test
public void shouldExpireTheTraverserAfterDefaultTimeoutAndGetA404Response() {
theStartNode = createLinkedList(SHORT_LIST_LENGTH, server.getDatabase());
JaxRsResponse postResponse = createPagedTraverser();
assertEquals(201, postResponse.getStatus());
final int TEN_MINUTES = 10;
clock.forward(TEN_MINUTES, TimeUnit.MINUTES);
JaxRsResponse getResponse = new RestRequest(postResponse.getLocation()).get();
assertEquals(404, getResponse.getStatus());
}
use of org.neo4j.server.rest.RestRequest in project neo4j by neo4j.
the class PagedTraverserIT method shouldTraverseAllPagesWithANonDefaultTimeoutAndNonDefaultPageSize.
@Test
public void shouldTraverseAllPagesWithANonDefaultTimeoutAndNonDefaultPageSize() {
theStartNode = createLinkedList(SHORT_LIST_LENGTH, server.getDatabase());
URI traverserLocation = createPagedTraverserWithTimeoutInMinutesAndPageSize(10, 2).getLocation();
int enoughPagesToExpireTheTraverser = 6;
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());
}
Aggregations