use of org.neo4j.server.rest.JaxRsResponse in project neo4j by neo4j.
the class ServerConfigIT 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.server.rest.JaxRsResponse in project neo4j by neo4j.
the class HTTPLoggingIT method givenExplicitlyEnabledServerLoggingConfigurationShouldLogAccess.
@Test
public void givenExplicitlyEnabledServerLoggingConfigurationShouldLogAccess() throws Exception {
// given
String directoryPrefix = testName.getMethodName();
File logDirectory = testDirectory.directory(directoryPrefix + "-logdir");
final String query = "?explicitlyEnabled=" + randomString();
NeoServer server = CommunityServerBuilder.server().withDefaultDatabaseTuning().persistent().withProperty(ServerSettings.http_logging_enabled.name(), Settings.TRUE).withProperty(GraphDatabaseSettings.logs_directory.name(), logDirectory.getAbsolutePath()).usingDataDir(testDirectory.directory(directoryPrefix + "-dbdir").getAbsolutePath()).build();
try {
server.start();
FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(server);
// when
JaxRsResponse response = new RestRequest().get(functionalTestHelper.managementUri() + query);
assertThat(response.getStatus(), is(HttpStatus.SC_OK));
response.close();
// then
File httpLog = new File(logDirectory, "http.log");
assertEventually("request appears in log", fileContentSupplier(httpLog), containsString(query), 5, TimeUnit.SECONDS);
} finally {
server.stop();
}
}
use of org.neo4j.server.rest.JaxRsResponse in project neo4j by neo4j.
the class CollectUserAgentFilterIT method sendRequest.
private void sendRequest(String userAgent) {
String url = functionalTestHelper.baseUri().toString();
JaxRsResponse resp = RestRequest.req().header("User-Agent", userAgent).get(url);
String json = resp.getEntity();
resp.close();
assertEquals(json, 200, resp.getStatus());
}
use of org.neo4j.server.rest.JaxRsResponse in project neo4j by neo4j.
the class PluginFunctionalTestHelper method makePostList.
protected static List<Map<String, Object>> makePostList(String url, Map<String, Object> params) throws JsonParseException {
String json = JsonHelper.createJsonFrom(params);
JaxRsResponse response = new RestRequest().post(url, json);
String body = getResponseText(response);
response.close();
return deserializeList(body);
}
use of org.neo4j.server.rest.JaxRsResponse in project neo4j by neo4j.
the class PluginFunctionalTestHelper method makeGet.
public static Map<String, Object> makeGet(String url) throws JsonParseException {
JaxRsResponse response = new RestRequest().get(url);
String body = getResponseText(response);
response.close();
return deserializeMap(body);
}
Aggregations