Skip to content

Commit e345898

Browse files
authored
Merge pull request #451 from zhenlineo/2.0-routing-scheme
Changed `bolt+routing` scheme to `neo4j`
2 parents 9a5440c + 850d4af commit e345898

11 files changed

+137
-113
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ neo4j.driver('bolt://localhost', neo4j.auth.basic('neo4j', 'neo4j'), {
148148

149149
// It is possible to execute read transactions that will benefit from automatic
150150
// retries on both single instance ('bolt' URI scheme) and Causal Cluster
151-
// ('bolt+routing' URI scheme) and will get automatic load balancing in cluster deployments
151+
// ('neo4j' URI scheme) and will get automatic load balancing in cluster deployments
152152
var readTxResultPromise = session.readTransaction(function(transaction) {
153153
// used transaction will be committed automatically, no need for explicit commit/rollback
154154

@@ -171,7 +171,7 @@ readTxResultPromise
171171
})
172172

173173
// It is possible to execute write transactions that will benefit from automatic retries
174-
// on both single instance ('bolt' URI scheme) and Causal Cluster ('bolt+routing' URI scheme)
174+
// on both single instance ('bolt' URI scheme) and Causal Cluster ('neo4j' URI scheme)
175175
var writeTxResultPromise = session.writeTransaction(function(transaction) {
176176
// used transaction will be committed automatically, no need for explicit commit/rollback
177177

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ const logging = {
239239
function driver (url, authToken, config = {}) {
240240
assertString(url, 'Bolt URL')
241241
const parsedUrl = urlUtil.parseDatabaseUrl(url)
242-
if (parsedUrl.scheme === 'bolt+routing') {
242+
if (parsedUrl.scheme === 'neo4j') {
243243
return new RoutingDriver(
244244
parsedUrl.hostAndPort,
245245
parsedUrl.query,

src/internal/url-util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Url {
2828
constructor (scheme, host, port, hostAndPort, query) {
2929
/**
3030
* Nullable scheme (protocol) of the URL.
31-
* Example: 'bolt', 'bolt+routing', 'http', 'https', etc.
31+
* Example: 'bolt', 'neo4j', 'http', 'https', etc.
3232
* @type {string}
3333
*/
3434
this.scheme = scheme

test/bolt-v4.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,30 @@ describe('Bolt V4 API', () => {
161161
})
162162
.finally(() => neoSession.close())
163163
})
164+
165+
it('should be able to connect single instance using neo4j scheme', done => {
166+
if (!databaseSupportsBoltV4()) {
167+
done()
168+
return
169+
}
170+
171+
const neoDriver = neo4j.driver('neo4j://localhost', sharedNeo4j.authToken)
172+
const neoSession = driver.session({ db: 'neo4j' })
173+
174+
neoSession
175+
.run('CREATE (n { db: $db }) RETURN n.db', { db: 'neo4j' })
176+
.then(result => {
177+
expect(result.records.length).toBe(1)
178+
expect(result.records[0].get('n.db')).toBe('neo4j')
179+
done()
180+
})
181+
.catch(error => {
182+
done.fail(error)
183+
})
184+
.finally(() => neoSession.close())
185+
186+
neoDriver.close()
187+
})
164188
})
165189
})
166190

test/driver.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ describe('driver', () => {
231231
}
232232

233233
// Given
234-
driver = neo4j.driver('bolt+routing://localhost', sharedNeo4j.authToken)
234+
driver = neo4j.driver('neo4j://localhost', sharedNeo4j.authToken)
235235

236236
// Expect
237237
driver.onError = error => {
@@ -251,7 +251,7 @@ describe('driver', () => {
251251
expect(directDriver._userAgent).toBe('neo4j-javascript/0.0.0-dev')
252252
directDriver.close()
253253

254-
const routingDriver = neo4j.driver('bolt+routing://localhost')
254+
const routingDriver = neo4j.driver('neo4j://localhost')
255255
expect(routingDriver._userAgent).toBe('neo4j-javascript/0.0.0-dev')
256256
routingDriver.close()
257257
})

test/examples.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ describe('examples', () => {
188188
}
189189

190190
function addPerson (name) {
191-
const driver = createDriver('bolt+routing://x.acme.com', user, password, [
191+
const driver = createDriver('neo4j://x.acme.com', user, password, [
192192
'a.acme.com:7575',
193193
'b.acme.com:7676',
194194
'c.acme.com:8787'

0 commit comments

Comments
 (0)