Skip to content

Commit 0133764

Browse files
committed
Merge remote-tracking branch 'upstream/1.0' into 1.1
2 parents c2d1533 + aa8d80a commit 0133764

File tree

13 files changed

+304
-20
lines changed

13 files changed

+304
-20
lines changed

gulpfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ gulp.task('download-tck', function() {
204204
gulp.task('run-tck', ['download-tck', 'nodejs'], function() {
205205
return gulp.src(featureHome + "/*").pipe(cucumber({
206206
'steps': 'test/v1/tck/steps/*.js',
207-
'format': 'summary',
208-
'tags' : ['~@in_dev', '~@db']
207+
'format': 'pretty',
208+
'tags' : ['~@in_dev', '~@db', '~@equality']
209209
}));
210210
});
211211

src/v1/driver.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ class Driver {
5353
this._pool = new Pool(
5454
this._createConnection.bind(this),
5555
this._destroyConnection.bind(this),
56-
this._validateConnection.bind(this)
56+
this._validateConnection.bind(this),
57+
config.connectionPoolSize
5758
);
5859
}
5960

src/v1/internal/buf.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ class BaseBuffer
199199
return this.getUInt16( this._updatePos(2) );
200200
}
201201

202+
/**
203+
* Read from state position.
204+
*/
205+
readUInt32 () {
206+
return this.getUInt32( this._updatePos(4) );
207+
}
208+
202209
/**
203210
* Read from state position.
204211
*/

src/v1/internal/ch-node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* See the License for the specific language governing permissions and
1717
* limitations under the License.
1818
*/
19-
19+
2020
import net from 'net';
2121
import tls from 'tls';
2222
import fs from 'fs';
@@ -210,7 +210,7 @@ class NodeChannel {
210210
this.onerror(err);
211211
}
212212
}
213-
213+
214214
/**
215215
* Write the passed in buffer to connection
216216
* @param {NodeBuffer} buffer - Buffer to write

src/v1/internal/connector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ else {
4242
let
4343
// Signature bytes for each message type
4444
INIT = 0x01, // 0000 0001 // INIT <user_agent>
45-
ACK_FAILURE = 0x0D, // 0000 1101 // ACK_FAILURE
45+
ACK_FAILURE = 0x0E, // 0000 1110 // ACK_FAILURE
4646
RESET = 0x0F, // 0000 1111 // RESET
4747
RUN = 0x10, // 0001 0000 // RUN <statement> <parameters>
4848
DISCARD_ALL = 0x2F, // 0010 1111 // DISCARD *

src/v1/internal/stream-observer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class StreamObserver {
3939
this._queuedRecords = [];
4040
this._tail = null;
4141
this._error = null;
42+
this._hasFailed = false;
4243
}
4344

4445
/**
@@ -87,6 +88,10 @@ class StreamObserver {
8788
* @param {Object} error - An error object
8889
*/
8990
onError(error) {
91+
if(this._hasFailed) {
92+
return;
93+
}
94+
this._hasFailed = true;
9095
if( this._observer ) {
9196
if( this._observer.onError ) {
9297
this._observer.onError( error );

src/v1/session.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ class Session {
8787
* @return
8888
*/
8989
close(cb=(()=>null)) {
90-
this._onClose(cb);
90+
if(this._onClose) {
91+
try {
92+
this._onClose(cb);
93+
} finally {
94+
this._onClose = null;
95+
}
96+
} else {
97+
cb();
98+
}
9199
}
92100
}
93101

test/internal/packstream.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ describe('packstream', function() {
4747
it('should pack strings', function() {
4848
expect( packAndUnpack( "" ) ).toBe( "" );
4949
expect( packAndUnpack( "abcdefg123567" ) ).toBe( "abcdefg123567" );
50+
var str = Array(65536 + 1).join('a'); // 2 ^ 16 + 1
51+
expect( packAndUnpack(str, str.length + 8)).toBe(str);
5052
});
5153
it('should pack structures', function() {
5254
expect( packAndUnpack( new Structure(1, ["Hello, world!!!"] ) ).fields[0] )

test/v1/session.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
var neo4j = require("../../lib/v1");
2121
var StatementType = require("../../lib/v1/result-summary").statementType;
22+
var Session = require("../../lib/v1/session");
2223

2324
describe('session', function() {
2425

@@ -35,6 +36,18 @@ describe('session', function() {
3536
driver.close();
3637
});
3738

39+
it('close should be idempotent ', function(){
40+
// Given
41+
var counter = 0;
42+
var _session = new Session(null, function(){
43+
counter++;
44+
});
45+
_session.close();
46+
expect(counter).toBe(1);
47+
_session.close();
48+
expect(counter).toBe(1);
49+
})
50+
3851
it('should expose basic run/subscribe ', function(done) {
3952
// Given
4053

test/v1/tck/steps/environment.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ module.exports = function () {
1919
callback();
2020
});
2121

22+
this.Before("@equality_test", function( scenario ) {
23+
this.savedValues = {}
24+
});
25+
2226
this.After(function (scenario, callback) {
2327
if (!scenario.isSuccessful()) {
2428
failedScenarios.push(scenario)

0 commit comments

Comments
 (0)