use of org.neo4j.server.helpers.FunctionalTestHelper in project neo4j by neo4j.
the class GetRelationshipPropertiesIT method setupServer.
@BeforeClass
public static void setupServer() throws IOException {
functionalTestHelper = new FunctionalTestHelper(server());
helper = functionalTestHelper.getGraphDbHelper();
setupTheDatabase();
}
use of org.neo4j.server.helpers.FunctionalTestHelper in project neo4j by neo4j.
the class CompactJsonIT method setupServer.
@BeforeClass
public static void setupServer() throws IOException {
functionalTestHelper = new FunctionalTestHelper(server());
helper = functionalTestHelper.getGraphDbHelper();
}
use of org.neo4j.server.helpers.FunctionalTestHelper 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.helpers.FunctionalTestHelper in project neo4j by neo4j.
the class SecurityRulesIT method should401WithBasicChallengeWhenASecurityRuleFails.
@Test
@Title("Enforcing Server Authorization Rules")
@Documented("In this example, a (dummy) failing security rule is registered to deny\n" + "access to all URIs to the server by listing the rules class in\n" + "'neo4j.conf':\n" + "\n" + "@@config\n" + "\n" + "with the rule source code of:\n" + "\n" + "@@failingRule\n" + "\n" + "With this rule registered, any access to the server will be\n" + "denied. In a production-quality implementation the rule\n" + "will likely lookup credentials/claims in a 3rd-party\n" + "directory service (e.g. LDAP) or in a local database of\n" + "authorized users.")
public void should401WithBasicChallengeWhenASecurityRuleFails() throws Exception {
server = CommunityServerBuilder.server().withDefaultDatabaseTuning().withSecurityRules(PermanentlyFailingSecurityRule.class.getCanonicalName()).usingDataDir(folder.directory(name.getMethodName()).getAbsolutePath()).build();
server.start();
functionalTestHelper = new FunctionalTestHelper(server);
JaxRsResponse response = gen.get().expectedStatus(401).expectedHeader("WWW-Authenticate").post(functionalTestHelper.nodeUri()).response();
assertThat(response.getHeaders().getFirst("WWW-Authenticate"), containsString("Basic realm=\"" + PermanentlyFailingSecurityRule.REALM + "\""));
}
use of org.neo4j.server.helpers.FunctionalTestHelper in project neo4j by neo4j.
the class EnterpriseVersionIT method setupServer.
@BeforeClass
public static void setupServer() throws Exception {
FakeClock clock = Clocks.fakeClock();
server = EnterpriseServerBuilder.server().usingDataDir(staticFolder.getRoot().getAbsolutePath()).withClock(clock).build();
suppressAll().call((Callable<Void>) () -> {
server.start();
return null;
});
functionalTestHelper = new FunctionalTestHelper(server);
}
Aggregations