Merge pull request #6746 from xenoterracide:neo4j-bolt
* pr/6746: Polish contribution Detect Neo4j bolt driver
This commit is contained in:
@@ -45,6 +45,8 @@ public class Neo4jProperties implements ApplicationContextAware {
|
||||
|
||||
static final String DEFAULT_HTTP_URI = "http://localhost:7474";
|
||||
|
||||
static final String BOLT_DRIVER = "org.neo4j.ogm.drivers.bolt.driver.BoltDriver";
|
||||
|
||||
/**
|
||||
* URI used by the driver. Auto-detected by default.
|
||||
*/
|
||||
@@ -151,6 +153,9 @@ public class Neo4jProperties implements ApplicationContextAware {
|
||||
if ("http".equals(scheme)) {
|
||||
return HTTP_DRIVER;
|
||||
}
|
||||
if ("bolt".equals(scheme)) {
|
||||
return BOLT_DRIVER;
|
||||
}
|
||||
throw new IllegalArgumentException(
|
||||
"Could not deduce driver to use based on URI '" + uri + "'");
|
||||
}
|
||||
|
||||
@@ -71,6 +71,14 @@ public class Neo4jPropertiesTests {
|
||||
assertDriver(configuration, Neo4jProperties.HTTP_DRIVER, "http://localhost:7474");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void boltUriUseBoltDriver() {
|
||||
Neo4jProperties properties = load(true,
|
||||
"spring.data.neo4j.uri=bolt://localhost:7687");
|
||||
Configuration configuration = properties.createConfiguration();
|
||||
assertDriver(configuration, Neo4jProperties.BOLT_DRIVER, "bolt://localhost:7687");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fileUriUseEmbeddedServer() {
|
||||
Neo4jProperties properties = load(true,
|
||||
|
||||
Reference in New Issue
Block a user