Adding UT for object based message parameters.

This commit is contained in:
Andre Rodrigues 2012-02-10 14:52:04 -08:00
Родитель a882a05da8
Коммит 4b2bf932a8
1 изменённых файлов: 67 добавлений и 0 удалений

Просмотреть файл

@ -453,6 +453,37 @@ module.exports = testCase(
});
},
testPeekLockedMessageCanBeCompletedWithObject: function (test) {
var queueName = testutil.generateId(queueNamesPrefix, queueNames);
var messageText = 'hi there again';
serviceBusService.createQueue(queueName, function (createError, queue) {
test.equal(createError, null);
test.notEqual(queue, null);
serviceBusService.sendQueueMessage(queueName, messageText, function (sendError) {
test.equal(sendError, null);
// Peek the message
serviceBusService.receiveQueueMessage(queueName, { isPeekLock: true, timeoutIntervalInS: 5 }, function (receiveError, message) {
test.equal(receiveError, null);
test.equal(message.body, messageText);
test.notEqual(message.location, null);
test.notEqual(message.brokerProperties.LockToken, null);
test.notEqual(message.brokerProperties.LockedUntilUtc, null);
// deleted message
serviceBusService.deleteMessage(message, function (deleteError) {
test.equal(deleteError, null);
test.done();
});
});
});
});
},
testPeekLockedMessageCanBeUnlocked: function (test) {
var queueName = testutil.generateId(queueNamesPrefix, queueNames);
var messageText = 'hi there again';
@ -489,6 +520,42 @@ module.exports = testCase(
});
},
testPeekLockedMessageCanBeUnlockedWithObject: function (test) {
var queueName = testutil.generateId(queueNamesPrefix, queueNames);
var messageText = 'hi there again';
serviceBusService.createQueue(queueName, function (createError, queue) {
test.equal(createError, null);
test.notEqual(queue, null);
serviceBusService.sendQueueMessage(queueName, messageText, function (sendError) {
test.equal(sendError, null);
// Peek the message
serviceBusService.receiveQueueMessage(queueName, { isPeekLock: true, timeoutIntervalInS: 5 }, function (receiveError1, message1) {
test.equal(receiveError1, null);
test.equal(message1.body, messageText);
test.notEqual(message1.location, null);
test.notEqual(message1.brokerProperties.LockToken, null);
test.notEqual(message1.brokerProperties.LockedUntilUtc, null);
// deleted message
serviceBusService.unlockMessage(message1, function (unlockError) {
test.equal(unlockError, null);
serviceBusService.receiveQueueMessage(queueName, function (receiveError2, receiveMessage2) {
test.equal(receiveError2, null);
test.notEqual(receiveMessage2, null);
test.done();
});
});
});
});
});
},
testCreateTopic: function (test) {
var topicName = testutil.generateId(topicNamesPrefix, topicNames);
var topicOptions = {