use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class NeoServerDefaultPortAndHostnameDocIT method shouldDefaultToSensiblePortIfNoneSpecifiedInConfig.
@Test
public void shouldDefaultToSensiblePortIfNoneSpecifiedInConfig() throws Exception {
FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(server());
JaxRsResponse response = functionalTestHelper.get(functionalTestHelper.managementUri());
assertThat(response.getStatus(), is(200));
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class NeoServerStartupLoggingDocIT 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.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class ServerConfigDocIT 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.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class ServerConfigDocIT method shouldNotGenerateWADLWhenNotExplicitlyEnabledInConfig.
@Test
public void shouldNotGenerateWADLWhenNotExplicitlyEnabledInConfig() throws IOException {
server = server().usingDataDir(folder.directory(name.getMethodName()).getAbsolutePath()).build();
server.start();
JaxRsResponse response = new RestRequest().get("http://localhost:7474/application.wadl", MediaType.WILDCARD_TYPE);
assertEquals(404, response.getStatus());
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class ServerConfigDocIT method shouldHaveSandboxingEnabledByDefault.
@Test
public void shouldHaveSandboxingEnabledByDefault() throws Exception {
// Given
server = server().usingDataDir(folder.directory(name.getMethodName()).getAbsolutePath()).build();
server.start();
String node = POST(server.baseUri().toASCIIString() + "db/data/node").location();
// When
JaxRsResponse response = new RestRequest().post(node + "/traverse/node", "{\n" + " \"order\" : \"breadth_first\",\n" + " \"return_filter\" : {\n" + " \"body\" : \"position.getClass().getClassLoader()\",\n" + " \"language\" : \"javascript\"\n" + " },\n" + " \"prune_evaluator\" : {\n" + " \"body\" : \"position.getClass().getClassLoader()\",\n" + " \"language\" : \"javascript\"\n" + " },\n" + " \"uniqueness\" : \"node_global\",\n" + " \"relationships\" : [ {\n" + " \"direction\" : \"all\",\n" + " \"type\" : \"knows\"\n" + " }, {\n" + " \"direction\" : \"all\",\n" + " \"type\" : \"loves\"\n" + " } ],\n" + " \"max_depth\" : 3\n" + "}", MediaType.APPLICATION_JSON_TYPE);
// Then
assertEquals(400, response.getStatus());
}
Aggregations