forked from postwait/node-amqp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge https://github.com/khrome/node-amqp Conflicts: amqp.js
- Loading branch information
Showing
4 changed files
with
112 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require('./harness'); | ||
var testName = __filename.replace(__dirname+'/','').replace('.js',''); | ||
|
||
connection.addListener('ready', function () { | ||
puts("connected to " + connection.serverProperties.product); | ||
var callbacksCalled = 0; | ||
|
||
connection.exchange('node.'+testName+'.exchange', {type: 'topic'}, function(exchange) { | ||
connection.queue( 'node.'+testName+'.queue', { durable: false, autoDelete : true }, function (queue) { | ||
puts("Queue ready"); | ||
|
||
// main test for callback | ||
queue.bind(exchange, 'node.'+testName+'.topic.bindCallback.outer', function(q) { | ||
puts("First queue bind callback called"); | ||
callbacksCalled++; | ||
q.bind(exchange, 'node.'+testName+'.topic.bindCallback.inner', function() { | ||
puts("Second queue bind callback called"); | ||
callbacksCalled++; | ||
}); | ||
}); | ||
|
||
setTimeout(function() { | ||
assert.ok(callbacksCalled == 2, "Callback was not called"); | ||
puts("Cascaded queue bind callback succeeded"); | ||
connection.destroy();}, | ||
2000); | ||
}); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require('./harness'); | ||
var testName = __filename.replace(__dirname+'/','').replace('.js',''); | ||
|
||
connection.addListener('ready', function () { | ||
puts("connected to " + connection.serverProperties.product); | ||
|
||
connection.exchange('node.'+testName+'.exchange', {type: 'topic'}, function(exchange) { | ||
connection.queue( 'node.'+testName+'.queue', { durable: false, autoDelete : true }, function (queue) { | ||
puts("Queue ready"); | ||
|
||
// main test for sequential callback issue | ||
queue.bind( exchange, 'node.'+testName+'.topic.bindCallback1', function() { | ||
puts("bind callback called"); | ||
assert.ok(false, "This callback should not be called unless the sequential bind callback issue has been fixed");} | ||
); | ||
queue.bind( exchange, 'node.'+testName+'.topic.bindCallback2', function() { | ||
puts("bind callback called"); | ||
assert.ok(false, "This callback should not be called unless the sequential bind callback issue has been fixed");} | ||
); | ||
queue.bind( exchange, 'node.'+testName+'.topic.bindCallback2', function() { | ||
puts("bind callback called"); | ||
assert.ok(true, "This callback should have be called, as the last of the sequential callbacks");} | ||
); | ||
|
||
}); | ||
|
||
setTimeout(function() { connection.destroy();}, 2000); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require('./harness'); | ||
var testName = __filename.replace(__dirname+'/','').replace('.js',''); | ||
connection.addListener('ready', function () { | ||
puts("connected to " + connection.serverProperties.product); | ||
var callbackCalled = false; | ||
|
||
connection.exchange('node.'+testName+'.exchange', {type: 'topic'}, function(exchange) { | ||
connection.queue( 'node.'+testName+'.queue', { durable: false, autoDelete : true }, function (queue) { | ||
puts("Queue ready"); | ||
|
||
// main test for callback | ||
queue.bind(exchange, 'node.'+testName+'.topic.bindCallback', function() { | ||
puts("Single queue bind callback called"); | ||
callbackCalled = true; | ||
}); | ||
|
||
// nothing to be asserted / checked with these, other than they don't blow up. | ||
queue.bind(exchange, 'node.'+testName+'.topic.nullCallback', null); | ||
queue.bind(exchange, 'node.'+testName+'.topic.undefinedCallback', undefined); | ||
queue.bind(exchange, 'node.'+testName+'.topic.nonFunctionCallback', "Not a callback"); | ||
|
||
// Regression test for no callback being supplied not blowing up | ||
queue.bind(exchange, 'node.'+testName+'.topic.noCallback'); | ||
|
||
setTimeout(function() { | ||
assert.ok(callbackCalled, "Callback was not called"); | ||
puts("Single queue bind callback succeeded"); | ||
connection.destroy();}, | ||
2000); | ||
}); | ||
}); | ||
}); | ||
|