Comparing version 0.3.3 to 0.3.4
@@ -15,2 +15,8 @@ 'use strict'; | ||
}); | ||
// Node 0.10.x tls fix | ||
// tls only became a socket in 0.11.x | ||
socket.once('secureConnect', function() { | ||
socket.emit('connect'); | ||
}); | ||
}; |
{ | ||
"name" : "bramqp", | ||
"version" : "0.3.3", | ||
"version" : "0.3.4", | ||
"description" : "bakkerthehacker's rhythmic AMQP library", | ||
@@ -5,0 +5,0 @@ "keywords" : [ "amqp", "bramqp" ], |
@@ -8,4 +8,3 @@ 'use strict'; | ||
var net = require('net'); | ||
var specification = require('../lib/specification'); | ||
var ConnectionHandle = require('../lib/connectionHandle'); | ||
var bramqp = require('../lib/bramqp'); | ||
@@ -16,32 +15,17 @@ var puts = require('vows').console.puts({ | ||
var connectAMQP = function() { | ||
return function () { | ||
var self = this; | ||
var socket = net.connect({host: 'localhost', port: 5672}); | ||
socket.once('connect', function() { | ||
var spec = 'rabbitmq/full/amqp0-9-1.stripped.extended'; | ||
var handle = new ConnectionHandle(socket, spec); | ||
var connectAMQP = function () { | ||
var self = this; | ||
var socket = net.connect({host: 'localhost', port: 5672}); | ||
var bail = setTimeout(function() { | ||
self.callback(false, handle); | ||
}, 5000); | ||
handle.once('init', function() { | ||
handle.openAMQPCommunication('guest', 'guest', true, | ||
function() { | ||
clearTimeout(bail); | ||
self.callback(true, handle); | ||
}); | ||
}); | ||
bramqp.initialize(socket, 'rabbitmq/full/amqp0-9-1.stripped.extended', function(error, handle){ | ||
handle.openAMQPCommunication('guest', 'guest', true, function() { | ||
self.callback(null, handle); | ||
}); | ||
}; | ||
}); | ||
}; | ||
var connectVerify = function() { | ||
return function(success, handle, error) { | ||
assert.strictEqual(success, true); | ||
handle.closeAMQPCommunication(function() { | ||
handle.socket.end(); | ||
}); | ||
}; | ||
var connectVerify = function(handle) { | ||
handle.closeAMQPCommunication(function() { | ||
handle.socket.end(); | ||
}); | ||
}; | ||
@@ -51,21 +35,21 @@ | ||
'concurrent connection 1' : { | ||
topic : connectAMQP(), | ||
'should be connected' : connectVerify(), | ||
topic : connectAMQP, | ||
'should be connected' : connectVerify, | ||
}, | ||
'concurrent connection 2' : { | ||
topic : connectAMQP(), | ||
'should be connected' : connectVerify(), | ||
topic : connectAMQP, | ||
'should be connected' : connectVerify, | ||
}, | ||
'concurrent connection 3' : { | ||
topic : connectAMQP(), | ||
'should be connected' : connectVerify(), | ||
topic : connectAMQP, | ||
'should be connected' : connectVerify, | ||
}, | ||
'concurrent connection 4' : { | ||
topic : connectAMQP(), | ||
'should be connected' : connectVerify(), | ||
topic : connectAMQP, | ||
'should be connected' : connectVerify, | ||
}, | ||
'concurrent connection 5' : { | ||
topic : connectAMQP(), | ||
'should be connected' : connectVerify(), | ||
topic : connectAMQP, | ||
'should be connected' : connectVerify, | ||
} | ||
}).export(module); |
@@ -9,4 +9,3 @@ 'use strict'; | ||
var net = require('net'); | ||
var specification = require('../lib/specification'); | ||
var ConnectionHandle = require('../lib/connectionHandle'); | ||
var bramqp = require('../lib/bramqp'); | ||
@@ -21,11 +20,6 @@ var puts = require('vows').console.puts({ | ||
var socket = net.connect({host: 'localhost', port: 5672}); | ||
socket.once('connect', function() { | ||
var spec = 'rabbitmq/full/amqp0-9-1.stripped.extended'; | ||
var handle = new ConnectionHandle(socket, spec); | ||
handle.once('init', function() { | ||
handle.openAMQPCommunication('guest', 'guest', true, | ||
function() { | ||
HANDLES.push(handle); | ||
callback(); | ||
}); | ||
bramqp.initialize(socket, 'rabbitmq/full/amqp0-9-1.stripped.extended', function(error, handle){ | ||
handle.openAMQPCommunication('guest', 'guest', true, function() { | ||
HANDLES[i] = handle; | ||
callback(); | ||
}); | ||
@@ -43,5 +37,3 @@ }); | ||
function connectAllSeries(callback) { | ||
async.eachSeries([0,1,2,3,4], function(i, seriesCallback) { | ||
connectAMQP(i, seriesCallback); | ||
}, callback); | ||
async.eachSeries([0,1,2,3,4], connectAMQP, callback); | ||
} | ||
@@ -54,11 +46,6 @@ | ||
var bail = setTimeout(function() { | ||
self.callback(false, i); | ||
}, 2500); | ||
var ex = 'TestEX-' + i.toString(); | ||
handle.exchange.declare(1, ex, 'direct', false, false, false, false, false, {}, function() { | ||
handle.once('exchange.declare-ok', function() { | ||
clearTimeout(bail); | ||
self.callback(true, i); | ||
self.callback(null, i); | ||
}); | ||
@@ -74,11 +61,6 @@ }); | ||
var bail = setTimeout(function() { | ||
self.callback(false, i); | ||
}, 2500); | ||
var q = 'TestQ-' + i.toString(); | ||
handle.queue.declare(1, q, false, function() { | ||
handle.once('queue.declare-ok', function() { | ||
clearTimeout(bail); | ||
self.callback(true, i); | ||
self.callback(null, i); | ||
}); | ||
@@ -89,7 +71,4 @@ }); | ||
var verifyDeclare = function() { | ||
return function(success, i, error) { | ||
disconnectAMQP(i); | ||
assert.strictEqual(success, true); | ||
}; | ||
var verifyDeclare = function(i) { | ||
disconnectAMQP(i); | ||
}; | ||
@@ -100,27 +79,23 @@ | ||
topic : function() { | ||
HANDLES = []; | ||
connectAllSeries(this.callback); | ||
}, | ||
'assume connected' : function() { | ||
assert.equal(5, HANDLES.length); | ||
}, | ||
'exchange declare 0' : { | ||
topic: exchangeDeclare(0), | ||
'check exchange declared': verifyDeclare() | ||
'check exchange declared': verifyDeclare | ||
}, | ||
'exchange declare 1' : { | ||
topic: exchangeDeclare(1), | ||
'check exchange declared': verifyDeclare() | ||
'check exchange declared': verifyDeclare | ||
}, | ||
'exchange declare 2' : { | ||
topic: exchangeDeclare(2), | ||
'check exchange declared': verifyDeclare() | ||
'check exchange declared': verifyDeclare | ||
}, | ||
'exchange declare 3' : { | ||
topic: exchangeDeclare(3), | ||
'check exchange declared': verifyDeclare() | ||
'check exchange declared': verifyDeclare | ||
}, | ||
'exchange declare 4' : { | ||
topic: exchangeDeclare(4), | ||
'check exchange declared': verifyDeclare() | ||
'check exchange declared': verifyDeclare | ||
} | ||
@@ -131,27 +106,23 @@ } | ||
topic : function() { | ||
HANDLES = []; | ||
connectAllSeries(this.callback); | ||
}, | ||
'assume connected' : function() { | ||
assert.equal(5, HANDLES.length); | ||
}, | ||
'queue declare 0' : { | ||
topic: queueDeclare(0), | ||
'check queue declared': verifyDeclare() | ||
'check queue declared': verifyDeclare | ||
}, | ||
'queue declare 1' : { | ||
topic: queueDeclare(1), | ||
'check queue declared': verifyDeclare() | ||
'check queue declared': verifyDeclare | ||
}, | ||
'queue declare 2' : { | ||
topic: queueDeclare(2), | ||
'check queue declared': verifyDeclare() | ||
'check queue declared': verifyDeclare | ||
}, | ||
'queue declare 3' : { | ||
topic: queueDeclare(3), | ||
'check queue declared': verifyDeclare() | ||
'check queue declared': verifyDeclare | ||
}, | ||
'queue declare 4' : { | ||
topic: queueDeclare(4), | ||
'check queue declared': verifyDeclare() | ||
'check queue declared': verifyDeclare | ||
} | ||
@@ -158,0 +129,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
597520
3945