Search in sources :

Example 16 with JaxRsResponse

use of org.neo4j.server.rest.JaxRsResponse in project neo4j by neo4j.

the class NeoServerDefaultPortAndHostnameIT method shouldDefaultToSensiblePortIfNoneSpecifiedInConfig.

@Test
public void shouldDefaultToSensiblePortIfNoneSpecifiedInConfig() throws Exception {
    FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(server());
    JaxRsResponse response = functionalTestHelper.get(functionalTestHelper.managementUri());
    assertThat(response.getStatus(), is(200));
}
Also used : FunctionalTestHelper(org.neo4j.server.helpers.FunctionalTestHelper) JaxRsResponse(org.neo4j.server.rest.JaxRsResponse) Test(org.junit.Test)

Example 17 with JaxRsResponse

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

Example 18 with JaxRsResponse

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

Example 19 with JaxRsResponse

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

Example 20 with JaxRsResponse

use of org.neo4j.server.rest.JaxRsResponse in project neo4j by neo4j.

the class RedirectToBrowserTest method shouldRedirectToBrowser.

@Test
public void shouldRedirectToBrowser() throws Exception {
    Client nonRedirectingClient = Client.create();
    nonRedirectingClient.setFollowRedirects(false);
    final JaxRsResponse response = new RestRequest(server.baseUri(), nonRedirectingClient).accept(MediaType.TEXT_HTML_TYPE).get(server.baseUri().toString());
    assertEquals(303, response.getStatus());
    assertEquals(new URI("http://localhost:7474/browser/"), response.getLocation());
    response.close();
}
Also used : RestRequest(org.neo4j.server.rest.RestRequest) JaxRsResponse(org.neo4j.server.rest.JaxRsResponse) Client(com.sun.jersey.api.client.Client) URI(java.net.URI) Test(org.junit.Test)

Aggregations

JaxRsResponse (org.neo4j.server.rest.JaxRsResponse)58 Test (org.junit.Test)52 RestRequest (org.neo4j.server.rest.RestRequest)29 Matchers.containsString (org.hamcrest.Matchers.containsString)19 FunctionalTestHelper (org.neo4j.server.helpers.FunctionalTestHelper)13 PrettyJSON (org.neo4j.server.rest.PrettyJSON)8 URI (java.net.URI)7 Documented (org.neo4j.kernel.impl.annotations.Documented)6 Map (java.util.Map)4 Client (com.sun.jersey.api.client.Client)3 Title (org.neo4j.test.TestData.Title)3 File (java.io.File)2 FileUtils.readTextFile (org.neo4j.io.fs.FileUtils.readTextFile)2 NeoServer (org.neo4j.server.NeoServer)2 HashMap (java.util.HashMap)1 ListenSocketAddress (org.neo4j.helpers.ListenSocketAddress)1 CommunityServerBuilder (org.neo4j.server.helpers.CommunityServerBuilder)1 BadInputException (org.neo4j.server.rest.repr.BadInputException)1 NodeRepresentationTest (org.neo4j.server.rest.repr.NodeRepresentationTest)1 RelationshipRepresentationTest (org.neo4j.server.rest.repr.RelationshipRepresentationTest)1