Search in sources :

Example 1 with RestRequest

use of org.neo4j.doc.server.rest.RestRequest 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)));
}
Also used : RestRequest(org.neo4j.doc.server.rest.RestRequest) JaxRsResponse(org.neo4j.doc.server.rest.JaxRsResponse) Client(com.sun.jersey.api.client.Client) Test(org.junit.Test)

Example 2 with RestRequest

use of org.neo4j.doc.server.rest.RestRequest in project neo4j-documentation by neo4j.

the class ServerConfigDocIT method shouldEnablConsoleServiceByDefault.

@Test
public void shouldEnablConsoleServiceByDefault() throws IOException {
    // Given
    server = server().usingDataDir(folder.directory(name.getMethodName()).getAbsolutePath()).build();
    server.start();
    // When & then
    assertEquals(200, new RestRequest().get("http://localhost:7474/db/manage/server/console").getStatus());
}
Also used : RestRequest(org.neo4j.doc.server.rest.RestRequest) Test(org.junit.Test)

Example 3 with RestRequest

use of org.neo4j.doc.server.rest.RestRequest in project neo4j-documentation by neo4j.

the class ServerConfigDocIT 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());
}
Also used : RestRequest(org.neo4j.doc.server.rest.RestRequest) Test(org.junit.Test)

Example 4 with RestRequest

use of org.neo4j.doc.server.rest.RestRequest 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();
}
Also used : RestRequest(org.neo4j.doc.server.rest.RestRequest) Matchers.containsString(org.hamcrest.Matchers.containsString) JaxRsResponse(org.neo4j.doc.server.rest.JaxRsResponse) Test(org.junit.Test)

Example 5 with RestRequest

use of org.neo4j.doc.server.rest.RestRequest 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());
}
Also used : RestRequest(org.neo4j.doc.server.rest.RestRequest) JaxRsResponse(org.neo4j.doc.server.rest.JaxRsResponse) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)19 RestRequest (org.neo4j.doc.server.rest.RestRequest)19 JaxRsResponse (org.neo4j.doc.server.rest.JaxRsResponse)17 URI (java.net.URI)4 Matchers.containsString (org.hamcrest.Matchers.containsString)4 FunctionalTestHelper (org.neo4j.doc.server.helpers.FunctionalTestHelper)3 Documented (org.neo4j.kernel.impl.annotations.Documented)3 File (java.io.File)2 FileUtils.readTextFile (org.neo4j.io.fs.FileUtils.readTextFile)2 NeoServer (org.neo4j.server.NeoServer)2 Client (com.sun.jersey.api.client.Client)1 Map (java.util.Map)1 CommunityWebContainerBuilder (org.neo4j.doc.server.helpers.CommunityWebContainerBuilder)1 PrettyJSON (org.neo4j.doc.server.rest.PrettyJSON)1 ListenSocketAddress (org.neo4j.helpers.ListenSocketAddress)1