use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class ServerConfigDocIT method shouldGenerateWADLWhenExplicitlyEnabledInConfig.
@Test
public void shouldGenerateWADLWhenExplicitlyEnabledInConfig() throws IOException {
server = server().withProperty(ServerSettings.wadl_enabled.name(), "true").usingDataDir(folder.directory(name.getMethodName()).getAbsolutePath()).build();
server.start();
JaxRsResponse response = new RestRequest().get("http://localhost:7474/application.wadl", MediaType.WILDCARD_TYPE);
assertEquals(200, response.getStatus());
assertEquals("application/vnd.sun.wadl+xml", response.getHeaders().get("Content-Type").iterator().next());
assertThat(response.getEntity(), containsString("<application xmlns=\"http://wadl.dev.java" + ".net/2009/02\">"));
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class PagedTraverserDocIT method shouldAcceptJsonAndStreamingFlagAndProduceStreamedJson.
@Test
public void shouldAcceptJsonAndStreamingFlagAndProduceStreamedJson() {
// given
theStartNode = createLinkedList(SHORT_LIST_LENGTH, server.getDatabase());
// when
JaxRsResponse pagedTraverserResponse = createStreamingPagedTraverserWithTimeoutInMinutesAndPageSize(60, 1);
System.out.println(pagedTraverserResponse.getHeaders().getFirst("Content-Type"));
// then
assertNotNull(pagedTraverserResponse.getHeaders().getFirst("Content-Type"));
assertThat(pagedTraverserResponse.getHeaders().getFirst("Content-Type"), containsString("application/json; charset=UTF-8; stream=true"));
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class PagedTraverserDocIT 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());
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class PagedTraverserDocIT method nodeRepresentationShouldHaveLinkToPagedTraverser.
@Test
public void nodeRepresentationShouldHaveLinkToPagedTraverser() throws Exception {
theStartNode = createLinkedList(SHORT_LIST_LENGTH, server.getDatabase());
JaxRsResponse response = RestRequest.req().get(functionalTestHelper.nodeUri(theStartNode.getId()));
Map<String, Object> jsonMap = JsonHelper.jsonToMap(response.getEntity());
assertNotNull(jsonMap.containsKey(PAGED_TRAVERSE_LINK_REL));
assertThat(String.valueOf(jsonMap.get(PAGED_TRAVERSE_LINK_REL)), containsString("/db/data/node/" + String.valueOf(theStartNode.getId()) + "/paged/traverse/{returnType}{?pageSize,leaseTime}"));
}
use of org.neo4j.doc.server.rest.JaxRsResponse in project neo4j-documentation by neo4j.
the class PagedTraverserDocIT method should201WithAcceptHtmlHeader.
@Test
public void should201WithAcceptHtmlHeader() {
// given
theStartNode = createLinkedList(SHORT_LIST_LENGTH, server.getDatabase());
String uri = functionalTestHelper.nodeUri(theStartNode.getId()) + "/paged/traverse/node";
// when
JaxRsResponse response = RestRequest.req().accept(MediaType.TEXT_HTML_TYPE).post(uri, traverserDescription());
// then
assertEquals(201, response.getStatus());
assertNotNull(response.getHeaders().getFirst("Content-Type"));
assertThat(response.getType().toString(), containsString(MediaType.TEXT_HTML));
}
Aggregations