Yoji SHIDARA
null+****@clear*****
Thu Oct 4 14:30:01 JST 2012
Yoji SHIDARA 2012-10-04 14:30:01 +0900 (Thu, 04 Oct 2012) New Revision: c12fdd9dbacf8c48ded26ca108ba6f5a24282b7b https://github.com/groonga/gcs/commit/c12fdd9dbacf8c48ded26ca108ba6f5a24282b7b Log: Return error when creating domain w/ existing name Modified files: lib/database/domain.js test/api-configuration.test.js Modified: lib/database/domain.js (+4 -0) =================================================================== --- lib/database/domain.js 2012-09-05 14:32:58 +0900 (b3afced) +++ lib/database/domain.js 2012-10-04 14:30:01 +0900 (7221ca5) @@ -274,6 +274,10 @@ Domain.prototype = { if (!this.context) throw new Error('no context'); + if (this.exists()) { + throw new Error('domain exists'); + } + this.context.commandSync('table_create', { name: this.tableName, flags: nroonga.TABLE_HASH_KEY, Modified: test/api-configuration.test.js (+12 -0) =================================================================== --- test/api-configuration.test.js 2012-09-05 14:32:58 +0900 (cedcbff) +++ test/api-configuration.test.js 2012-10-04 14:30:01 +0900 (d714b54) @@ -65,6 +65,18 @@ suite('Configuration API', function() { }); }); + test('multiple Action=CreateDomain requests for the same domain', function(done) { + utils + .get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01') + .get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01') + .next(function(response) { + assert.notEqual(response.statusCode, 200); + done(); + }).error(function(error) { + done(error) + }); + }); + test('Action=DeleteDomain', function(done) { var domain; utils -------------- next part -------------- HTML����������������������������...Download