Commit 62bc955b authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #6746 from xenoterracide:neo4j-bolt

* pr/6746:
  Polish contribution
  Detect Neo4j bolt driver
parents b9104c93 47c568a2
...@@ -45,6 +45,8 @@ public class Neo4jProperties implements ApplicationContextAware { ...@@ -45,6 +45,8 @@ public class Neo4jProperties implements ApplicationContextAware {
static final String DEFAULT_HTTP_URI = "http://localhost:7474"; 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. * URI used by the driver. Auto-detected by default.
*/ */
...@@ -151,6 +153,9 @@ public class Neo4jProperties implements ApplicationContextAware { ...@@ -151,6 +153,9 @@ public class Neo4jProperties implements ApplicationContextAware {
if ("http".equals(scheme)) { if ("http".equals(scheme)) {
return HTTP_DRIVER; return HTTP_DRIVER;
} }
if ("bolt".equals(scheme)) {
return BOLT_DRIVER;
}
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Could not deduce driver to use based on URI '" + uri + "'"); "Could not deduce driver to use based on URI '" + uri + "'");
} }
......
...@@ -71,6 +71,14 @@ public class Neo4jPropertiesTests { ...@@ -71,6 +71,14 @@ public class Neo4jPropertiesTests {
assertDriver(configuration, Neo4jProperties.HTTP_DRIVER, "http://localhost:7474"); 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 @Test
public void fileUriUseEmbeddedServer() { public void fileUriUseEmbeddedServer() {
Neo4jProperties properties = load(true, Neo4jProperties properties = load(true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment