From 850d4af60b1b5f85f39b6da763bcc112a99b6595 Mon Sep 17 00:00:00 2001 From: Zhen Li Date: Wed, 17 Apr 2019 10:25:13 +0200 Subject: [PATCH] Changed the routing scheme from bolt+routing to neo4j for routing everywhere. --- README.md | 4 +- src/index.js | 2 +- src/internal/url-util.js | 2 +- test/bolt-v4.test.js | 24 ++++ test/driver.test.js | 4 +- test/examples.test.js | 2 +- .../node/routing.driver.boltkit.test.js | 120 +++++++++--------- test/internal/rediscovery.test.js | 2 +- test/internal/url-util.test.js | 82 ++++++------ test/routing-driver.test.js | 6 +- test/stress.test.js | 2 +- 11 files changed, 137 insertions(+), 113 deletions(-) diff --git a/README.md b/README.md index c39723293..1b12ae7fc 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/src/index.js b/src/index.js index e5212be5d..63f878f24 100644 --- a/src/index.js +++ b/src/index.js @@ -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, diff --git a/src/internal/url-util.js b/src/internal/url-util.js index 4c95f97df..f2d89d933 100644 --- a/src/internal/url-util.js +++ b/src/internal/url-util.js @@ -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 diff --git a/test/bolt-v4.test.js b/test/bolt-v4.test.js index cf648b784..f540b3b2d 100644 --- a/test/bolt-v4.test.js +++ b/test/bolt-v4.test.js @@ -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() + }) }) }) diff --git a/test/driver.test.js b/test/driver.test.js index be73ceb8d..56582486e 100644 --- a/test/driver.test.js +++ b/test/driver.test.js @@ -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 => { @@ -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() }) diff --git a/test/examples.test.js b/test/examples.test.js index c4d9bc403..91e375d17 100644 --- a/test/examples.test.js +++ b/test/examples.test.js @@ -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' diff --git a/test/internal/node/routing.driver.boltkit.test.js b/test/internal/node/routing.driver.boltkit.test.js index 4963aec09..93cbbbd67 100644 --- a/test/internal/node/routing.driver.boltkit.test.js +++ b/test/internal/node/routing.driver.boltkit.test.js @@ -49,7 +49,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session() session.run('MATCH (n) RETURN n.name').then(() => { @@ -87,7 +87,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') const session = driver.session({ defaultAccessMode: READ }) session.run('MATCH (n) RETURN n.name').then(() => { expect( @@ -129,7 +129,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9042') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9042') const session = driver.session({ defaultAccessMode: READ }) session.run('MATCH (n) RETURN n.name').then(() => { session.close() @@ -163,7 +163,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session() session.run('MATCH (n) RETURN n.name').then(() => { @@ -197,7 +197,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session() session.run('MATCH (n) RETURN n.name').subscribe({ @@ -233,7 +233,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: READ }) @@ -271,7 +271,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: READ }) session.run('MATCH (n) RETURN n.name').then(res => { @@ -323,7 +323,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9999') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9999') // When const session1 = driver.session({ defaultAccessMode: READ }) session1.run('MATCH (n) RETURN n.name').then(res => { @@ -379,7 +379,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session1 = driver.session({ defaultAccessMode: READ }) session1.run('MATCH (n) RETURN n.name').then(res => { @@ -428,7 +428,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: READ }) session.run('MATCH (n) RETURN n.name').catch(err => { @@ -461,7 +461,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: WRITE }) session.run("CREATE (n {name:'Bob'})").then(() => { @@ -498,7 +498,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session1 = driver.session({ defaultAccessMode: WRITE }) session1.run("CREATE (n {name:'Bob'})").then(() => { @@ -537,7 +537,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: WRITE }) session.run('MATCH (n) RETURN n.name').catch(err => { @@ -570,7 +570,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: READ }) session.run('MATCH (n) RETURN n.name').then(() => { @@ -610,7 +610,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: READ }) session.run('MATCH (n) RETURN n.name').catch(() => { @@ -651,7 +651,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: READ }) session.run('MATCH (n) RETURN n.name').catch(() => { @@ -693,7 +693,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session1 = driver.session({ defaultAccessMode: READ }) session1.run('MATCH (n) RETURN n.name').catch(() => { @@ -725,7 +725,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session() session.run('MATCH (n) RETURN n.name').catch(err => { @@ -762,7 +762,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session() session.run('CREATE ()').catch(err => { @@ -798,7 +798,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session() const tx = session.beginTransaction() @@ -833,7 +833,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: WRITE }) session.run('MATCH (n) RETURN n.name').catch(err => { @@ -871,7 +871,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9999') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9999') const session1 = driver.session() session1.run('MATCH (n) RETURN n').then(result1 => { @@ -934,7 +934,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9002') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9002') // When const session1 = driver.session({ defaultAccessMode: WRITE }) session1.run("CREATE (n {name:'Bob'})").then(() => { @@ -986,7 +986,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const readSession = driver.session({ defaultAccessMode: READ }) readSession.run('MATCH (n) RETURN n.name').then(readResult => { @@ -1042,7 +1042,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const readSession = driver.session({ defaultAccessMode: READ }) readSession.run('MATCH (n) RETURN n.name').subscribe({ @@ -1094,7 +1094,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9999') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9999') const session1 = driver.session() session1.run('MATCH (n) RETURN n').then(result1 => { @@ -1144,7 +1144,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') const acquiredConnections = [] const releasedConnections = [] @@ -1341,7 +1341,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') const session = driver.session() const tx = session.beginTransaction('neo4j:bookmark:v1:tx42') @@ -1396,7 +1396,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') const session = driver.session({ defaultAccessMode: READ, @@ -1443,7 +1443,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') const session = driver.session({ bookmarks: ['neo4j:bookmark:v1:tx42'] }) const writeTx = session.beginTransaction() @@ -1499,7 +1499,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') const session = driver.session() let invocations = 0 @@ -1549,7 +1549,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') const session = driver.session() let invocations = 0 @@ -1599,7 +1599,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') const session = driver.session() let invocations = 0 @@ -1655,7 +1655,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') const session = driver.session() let invocations = 0 @@ -1719,7 +1719,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9010') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9010') const session = driver.session() let invocations = 0 @@ -1783,7 +1783,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9010') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9010') const session = driver.session() let invocations = 0 @@ -1836,7 +1836,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9010') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9010') // run a dummy query to force routing table initialization const session = driver.session({ defaultAccessMode: READ }) @@ -1901,7 +1901,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9010') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9010') // make seed address resolve to 3 different addresses (only last one has backing stub server): setupFakeHostNameResolution(driver, '127.0.0.1:9010', [ '127.0.0.1:9011', @@ -1944,7 +1944,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') const session = driver.session() session.run('MATCH (n) RETURN n.name AS name').then(result => { const names = result.records.map(record => record.get('name')) @@ -1974,7 +1974,7 @@ describe('routing driver with stub server', () => { boltStub.run(() => { const driver = boltStub.newDriver( - 'bolt+routing://127.0.0.1:9001/?policy=my_policy®ion=china' + 'neo4j://127.0.0.1:9001/?policy=my_policy®ion=china' ) const session = driver.session() session.run('MATCH (n) RETURN n.name AS name').then(result => { @@ -2005,7 +2005,7 @@ describe('routing driver with stub server', () => { boltStub.run(() => { const driver = boltStub.newDriver( - 'bolt+routing://127.0.0.1:9001/?policy=my_policy' + 'neo4j://127.0.0.1:9001/?policy=my_policy' ) const session = driver.session() session.run('MATCH (n) RETURN n.name').then(result => { @@ -2043,7 +2043,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9010') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9010') const session = driver.session({ defaultAccessMode: READ }) session.run('MATCH (n) RETURN n.name').then(result1 => { @@ -2088,7 +2088,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9010') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9010') const session = driver.session({ defaultAccessMode: READ }) session.run('MATCH (n) RETURN n.name').then(result => { @@ -2133,7 +2133,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9010') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9010') const readSession = driver.session() @@ -2192,7 +2192,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9010') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9010') const readSession = driver.session() @@ -2264,7 +2264,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9010') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9010') const readSession = driver.session({ defaultAccessMode: READ }) readSession.run('MATCH (n) RETURN n.name').then(result => { @@ -2318,7 +2318,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9010') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9010') const session = driver.session() session.run('RETURN 1').catch(error => { expect(error.code).toEqual('Neo.ClientError.Security.Unauthorized') @@ -2351,7 +2351,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9010') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9010') const bookmarks = [ 'neo4j:bookmark:v1:tx5', @@ -2465,7 +2465,7 @@ describe('routing driver with stub server', () => { throw new Error(`Unexpected address ${address}`) } - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001', { + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001', { resolver: resolverFunction }) @@ -2551,7 +2551,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: READ }) session.run('MATCH (n) RETURN n.name').then(res => { @@ -2589,7 +2589,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: READ }) session @@ -2629,7 +2629,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: WRITE }) session.run("CREATE (n {name:'Bob'})").then(res => { @@ -2662,7 +2662,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') // When const session = driver.session({ defaultAccessMode: WRITE }) session @@ -2703,7 +2703,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9010') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9010') const session = driver.session({ defaultAccessMode: accessMode }) session.run(query).catch(error => { @@ -2765,7 +2765,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') const session = driver.session({ defaultAccessMode: accessMode, @@ -2809,7 +2809,7 @@ describe('routing driver with stub server', () => { boltStub.run(() => { const driver = boltStub.newDriver( - 'bolt+routing://127.0.0.1:9001', + 'neo4j://127.0.0.1:9001', driverConfig ) @@ -2845,7 +2845,7 @@ describe('routing driver with stub server', () => { const server = boltStub.start(scriptFile, 9001) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001') + const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') const session = driver.session() session.run('MATCH (n) RETURN n.name').catch(error => { @@ -2881,7 +2881,7 @@ describe('routing driver with stub server', () => { ) boltStub.run(() => { - const driver = boltStub.newDriver('bolt+routing://127.0.0.1:' + port) + const driver = boltStub.newDriver('neo4j://127.0.0.1:' + port) const session = driver.session() session.run('MATCH (n) RETURN n.name').then(result => { @@ -3014,7 +3014,7 @@ describe('routing driver with stub server', () => { throw new Error(`Unexpected address ${address}`) } - const driver = boltStub.newDriver('bolt+routing://neo4j.com', { + const driver = boltStub.newDriver('neo4j://neo4j.com', { resolver: resolverFunction }) @@ -3061,7 +3061,7 @@ describe('routing driver with stub server', () => { throw new Error('Unexpected address') } - const driver = boltStub.newDriver('bolt+routing://neo4j.com:8989', { + const driver = boltStub.newDriver('neo4j://neo4j.com:8989', { resolver: resolverFunction }) const session = driver.session() diff --git a/test/internal/rediscovery.test.js b/test/internal/rediscovery.test.js index fbab1fd6a..d7729c97a 100644 --- a/test/internal/rediscovery.test.js +++ b/test/internal/rediscovery.test.js @@ -24,7 +24,7 @@ import Record from '../../src/record' import { int } from '../../src/integer' import RoutingTable from '../../src/internal/routing-table' -const ROUTER_ADDRESS = 'bolt+routing://test.router.com' +const ROUTER_ADDRESS = 'neo4j://test.router.com' describe('rediscovery', () => { it('should return null when connection error happens', done => { diff --git a/test/internal/url-util.test.js b/test/internal/url-util.test.js index 95e7aa471..101321825 100644 --- a/test/internal/url-util.test.js +++ b/test/internal/url-util.test.js @@ -193,9 +193,9 @@ describe('url-util', () => { }) verifyUrl( - 'bolt+routing://ec2-34-242-76-91.eu-west-1.compute.aws.com?foo=1&bar=2&baz=3&qux=4', + 'neo4j://ec2-34-242-76-91.eu-west-1.compute.aws.com?foo=1&bar=2&baz=3&qux=4', { - scheme: 'bolt+routing', + scheme: 'neo4j', host: 'ec2-34-242-76-91.eu-west-1.compute.aws.com', query: { foo: '1', bar: '2', baz: '3', qux: '4' } } @@ -209,8 +209,8 @@ describe('url-util', () => { query: { key1: 'value1', key2: 'value2' } }) - verifyUrl('bolt+routing://10.10.192.0?key1=1&key2=2', { - scheme: 'bolt+routing', + verifyUrl('neo4j://10.10.192.0?key1=1&key2=2', { + scheme: 'neo4j', host: '10.10.192.0', query: { key1: '1', key2: '2' } }) @@ -229,8 +229,8 @@ describe('url-util', () => { }) it('should parse URL with scheme, IPv6 address and query', () => { - verifyUrl('bolt+routing://[::1]?key1=value1&key2=value2', { - scheme: 'bolt+routing', + verifyUrl('neo4j://[::1]?key1=value1&key2=value2', { + scheme: 'neo4j', host: '::1', query: { key1: 'value1', key2: 'value2' }, ipv6: true @@ -258,17 +258,17 @@ describe('url-util', () => { }) verifyUrl( - 'bolt+routing://[2a05:d018:270:f400:6d8c:d425:c5f:97f3]?animal=apa', + 'neo4j://[2a05:d018:270:f400:6d8c:d425:c5f:97f3]?animal=apa', { - scheme: 'bolt+routing', + scheme: 'neo4j', host: '2a05:d018:270:f400:6d8c:d425:c5f:97f3', query: { animal: 'apa' }, ipv6: true } ) - verifyUrl('bolt+routing://[fe80::1%lo0]?animal=apa', { - scheme: 'bolt+routing', + verifyUrl('neo4j://[fe80::1%lo0]?animal=apa', { + scheme: 'neo4j', host: 'fe80::1%lo0', query: { animal: 'apa' }, ipv6: true @@ -380,8 +380,8 @@ describe('url-util', () => { }) it('should parse URL with scheme and IPv4 address', () => { - verifyUrl('bolt+routing://127.0.0.1', { - scheme: 'bolt+routing', + verifyUrl('neo4j://127.0.0.1', { + scheme: 'neo4j', host: '127.0.0.1' }) @@ -414,8 +414,8 @@ describe('url-util', () => { ipv6: true }) - verifyUrl('bolt+routing://[1afc:0:a33:85a3::ff2f]', { - scheme: 'bolt+routing', + verifyUrl('neo4j://[1afc:0:a33:85a3::ff2f]', { + scheme: 'neo4j', host: '1afc:0:a33:85a3::ff2f', ipv6: true }) @@ -426,14 +426,14 @@ describe('url-util', () => { ipv6: true }) - verifyUrl('bolt+routing://[2a05:d018:270:f400:6d8c:d425:c5f:97f3]', { - scheme: 'bolt+routing', + verifyUrl('neo4j://[2a05:d018:270:f400:6d8c:d425:c5f:97f3]', { + scheme: 'neo4j', host: '2a05:d018:270:f400:6d8c:d425:c5f:97f3', ipv6: true }) - verifyUrl('bolt+routing://[fe80::1%lo0]', { - scheme: 'bolt+routing', + verifyUrl('neo4j://[fe80::1%lo0]', { + scheme: 'neo4j', host: 'fe80::1%lo0', ipv6: true }) @@ -452,8 +452,8 @@ describe('url-util', () => { port: 42 }) - verifyUrl('bolt+routing://some-neo4j-server.com:12000', { - scheme: 'bolt+routing', + verifyUrl('neo4j://some-neo4j-server.com:12000', { + scheme: 'neo4j', host: 'some-neo4j-server.com', port: 12000 }) @@ -478,8 +478,8 @@ describe('url-util', () => { port: 7447 }) - verifyUrl('bolt+routing://172.10.5.1:8888', { - scheme: 'bolt+routing', + verifyUrl('neo4j://172.10.5.1:8888', { + scheme: 'neo4j', host: '172.10.5.1', port: 8888 }) @@ -506,8 +506,8 @@ describe('url-util', () => { ipv6: true }) - verifyUrl('bolt+routing://[1afc:0:a33:85a3::ff2f]:50505', { - scheme: 'bolt+routing', + verifyUrl('neo4j://[1afc:0:a33:85a3::ff2f]:50505', { + scheme: 'neo4j', host: '1afc:0:a33:85a3::ff2f', port: 50505, ipv6: true @@ -550,8 +550,8 @@ describe('url-util', () => { query: { foo: 'bar', baz: 'qux' } }) - verifyUrl('bolt+routing://some-neo4j-server.com:14500?key=value', { - scheme: 'bolt+routing', + verifyUrl('neo4j://some-neo4j-server.com:14500?key=value', { + scheme: 'neo4j', host: 'some-neo4j-server.com', port: 14500, query: { key: 'value' } @@ -576,8 +576,8 @@ describe('url-util', () => { query: { key1: 'value1', key2: 'value2' } }) - verifyUrl('bolt+routing://10.10.192.0:12100/?foo=bar&baz=qux', { - scheme: 'bolt+routing', + verifyUrl('neo4j://10.10.192.0:12100/?foo=bar&baz=qux', { + scheme: 'neo4j', host: '10.10.192.0', port: 12100, query: { foo: 'bar', baz: 'qux' } @@ -607,8 +607,8 @@ describe('url-util', () => { ipv6: true }) - verifyUrl('bolt+routing://[ff02::2:ff00:0]:22/?animal1=apa&animal2=dog', { - scheme: 'bolt+routing', + verifyUrl('neo4j://[ff02::2:ff00:0]:22/?animal1=apa&animal2=dog', { + scheme: 'neo4j', host: 'ff02::2:ff00:0', port: 22, query: { animal1: 'apa', animal2: 'dog' }, @@ -654,7 +654,7 @@ describe('url-util', () => { it('should fail to parse URL without host', () => { expect(() => parse('http://')).toThrow() expect(() => parse('bolt://')).toThrow() - expect(() => parse('bolt+routing://')).toThrow() + expect(() => parse('neo4j://')).toThrow() }) it('should fail to parse URL with duplicated query parameters', () => { @@ -664,10 +664,10 @@ describe('url-util', () => { ).toThrow() expect(() => - parse('bolt+routing://10.10.127.5?key=value1&key=value2') + parse('neo4j://10.10.127.5?key=value1&key=value2') ).toThrow() expect(() => - parse('bolt+routing://10.10.127.5:8080?key=value1&key=value2') + parse('neo4j://10.10.127.5:8080?key=value1&key=value2') ).toThrow() expect(() => parse('https://[ff0a::101]?key=value1&key=value2')).toThrow() @@ -680,8 +680,8 @@ describe('url-util', () => { expect(() => parse('bolt://localhost?=value')).toThrow() expect(() => parse('bolt://localhost:8080?=value')).toThrow() - expect(() => parse('bolt+routing://10.10.127.5?=value')).toThrow() - expect(() => parse('bolt+routing://10.10.127.5:8080?=value')).toThrow() + expect(() => parse('neo4j://10.10.127.5?=value')).toThrow() + expect(() => parse('neo4j://10.10.127.5:8080?=value')).toThrow() expect(() => parse('https://[ff0a::101]/?value=')).toThrow() expect(() => parse('https://[ff0a::101]:8080/?=value')).toThrow() @@ -691,8 +691,8 @@ describe('url-util', () => { expect(() => parse('bolt://localhost?key=')).toThrow() expect(() => parse('bolt://localhost:8080?key=')).toThrow() - expect(() => parse('bolt+routing://10.10.127.5/?key=')).toThrow() - expect(() => parse('bolt+routing://10.10.127.5:8080/?key=')).toThrow() + expect(() => parse('neo4j://10.10.127.5/?key=')).toThrow() + expect(() => parse('neo4j://10.10.127.5:8080/?key=')).toThrow() expect(() => parse('https://[ff0a::101]?key=')).toThrow() expect(() => parse('https://[ff0a::101]:8080?key=')).toThrow() @@ -702,8 +702,8 @@ describe('url-util', () => { expect(() => parse('bolt://localhost?key')).toThrow() expect(() => parse('bolt://localhost:8080?key')).toThrow() - expect(() => parse('bolt+routing://10.10.127.5/?key')).toThrow() - expect(() => parse('bolt+routing://10.10.127.5:8080/?key')).toThrow() + expect(() => parse('neo4j://10.10.127.5/?key')).toThrow() + expect(() => parse('neo4j://10.10.127.5:8080/?key')).toThrow() expect(() => parse('https://[ff0a::101]?key')).toThrow() expect(() => parse('https://[ff0a::101]:8080?key')).toThrow() @@ -753,7 +753,7 @@ describe('url-util', () => { expect(parse('bolt://localhost').port).toEqual( urlUtil.defaultPortForScheme('bolt') ) - expect(parse('bolt+routing://localhost').port).toEqual( + expect(parse('neo4j://localhost').port).toEqual( urlUtil.defaultPortForScheme('bolt') ) @@ -766,7 +766,7 @@ describe('url-util', () => { }) it('should parse URLs with port 80', () => { - ;['http', 'https', 'ws', 'wss', 'bolt', 'bolt+routing'].forEach(scheme => { + ;['http', 'https', 'ws', 'wss', 'bolt', 'neo4j'].forEach(scheme => { verifyUrl(`${scheme}://localhost:80`, { scheme: scheme, host: 'localhost', diff --git a/test/routing-driver.test.js b/test/routing-driver.test.js index 54d3e3cb3..1f1a9835a 100644 --- a/test/routing-driver.test.js +++ b/test/routing-driver.test.js @@ -31,16 +31,16 @@ describe('RoutingDriver', () => { it('should fail when configured resolver is of illegal type', () => { expect(() => neo4j.driver( - 'bolt+routing://localhost', + 'neo4j://localhost', {}, { resolver: 'string instead of a function' } ) ).toThrowError(TypeError) expect(() => - neo4j.driver('bolt+routing://localhost', {}, { resolver: [] }) + neo4j.driver('neo4j://localhost', {}, { resolver: [] }) ).toThrowError(TypeError) expect(() => - neo4j.driver('bolt+routing://localhost', {}, { resolver: {} }) + neo4j.driver('neo4j://localhost', {}, { resolver: {} }) ).toThrowError(TypeError) }) }) diff --git a/test/stress.test.js b/test/stress.test.js index a0bfdc9e5..04b95a226 100644 --- a/test/stress.test.js +++ b/test/stress.test.js @@ -395,7 +395,7 @@ describe('stress tests', () => { } function verifyServers (context) { - const routing = DATABASE_URI.indexOf('bolt+routing') === 0 + const routing = DATABASE_URI.indexOf('neo4j') === 0 if (routing) { return verifyCausalClusterMembers(context)