use of org.neo4j.server.NeoServer in project neo4j by neo4j.
the class HTTPLoggingIT method givenExplicitlyDisabledServerLoggingConfigurationShouldNotLogAccesses.
@Test
public void givenExplicitlyDisabledServerLoggingConfigurationShouldNotLogAccesses() throws Exception {
// given
String directoryPrefix = testName.getMethodName();
File logDirectory = testDirectory.directory(directoryPrefix + "-logdir");
NeoServer server = CommunityServerBuilder.server().withDefaultDatabaseTuning().persistent().withProperty(ServerSettings.http_logging_enabled.name(), Settings.FALSE).withProperty(GraphDatabaseSettings.logs_directory.name(), logDirectory.toString()).usingDataDir(testDirectory.directory(directoryPrefix + "-dbdir").getAbsolutePath()).build();
try {
server.start();
FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(server);
// when
String query = "?implicitlyDisabled" + randomString();
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");
assertThat(httpLog.exists(), is(false));
} finally {
server.stop();
}
}
use of org.neo4j.server.NeoServer in project neo4j by neo4j.
the class EnterpriseServerIT method shouldRequireAuthorizationForHAStatusEndpoints.
@Test
public void shouldRequireAuthorizationForHAStatusEndpoints() throws Exception {
// Given
NeoServer server = EnterpriseServerBuilder.server().withProperty(GraphDatabaseSettings.auth_enabled.name(), "true").usingDataDir(folder.getRoot().getAbsolutePath()).withProperty(mode.name(), "HA").withProperty(server_id.name(), "1").withProperty(initial_hosts.name(), ":5001").persistent().build();
try {
server.start();
server.getDatabase();
assertThat(server.getDatabase().getGraph(), is(instanceOf(HighlyAvailableGraphDatabase.class)));
Client client = Client.create();
ClientResponse r = client.resource("http://localhost:7474/db/manage/server/ha").accept(APPLICATION_JSON).get(ClientResponse.class);
assertEquals(401, r.getStatus());
} finally {
server.stop();
}
}
use of org.neo4j.server.NeoServer in project neo4j by neo4j.
the class EnterpriseServerIT method shouldAllowDisablingAuthorizationOnHAStatusEndpoints.
@Test
public void shouldAllowDisablingAuthorizationOnHAStatusEndpoints() throws Exception {
// Given
NeoServer server = EnterpriseServerBuilder.server().withProperty(GraphDatabaseSettings.auth_enabled.name(), "true").withProperty(HaSettings.ha_status_auth_enabled.name(), "false").usingDataDir(folder.getRoot().getAbsolutePath()).withProperty(mode.name(), "HA").withProperty(server_id.name(), "1").withProperty(initial_hosts.name(), ":5001").persistent().build();
try {
server.start();
server.getDatabase();
assertThat(server.getDatabase().getGraph(), is(instanceOf(HighlyAvailableGraphDatabase.class)));
Client client = Client.create();
ClientResponse r = client.resource("http://localhost:7474/db/manage/server/ha").accept(APPLICATION_JSON).get(ClientResponse.class);
assertEquals(200, r.getStatus());
assertThat(r.getEntity(String.class), containsString("master"));
} finally {
server.stop();
}
}
use of org.neo4j.server.NeoServer in project neo4j by neo4j.
the class ServerHelper method createServer.
private static NeoServer createServer(CommunityServerBuilder builder, boolean persistent, File path) throws IOException {
if (persistent) {
builder = builder.persistent();
}
NeoServer server = builder.usingDataDir(path != null ? path.getAbsolutePath() : null).build();
checkServerCanStart(server.baseUri().getHost(), server.baseUri().getPort());
server.start();
return server;
}
use of org.neo4j.server.NeoServer in project neo4j by neo4j.
the class ExtensionInitializerTest method testPluginInitialization.
@Test
public void testPluginInitialization() {
Config config = Config.embeddedDefaults(stringMap(ServerSettings.transaction_idle_timeout.name(), "600"));
NeoServer neoServer = Mockito.mock(NeoServer.class, Mockito.RETURNS_DEEP_STUBS);
Mockito.when(neoServer.getConfig()).thenReturn(config);
ExtensionInitializer extensionInitializer = new ExtensionInitializer(neoServer);
Collection<Injectable<?>> injectableProperties = extensionInitializer.initializePackages(Arrays.asList("org.neo4j.server.modules"));
assertTrue(injectableProperties.stream().anyMatch(i -> ServerSettings.transaction_idle_timeout.name().equals(i.getValue())));
}
Aggregations