Skip to content

Changed bolt+routing scheme to neo4j #451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ neo4j.driver('bolt://localhost', neo4j.auth.basic('neo4j', 'neo4j'), {

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

Expand All @@ -171,7 +171,7 @@ readTxResultPromise
})

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

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const logging = {
function driver (url, authToken, config = {}) {
assertString(url, 'Bolt URL')
const parsedUrl = urlUtil.parseDatabaseUrl(url)
if (parsedUrl.scheme === 'bolt+routing') {
if (parsedUrl.scheme === 'neo4j') {
return new RoutingDriver(
parsedUrl.hostAndPort,
parsedUrl.query,
Expand Down
2 changes: 1 addition & 1 deletion src/internal/url-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Url {
constructor (scheme, host, port, hostAndPort, query) {
/**
* Nullable scheme (protocol) of the URL.
* Example: 'bolt', 'bolt+routing', 'http', 'https', etc.
* Example: 'bolt', 'neo4j', 'http', 'https', etc.
* @type {string}
*/
this.scheme = scheme
Expand Down
24 changes: 24 additions & 0 deletions test/bolt-v4.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,30 @@ describe('Bolt V4 API', () => {
})
.finally(() => neoSession.close())
})

it('should be able to connect single instance using neo4j scheme', done => {
if (!databaseSupportsBoltV4()) {
done()
return
}

const neoDriver = neo4j.driver('neo4j://localhost', sharedNeo4j.authToken)
const neoSession = driver.session({ db: 'neo4j' })

neoSession
.run('CREATE (n { db: $db }) RETURN n.db', { db: 'neo4j' })
.then(result => {
expect(result.records.length).toBe(1)
expect(result.records[0].get('n.db')).toBe('neo4j')
done()
})
.catch(error => {
done.fail(error)
})
.finally(() => neoSession.close())

neoDriver.close()
})
})
})

Expand Down
4 changes: 2 additions & 2 deletions test/driver.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ describe('driver', () => {
}

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

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

const routingDriver = neo4j.driver('bolt+routing://localhost')
const routingDriver = neo4j.driver('neo4j://localhost')
expect(routingDriver._userAgent).toBe('neo4j-javascript/0.0.0-dev')
routingDriver.close()
})
Expand Down
2 changes: 1 addition & 1 deletion test/examples.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ describe('examples', () => {
}

function addPerson (name) {
const driver = createDriver('bolt+routing://x.acme.com', user, password, [
const driver = createDriver('neo4j://x.acme.com', user, password, [
'a.acme.com:7575',
'b.acme.com:7676',
'c.acme.com:8787'
Expand Down
Loading