use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class ServerConfigDocIT method shouldPickUpAddressFromConfig.
@Test
public void shouldPickUpAddressFromConfig() throws Exception {
ListenSocketAddress nonDefaultAddress = new ListenSocketAddress("0.0.0.0", 4321);
server = server().onAddress(nonDefaultAddress).usingDataDir(folder.directory(name.getMethodName()).getAbsolutePath()).build();
server.start();
assertEquals(nonDefaultAddress, server.getAddress());
JaxRsResponse response = new RestRequest(server.baseUri()).get();
assertThat(response.getStatus(), is(200));
response.close();
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class PagedTraverserDocIT method should201WithAcceptJsonHeader.
@Test
public void should201WithAcceptJsonHeader() {
// given
theStartNode = createLinkedList(SHORT_LIST_LENGTH, server.getDatabase());
String uri = functionalTestHelper.nodeUri(theStartNode.getId()) + "/paged/traverse/node";
// when
JaxRsResponse response = RestRequest.req().accept(MediaType.APPLICATION_JSON_TYPE).post(uri, traverserDescription());
// then
assertEquals(201, response.getStatus());
assertNotNull(response.getHeaders().getFirst("Content-Type"));
assertThat(response.getType().toString(), containsString(MediaType.APPLICATION_JSON));
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class PagedTraverserDocIT method shouldRespondWith200OnFirstDeletionOfTraversalAnd404Afterwards.
@Test
public void shouldRespondWith200OnFirstDeletionOfTraversalAnd404Afterwards() {
theStartNode = createLinkedList(SHORT_LIST_LENGTH, server.getDatabase());
JaxRsResponse response = createPagedTraverser();
final RestRequest request = RestRequest.req();
JaxRsResponse deleteResponse = request.delete(response.getLocation());
assertEquals(200, deleteResponse.getStatus());
deleteResponse = request.delete(response.getLocation());
assertEquals(404, deleteResponse.getStatus());
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class PagedTraverserDocIT 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.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class PagedTraverserDocIT method shouldRespondWith400OnNegativePageSize.
@Test
public void shouldRespondWith400OnNegativePageSize() {
theStartNode = createLinkedList(SHORT_LIST_LENGTH, server.getDatabase());
int negativePageSize = -99;
JaxRsResponse response = RestRequest.req().post(functionalTestHelper.nodeUri(theStartNode.getId()) + "/paged/traverse/node?pageSize=" + String.valueOf(negativePageSize), traverserDescription());
assertEquals(400, response.getStatus());
}
Aggregations