use of org.neo4j.driver.Config in project spring-boot by spring-projects.
the class Neo4jPropertiesTests method poolSettingsHaveConsistentDefaults.
@Test
void poolSettingsHaveConsistentDefaults() {
Config defaultConfig = Config.defaultConfig();
Pool pool = new Neo4jProperties().getPool();
assertThat(pool.isMetricsEnabled()).isEqualTo(defaultConfig.isMetricsEnabled());
assertThat(pool.isLogLeakedSessions()).isEqualTo(defaultConfig.logLeakedSessions());
assertThat(pool.getMaxConnectionPoolSize()).isEqualTo(defaultConfig.maxConnectionPoolSize());
assertDuration(pool.getIdleTimeBeforeConnectionTest(), defaultConfig.idleTimeBeforeConnectionTest());
assertDuration(pool.getMaxConnectionLifetime(), defaultConfig.maxConnectionLifetimeMillis());
assertDuration(pool.getConnectionAcquisitionTimeout(), defaultConfig.connectionAcquisitionTimeoutMillis());
}
use of org.neo4j.driver.Config in project spring-boot by spring-projects.
the class Neo4jAutoConfiguration method neo4jDriver.
@Bean
@ConditionalOnMissingBean
public Driver neo4jDriver(Neo4jProperties properties, Environment environment, ObjectProvider<ConfigBuilderCustomizer> configBuilderCustomizers) {
AuthToken authToken = mapAuthToken(properties.getAuthentication(), environment);
Config config = mapDriverConfig(properties, configBuilderCustomizers.orderedStream().collect(Collectors.toList()));
URI serverUri = determineServerUri(properties, environment);
return GraphDatabase.driver(serverUri, authToken, config);
}
use of org.neo4j.driver.Config in project neo4j by neo4j.
the class BoltStateHandlerTest method fallbackTest.
private void fallbackTest(String initialScheme, String fallbackScheme, Runnable failer) throws CommandException {
final String[] uriScheme = new String[1];
RecordingDriverProvider provider = new RecordingDriverProvider() {
@Override
public Driver apply(String uri, AuthToken authToken, Config config) {
uriScheme[0] = uri.substring(0, uri.indexOf(':'));
if (uriScheme[0].equals(initialScheme)) {
failer.run();
}
super.apply(uri, authToken, config);
return new FakeDriver();
}
};
BoltStateHandler handler = new BoltStateHandler(provider, false);
ConnectionConfig config = new ConnectionConfig(initialScheme, "", -1, "", "", Encryption.DEFAULT, ABSENT_DB_NAME);
handler.connect(config);
assertEquals(fallbackScheme, uriScheme[0]);
}
Aggregations