amqplib 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/Makefile +2 -1
- package/README.md +2 -2
- package/lib/api_args.js +2 -0
- package/lib/channel.js +22 -10
- package/lib/connect.js +6 -16
- package/lib/connection.js +2 -1
- package/lib/credentials.js +14 -0
- package/lib/defs.js +128 -0
- package/package.json +9 -8
- package/test/channel.js +73 -61
- package/test/connect.js +32 -7
- package/test/connection.js +47 -47
- package/test/mux.js +10 -6
- package/test/util.js +2 -2
package/test/channel.js
CHANGED
|
@@ -30,10 +30,10 @@ function baseChannelTest(client, server) {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
pair.server.read(8); // discard the protocol header
|
|
33
|
-
var s = util.runServer(pair.server, function(send,
|
|
34
|
-
conn_handshake(send,
|
|
33
|
+
var s = util.runServer(pair.server, function(send, wait) {
|
|
34
|
+
conn_handshake(send, wait)
|
|
35
35
|
.then(function() {
|
|
36
|
-
server(send,
|
|
36
|
+
server(send, wait, bothDone);
|
|
37
37
|
}, fail(bothDone));
|
|
38
38
|
});
|
|
39
39
|
};
|
|
@@ -46,18 +46,18 @@ function channelTest(client, server) {
|
|
|
46
46
|
if (LOG_ERRORS) ch.on('error', console.warn);
|
|
47
47
|
client(ch, done, conn);
|
|
48
48
|
},
|
|
49
|
-
function(send,
|
|
50
|
-
channel_handshake(send,
|
|
49
|
+
function(send, wait, done) {
|
|
50
|
+
channel_handshake(send, wait)
|
|
51
51
|
.then(function(ch) {
|
|
52
|
-
return server(send,
|
|
52
|
+
return server(send, wait, done, ch);
|
|
53
53
|
}).then(null, fail(done)); // so you can return a promise to let
|
|
54
54
|
// errors bubble out
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
function channel_handshake(send,
|
|
60
|
-
return
|
|
59
|
+
function channel_handshake(send, wait) {
|
|
60
|
+
return wait(defs.ChannelOpen)()
|
|
61
61
|
.then(function(open) {
|
|
62
62
|
assert.notEqual(0, open.channel);
|
|
63
63
|
send(defs.ChannelOpenOk, {channelId: Buffer.from('')}, open.channel);
|
|
@@ -91,7 +91,7 @@ test("open", channelTest(
|
|
|
91
91
|
function(ch, done) {
|
|
92
92
|
open(ch).then(succeed(done), fail(done));
|
|
93
93
|
},
|
|
94
|
-
function(send,
|
|
94
|
+
function(send, wait, done) {
|
|
95
95
|
done();
|
|
96
96
|
}));
|
|
97
97
|
|
|
@@ -100,8 +100,8 @@ test("bad server", baseChannelTest(
|
|
|
100
100
|
var ch = new Channel(c);
|
|
101
101
|
open(ch).then(fail(done), succeed(done));
|
|
102
102
|
},
|
|
103
|
-
function(send,
|
|
104
|
-
return
|
|
103
|
+
function(send, wait, done) {
|
|
104
|
+
return wait(defs.ChannelOpen)()
|
|
105
105
|
.then(function(open) {
|
|
106
106
|
send(defs.ChannelCloseOk, {}, open.channel);
|
|
107
107
|
}).then(succeed(done), fail(done));
|
|
@@ -117,8 +117,8 @@ test("open, close", channelTest(
|
|
|
117
117
|
})
|
|
118
118
|
.then(succeed(done), fail(done));
|
|
119
119
|
},
|
|
120
|
-
function(send,
|
|
121
|
-
return
|
|
120
|
+
function(send, wait, done, ch) {
|
|
121
|
+
return wait(defs.ChannelClose)()
|
|
122
122
|
.then(function(close) {
|
|
123
123
|
send(defs.ChannelCloseOk, {}, ch);
|
|
124
124
|
}).then(succeed(done), fail(done));
|
|
@@ -128,17 +128,19 @@ test("server close", channelTest(
|
|
|
128
128
|
function(ch, done) {
|
|
129
129
|
ch.on('error', function(error) {
|
|
130
130
|
assert.strictEqual(504, error.code);
|
|
131
|
+
assert.strictEqual(0, error.classId);
|
|
132
|
+
assert.strictEqual(0, error.methodId);
|
|
131
133
|
succeed(done)();
|
|
132
134
|
});
|
|
133
135
|
open(ch);
|
|
134
136
|
},
|
|
135
|
-
function(send,
|
|
137
|
+
function(send, wait, done, ch) {
|
|
136
138
|
send(defs.ChannelClose, {
|
|
137
139
|
replyText: 'Forced close',
|
|
138
140
|
replyCode: defs.constants.CHANNEL_ERROR,
|
|
139
141
|
classId: 0, methodId: 0
|
|
140
142
|
}, ch);
|
|
141
|
-
|
|
143
|
+
wait(defs.ChannelCloseOk)()
|
|
142
144
|
.then(succeed(done), fail(done));
|
|
143
145
|
}));
|
|
144
146
|
|
|
@@ -151,8 +153,8 @@ test("overlapping channel/server close", channelTest(
|
|
|
151
153
|
ch.closeBecause("Bye", defs.constants.REPLY_SUCCESS);
|
|
152
154
|
}, fail(both));
|
|
153
155
|
},
|
|
154
|
-
function(send,
|
|
155
|
-
|
|
156
|
+
function(send, wait, done, ch) {
|
|
157
|
+
wait(defs.ChannelClose)()
|
|
156
158
|
.then(function() {
|
|
157
159
|
send(defs.ConnectionClose, {
|
|
158
160
|
replyText: 'Got there first',
|
|
@@ -160,7 +162,7 @@ test("overlapping channel/server close", channelTest(
|
|
|
160
162
|
classId: 0, methodId: 0
|
|
161
163
|
}, 0);
|
|
162
164
|
})
|
|
163
|
-
.then(
|
|
165
|
+
.then(wait(defs.ConnectionCloseOk))
|
|
164
166
|
.then(succeed(done), fail(done));
|
|
165
167
|
}));
|
|
166
168
|
|
|
@@ -174,8 +176,8 @@ test("double close", channelTest(
|
|
|
174
176
|
});
|
|
175
177
|
}).then(succeed(done), fail(done));
|
|
176
178
|
},
|
|
177
|
-
function(send,
|
|
178
|
-
|
|
179
|
+
function(send, wait, done, ch) {
|
|
180
|
+
wait(defs.ChannelClose)()
|
|
179
181
|
.then(function() {
|
|
180
182
|
send(defs.ChannelCloseOk, {
|
|
181
183
|
}, ch);
|
|
@@ -208,16 +210,16 @@ test("RPC", channelTest(
|
|
|
208
210
|
ch._rpc(defs.BasicQos, fields, defs.BasicQosOk, wheeboom);
|
|
209
211
|
}).then(null, fail(rpcLatch));
|
|
210
212
|
},
|
|
211
|
-
function(send,
|
|
213
|
+
function(send, wait, done, ch) {
|
|
212
214
|
function sendOk(f) {
|
|
213
215
|
send(defs.BasicQosOk, {}, ch);
|
|
214
216
|
}
|
|
215
217
|
|
|
216
|
-
return
|
|
218
|
+
return wait(defs.BasicQos)()
|
|
217
219
|
.then(sendOk)
|
|
218
|
-
.then(
|
|
220
|
+
.then(wait(defs.BasicQos))
|
|
219
221
|
.then(sendOk)
|
|
220
|
-
.then(
|
|
222
|
+
.then(wait(defs.BasicQos))
|
|
221
223
|
.then(sendOk)
|
|
222
224
|
.then(succeed(done), fail(done));
|
|
223
225
|
}));
|
|
@@ -229,6 +231,8 @@ test("Bad RPC", channelTest(
|
|
|
229
231
|
var errLatch = latch(2, done);
|
|
230
232
|
ch.on('error', function(error) {
|
|
231
233
|
assert.strictEqual(505, error.code);
|
|
234
|
+
assert.strictEqual(60, error.classId);
|
|
235
|
+
assert.strictEqual(72, error.methodId);
|
|
232
236
|
succeed(errLatch)();
|
|
233
237
|
});
|
|
234
238
|
|
|
@@ -241,12 +245,12 @@ test("Bad RPC", channelTest(
|
|
|
241
245
|
});
|
|
242
246
|
}, fail(errLatch));
|
|
243
247
|
},
|
|
244
|
-
function(send,
|
|
245
|
-
return
|
|
248
|
+
function(send, wait, done, ch) {
|
|
249
|
+
return wait()()
|
|
246
250
|
.then(function() {
|
|
247
251
|
send(defs.BasicGetEmpty, {clusterId: ''}, ch);
|
|
248
252
|
}) // oh wait! that was wrong! expect a channel close
|
|
249
|
-
.then(
|
|
253
|
+
.then(wait(defs.ChannelClose))
|
|
250
254
|
.then(function() {
|
|
251
255
|
send(defs.ChannelCloseOk, {}, ch);
|
|
252
256
|
}).then(succeed(done), fail(done));
|
|
@@ -259,6 +263,8 @@ test("RPC on closed channel", channelTest(
|
|
|
259
263
|
var close = new Promise(function(resolve) {
|
|
260
264
|
ch.on('error', function(error) {
|
|
261
265
|
assert.strictEqual(504, error.code);
|
|
266
|
+
assert.strictEqual(0, error.classId);
|
|
267
|
+
assert.strictEqual(0, error.methodId);
|
|
262
268
|
resolve();
|
|
263
269
|
});
|
|
264
270
|
});
|
|
@@ -284,15 +290,15 @@ test("RPC on closed channel", channelTest(
|
|
|
284
290
|
.then(succeed(done))
|
|
285
291
|
.catch(fail(done));
|
|
286
292
|
},
|
|
287
|
-
function(send,
|
|
288
|
-
|
|
293
|
+
function(send, wait, done, ch) {
|
|
294
|
+
wait(defs.BasicRecover)()
|
|
289
295
|
.then(function() {
|
|
290
296
|
send(defs.ChannelClose, {
|
|
291
297
|
replyText: 'Nuh-uh!',
|
|
292
298
|
replyCode: defs.constants.CHANNEL_ERROR,
|
|
293
299
|
methodId: 0, classId: 0
|
|
294
300
|
}, ch);
|
|
295
|
-
return
|
|
301
|
+
return wait(defs.ChannelCloseOk);
|
|
296
302
|
})
|
|
297
303
|
.then(succeed(done))
|
|
298
304
|
.catch(fail(done));
|
|
@@ -309,10 +315,10 @@ test("publish all < single chunk threshold", channelTest(
|
|
|
309
315
|
})
|
|
310
316
|
.then(succeed(done), fail(done));
|
|
311
317
|
},
|
|
312
|
-
function(send,
|
|
313
|
-
|
|
314
|
-
.then(
|
|
315
|
-
.then(
|
|
318
|
+
function(send, wait, done, ch) {
|
|
319
|
+
wait(defs.BasicPublish)()
|
|
320
|
+
.then(wait(defs.BasicProperties))
|
|
321
|
+
.then(wait(undefined)) // content frame
|
|
316
322
|
.then(function(f) {
|
|
317
323
|
assert.equal('foobar', f.content.toString());
|
|
318
324
|
}).then(succeed(done), fail(done));
|
|
@@ -328,10 +334,10 @@ test("publish content > single chunk threshold", channelTest(
|
|
|
328
334
|
}, {}, Buffer.alloc(3000));
|
|
329
335
|
}, done);
|
|
330
336
|
},
|
|
331
|
-
function(send,
|
|
332
|
-
|
|
333
|
-
.then(
|
|
334
|
-
.then(
|
|
337
|
+
function(send, wait, done, ch) {
|
|
338
|
+
wait(defs.BasicPublish)()
|
|
339
|
+
.then(wait(defs.BasicProperties))
|
|
340
|
+
.then(wait(undefined)) // content frame
|
|
335
341
|
.then(function(f) {
|
|
336
342
|
assert.equal(3000, f.content.length);
|
|
337
343
|
}).then(succeed(done), fail(done));
|
|
@@ -349,10 +355,10 @@ test("publish method & headers > threshold", channelTest(
|
|
|
349
355
|
}, Buffer.from('foobar'));
|
|
350
356
|
}, done);
|
|
351
357
|
},
|
|
352
|
-
function(send,
|
|
353
|
-
|
|
354
|
-
.then(
|
|
355
|
-
.then(
|
|
358
|
+
function(send, wait, done, ch) {
|
|
359
|
+
wait(defs.BasicPublish)()
|
|
360
|
+
.then(wait(defs.BasicProperties))
|
|
361
|
+
.then(wait(undefined)) // content frame
|
|
356
362
|
.then(function(f) {
|
|
357
363
|
assert.equal('foobar', f.content.toString());
|
|
358
364
|
}).then(succeed(done), fail(done));
|
|
@@ -372,11 +378,11 @@ test("publish zero-length message", channelTest(
|
|
|
372
378
|
}, {}, Buffer.alloc(0));
|
|
373
379
|
}, done);
|
|
374
380
|
},
|
|
375
|
-
function(send,
|
|
376
|
-
|
|
377
|
-
.then(
|
|
381
|
+
function(send, wait, done, ch) {
|
|
382
|
+
wait(defs.BasicPublish)()
|
|
383
|
+
.then(wait(defs.BasicProperties))
|
|
378
384
|
// no content frame for a zero-length message
|
|
379
|
-
.then(
|
|
385
|
+
.then(wait(defs.BasicPublish))
|
|
380
386
|
.then(succeed(done), fail(done));
|
|
381
387
|
}));
|
|
382
388
|
|
|
@@ -389,7 +395,7 @@ test("delivery", channelTest(
|
|
|
389
395
|
}, done);
|
|
390
396
|
});
|
|
391
397
|
},
|
|
392
|
-
function(send,
|
|
398
|
+
function(send, wait, done, ch) {
|
|
393
399
|
completes(function() {
|
|
394
400
|
send(defs.BasicDeliver, DELIVER_FIELDS, ch, Buffer.from('barfoo'));
|
|
395
401
|
}, done);
|
|
@@ -404,7 +410,7 @@ test("zero byte msg", channelTest(
|
|
|
404
410
|
}, done);
|
|
405
411
|
});
|
|
406
412
|
},
|
|
407
|
-
function(send,
|
|
413
|
+
function(send, wait, done, ch) {
|
|
408
414
|
completes(function() {
|
|
409
415
|
send(defs.BasicDeliver, DELIVER_FIELDS, ch, Buffer.from(''));
|
|
410
416
|
}, done);
|
|
@@ -415,16 +421,18 @@ test("bad delivery", channelTest(
|
|
|
415
421
|
var errorAndClose = latch(2, done);
|
|
416
422
|
ch.on('error', function(error) {
|
|
417
423
|
assert.strictEqual(505, error.code);
|
|
424
|
+
assert.strictEqual(60, error.classId);
|
|
425
|
+
assert.strictEqual(60, error.methodId);
|
|
418
426
|
succeed(errorAndClose)();
|
|
419
427
|
});
|
|
420
428
|
ch.on('close', succeed(errorAndClose));
|
|
421
429
|
open(ch);
|
|
422
430
|
},
|
|
423
|
-
function(send,
|
|
431
|
+
function(send, wait, done, ch) {
|
|
424
432
|
send(defs.BasicDeliver, DELIVER_FIELDS, ch);
|
|
425
433
|
// now send another deliver without having sent the content
|
|
426
434
|
send(defs.BasicDeliver, DELIVER_FIELDS, ch);
|
|
427
|
-
return
|
|
435
|
+
return wait(defs.ChannelClose)()
|
|
428
436
|
.then(function() {
|
|
429
437
|
send(defs.ChannelCloseOk, {}, ch);
|
|
430
438
|
}).then(succeed(done), fail(done));
|
|
@@ -441,7 +449,7 @@ test("bad content send", channelTest(
|
|
|
441
449
|
});
|
|
442
450
|
}, done);
|
|
443
451
|
},
|
|
444
|
-
function(send,
|
|
452
|
+
function(send, wait, done, ch) {
|
|
445
453
|
done();
|
|
446
454
|
}));
|
|
447
455
|
|
|
@@ -457,7 +465,7 @@ test("bad properties send", channelTest(
|
|
|
457
465
|
});
|
|
458
466
|
}, done);
|
|
459
467
|
},
|
|
460
|
-
function(send,
|
|
468
|
+
function(send, wait, done, ch) {
|
|
461
469
|
done();
|
|
462
470
|
}));
|
|
463
471
|
|
|
@@ -469,14 +477,16 @@ test("bad consumer", channelTest(
|
|
|
469
477
|
});
|
|
470
478
|
ch.on('error', function(error) {
|
|
471
479
|
assert.strictEqual(541, error.code);
|
|
480
|
+
assert.strictEqual(undefined, error.classId);
|
|
481
|
+
assert.strictEqual(undefined, error.methodId);
|
|
472
482
|
succeed(errorAndClose)();
|
|
473
483
|
});
|
|
474
484
|
ch.on('close', succeed(errorAndClose));
|
|
475
485
|
open(ch);
|
|
476
486
|
},
|
|
477
|
-
function(send,
|
|
487
|
+
function(send, wait, done, ch) {
|
|
478
488
|
send(defs.BasicDeliver, DELIVER_FIELDS, ch, Buffer.from('barfoo'));
|
|
479
|
-
return
|
|
489
|
+
return wait(defs.ChannelClose)()
|
|
480
490
|
.then(function() {
|
|
481
491
|
send(defs.ChannelCloseOk, {}, ch);
|
|
482
492
|
}).then(succeed(done), fail(done));
|
|
@@ -488,6 +498,8 @@ test("bad send in consumer", channelTest(
|
|
|
488
498
|
ch.on('close', succeed(errorAndClose));
|
|
489
499
|
ch.on('error', function(error) {
|
|
490
500
|
assert.strictEqual(541, error.code);
|
|
501
|
+
assert.strictEqual(undefined, error.classId);
|
|
502
|
+
assert.strictEqual(undefined, error.methodId);
|
|
491
503
|
succeed(errorAndClose)();
|
|
492
504
|
});
|
|
493
505
|
|
|
@@ -499,12 +511,12 @@ test("bad send in consumer", channelTest(
|
|
|
499
511
|
|
|
500
512
|
open(ch);
|
|
501
513
|
},
|
|
502
|
-
function(send,
|
|
514
|
+
function(send, wait, done, ch) {
|
|
503
515
|
completes(function() {
|
|
504
516
|
send(defs.BasicDeliver, DELIVER_FIELDS, ch,
|
|
505
517
|
Buffer.from('barfoo'));
|
|
506
518
|
}, done);
|
|
507
|
-
return
|
|
519
|
+
return wait(defs.ChannelClose)()
|
|
508
520
|
.then(function() {
|
|
509
521
|
send(defs.ChannelCloseOk, {}, ch);
|
|
510
522
|
}).then(succeed(done), fail(done));
|
|
@@ -519,7 +531,7 @@ test("return", channelTest(
|
|
|
519
531
|
});
|
|
520
532
|
open(ch);
|
|
521
533
|
},
|
|
522
|
-
function(send,
|
|
534
|
+
function(send, wait, done, ch) {
|
|
523
535
|
completes(function() {
|
|
524
536
|
send(defs.BasicReturn, DELIVER_FIELDS, ch, Buffer.from('barfoo'));
|
|
525
537
|
}, done);
|
|
@@ -534,7 +546,7 @@ test("cancel", channelTest(
|
|
|
534
546
|
});
|
|
535
547
|
open(ch);
|
|
536
548
|
},
|
|
537
|
-
function(send,
|
|
549
|
+
function(send, wait, done, ch) {
|
|
538
550
|
completes(function() {
|
|
539
551
|
send(defs.BasicCancel, {
|
|
540
552
|
consumerTag: 'product of society',
|
|
@@ -553,7 +565,7 @@ function confirmTest(variety, Method) {
|
|
|
553
565
|
});
|
|
554
566
|
open(ch);
|
|
555
567
|
},
|
|
556
|
-
function(send,
|
|
568
|
+
function(send, wait, done, ch) {
|
|
557
569
|
completes(function() {
|
|
558
570
|
send(Method, {
|
|
559
571
|
deliveryTag: 1,
|
|
@@ -579,7 +591,7 @@ test("out-of-order acks", channelTest(
|
|
|
579
591
|
ch.pushConfirmCallback(allConfirms);
|
|
580
592
|
open(ch);
|
|
581
593
|
},
|
|
582
|
-
function(send,
|
|
594
|
+
function(send, wait, done, ch) {
|
|
583
595
|
completes(function() {
|
|
584
596
|
send(defs.BasicAck, {deliveryTag: 2, multiple: false}, ch);
|
|
585
597
|
send(defs.BasicAck, {deliveryTag: 3, multiple: false}, ch);
|
|
@@ -602,7 +614,7 @@ test("not all out-of-order acks", channelTest(
|
|
|
602
614
|
});
|
|
603
615
|
open(ch);
|
|
604
616
|
},
|
|
605
|
-
function(send,
|
|
617
|
+
function(send, wait, done, ch) {
|
|
606
618
|
completes(function() {
|
|
607
619
|
send(defs.BasicAck, {deliveryTag: 2, multiple: false}, ch);
|
|
608
620
|
send(defs.BasicAck, {deliveryTag: 1, multiple: false}, ch);
|
package/test/connect.js
CHANGED
|
@@ -13,6 +13,8 @@ var format = require('util').format;
|
|
|
13
13
|
|
|
14
14
|
var URL = process.env.URL || 'amqp://localhost';
|
|
15
15
|
|
|
16
|
+
var urlparse = require('url-parse');
|
|
17
|
+
|
|
16
18
|
suite("Credentials", function() {
|
|
17
19
|
|
|
18
20
|
function checkCreds(creds, user, pass, done) {
|
|
@@ -27,29 +29,29 @@ suite("Credentials", function() {
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
test("no creds", function(done) {
|
|
30
|
-
var parts =
|
|
32
|
+
var parts = urlparse('amqp://localhost');
|
|
31
33
|
var creds = credentialsFromUrl(parts);
|
|
32
34
|
checkCreds(creds, 'guest', 'guest', done);
|
|
33
35
|
});
|
|
34
36
|
test("usual user:pass", function(done) {
|
|
35
|
-
var parts =
|
|
37
|
+
var parts = urlparse('amqp://user:pass@localhost')
|
|
36
38
|
var creds = credentialsFromUrl(parts);
|
|
37
39
|
checkCreds(creds, 'user', 'pass', done);
|
|
38
40
|
});
|
|
39
41
|
test("missing user", function(done) {
|
|
40
|
-
var parts =
|
|
42
|
+
var parts = urlparse('amqps://:password@localhost');
|
|
41
43
|
var creds = credentialsFromUrl(parts);
|
|
42
44
|
checkCreds(creds, '', 'password', done);
|
|
43
45
|
});
|
|
44
46
|
test("missing password", function(done) {
|
|
45
|
-
var parts =
|
|
47
|
+
var parts = urlparse('amqps://username:@localhost');
|
|
46
48
|
var creds = credentialsFromUrl(parts);
|
|
47
49
|
checkCreds(creds, 'username', '', done);
|
|
48
50
|
});
|
|
49
|
-
test("
|
|
50
|
-
var parts =
|
|
51
|
+
test("escaped colons", function(done) {
|
|
52
|
+
var parts = urlparse('amqp://user%3Aname:pass%3Aword@localhost')
|
|
51
53
|
var creds = credentialsFromUrl(parts);
|
|
52
|
-
checkCreds(creds, '
|
|
54
|
+
checkCreds(creds, 'user:name', 'pass:word', done);
|
|
53
55
|
});
|
|
54
56
|
});
|
|
55
57
|
|
|
@@ -77,6 +79,17 @@ suite("Connect API", function() {
|
|
|
77
79
|
connect(u, {}, kCallback(fail(done), succeed(done)));
|
|
78
80
|
});
|
|
79
81
|
|
|
82
|
+
test("serverProperties", function(done) {
|
|
83
|
+
var url = require('url');
|
|
84
|
+
var parts = url.parse(URL, true);
|
|
85
|
+
var config = parts.query || {};
|
|
86
|
+
connect(config, {}, function(err, connection) {
|
|
87
|
+
if (err) { return done(err); }
|
|
88
|
+
assert.equal(connection.serverProperties.product, 'RabbitMQ');
|
|
89
|
+
done();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
80
93
|
test("using custom heartbeat option", function(done) {
|
|
81
94
|
var url = require('url');
|
|
82
95
|
var parts = url.parse(URL, true);
|
|
@@ -105,6 +118,18 @@ suite("Connect API", function() {
|
|
|
105
118
|
kCallback(succeed(done), fail(done)));
|
|
106
119
|
});
|
|
107
120
|
|
|
121
|
+
test("using amqplain credentials", function(done) {
|
|
122
|
+
var url = require('url');
|
|
123
|
+
var parts = url.parse(URL, true);
|
|
124
|
+
var u = 'guest', p = 'guest';
|
|
125
|
+
if (parts.auth) {
|
|
126
|
+
var auth = parts.auth.split(":");
|
|
127
|
+
u = auth[0], p = auth[1];
|
|
128
|
+
}
|
|
129
|
+
connect(URL, {credentials: require('../lib/credentials').amqplain(u, p)},
|
|
130
|
+
kCallback(succeed(done), fail(done)));
|
|
131
|
+
});
|
|
132
|
+
|
|
108
133
|
test("using unsupported mechanism", function(done) {
|
|
109
134
|
var creds = {
|
|
110
135
|
mechanism: 'UNSUPPORTED',
|