YUKI Hiroshi
null+****@clear*****
Fri Oct 11 17:20:02 JST 2013
YUKI Hiroshi 2013-10-11 17:20:02 +0900 (Fri, 11 Oct 2013) New Revision: 36765e2ea1ce64abb45018595f487822c7ef6d6b https://github.com/droonga/express-droonga/commit/36765e2ea1ce64abb45018595f487822c7ef6d6b Message: Implement "dataset" option to Connection#emitMessage Modified files: application.js lib/droonga-protocol/connection.js test/droonga-protocol/connection.test.js test/test-utils.js Modified: application.js (+1 -1) =================================================================== --- application.js 2013-10-04 19:09:10 +0900 (572b70d) +++ application.js 2013-10-11 17:20:02 +0900 (bf47d1e) @@ -8,7 +8,7 @@ var application = express(); var server = http.createServer(application); application.droonga({ prefix: '', - dataset: 'example', + defaultDataset: 'example', server: server }); Modified: lib/droonga-protocol/connection.js (+3 -3) =================================================================== --- lib/droonga-protocol/connection.js 2013-10-04 19:09:10 +0900 (cf672dc) +++ lib/droonga-protocol/connection.js 2013-10-11 17:20:02 +0900 (1e63caa) @@ -1,6 +1,6 @@ /** * var connection = new Connection({ tag: 'droonga', - * dataset: 'example', + * defaultDataset: 'example', * hostName: 'localhost', * port: 24224, * receiveHostName: 'localhost', @@ -46,7 +46,7 @@ Connection.prototype._init = function() { this._callbacks = {}; this._id = Date.now(); this.tag = this._params.tag || DEFAULT_FLUENT_TAG; - this.dataset = this._params.dataset || ''; + this.defaultDataset = this._params.defaultDataset || ''; this._initSender(); this._initReceiver(); }; @@ -132,7 +132,7 @@ Connection.prototype.emitMessage = function(type, body, callback, options) { date: getCurrentTime(), replyTo: replyTo, statusCode: 200, - dataset: this.dataset, + dataset: options.dataset || this.defaultDataset, type: type, body: body }; Modified: test/droonga-protocol/connection.test.js (+1 -1) =================================================================== --- test/droonga-protocol/connection.test.js 2013-10-04 19:09:10 +0900 (29c6773) +++ test/droonga-protocol/connection.test.js 2013-10-11 17:20:02 +0900 (80575e8) @@ -64,7 +64,7 @@ suite('Connection', function() { backend = newBackend; connection = new Connection({ tag: 'test', - dataset: 'test-dataset', + defaultDataset: 'test-dataset', hostName: 'localhost', port: utils.testSendPort, receivePort: utils.testReceivePort, Modified: test/test-utils.js (+4 -3) =================================================================== --- test/test-utils.js 2013-10-04 19:09:10 +0900 (f7b8174) +++ test/test-utils.js 2013-10-11 17:20:02 +0900 (121bd92) @@ -194,7 +194,7 @@ function setupApplication() { backend = newBackend; var connection = new Connection({ tag: testTag, - dataset: 'test-dataset', + defaultDataset: 'test-dataset', hostName: 'localhost', port: testSendPort, receivePort: testReceivePort, @@ -297,14 +297,15 @@ exports.createBackend = createBackend; Deferred.register('createBackend', createBackend); -function createEnvelope(type, body) { +function createEnvelope(type, body, options) { + options = options || {}; var now = new Date(); var envelope = { id: now.getTime(), date: now.toISOString(), replyTo: 'localhost:' + testReceivePort + '/' + testTag, statusCode: 200, - dataset: 'test-dataset', + dataset: options.dataset || 'test-dataset', type: type, body: body }; -------------- next part -------------- HTML����������������������������...Download