[Groonga-commit] groonga/gcs [master] Update clietn with domain name automatically

アーカイブの一覧に戻る

YUKI Hiroshi null+****@clear*****
Mon Dec 17 18:52:06 JST 2012


YUKI Hiroshi	2012-12-17 18:52:06 +0900 (Mon, 17 Dec 2012)

  New Revision: 55b77526e1ea61064001796d8c0996c50978958b
  https://github.com/groonga/gcs/commit/55b77526e1ea61064001796d8c0996c50978958b

  Log:
    Update clietn with domain name automatically

  Modified files:
    lib/client.js
    test/scenarios/search/_setup.json
    tools/scenario-runner.js

  Modified: lib/client.js (+4 -3)
===================================================================
--- lib/client.js    2012-12-17 18:44:20 +0900 (e697d29)
+++ lib/client.js    2012-12-17 18:52:06 +0900 (247411f)
@@ -60,7 +60,8 @@ Client.prototype = {
   },
   setupAPI: function(type, callback) {
     this.cachedAPI = this.cachedAPI || {};
-    if (type in this.cachedAPI)
+    var name = this.domainName + '_' + type;
+    if (name in this.cachedAPI)
       return this.cacnedAPI[type];
 
     var self = this;
@@ -74,7 +75,7 @@ Client.prototype = {
         port: parsedEndpoint[4] || 80,
         klass: definition.klass
       });
-      this.cachedAPI[type] = api;
+      this.cachedAPI[name] = api;
       return callback(api);
     }
 
@@ -91,7 +92,7 @@ Client.prototype = {
           port: endpoint[1] || 80,
           klass: definition.klass
         });
-        self.cachedAPI[type] = api;
+        self.cachedAPI[name] = api;
         callback(api);
       } catch(error) {
         self.raiseFatalError(error);

  Modified: test/scenarios/search/_setup.json (+4 -3)
===================================================================
--- test/scenarios/search/_setup.json    2012-12-17 18:44:20 +0900 (fdafcfa)
+++ test/scenarios/search/_setup.json    2012-12-17 18:52:06 +0900 (bdd1559)
@@ -32,8 +32,9 @@
                   "IndexFieldName": "product",
                   "IndexFieldType": "literal",
                   "LiteralOptions.FacetEnabled": "true" } },
-    { "name": "upload",
-      "type": "doc",
-      "body": "%ROOT%/test/fixture/companies/add.sdf.json" }
+    { "name":   "upload",
+      "api":    "doc",
+      "domain": "companies",
+      "body":   "%ROOT%/test/fixture/companies/add.sdf.json" }
   ]
 ]

  Modified: tools/scenario-runner.js (+3 -1)
===================================================================
--- tools/scenario-runner.js    2012-12-17 18:44:20 +0900 (9b4c6a1)
+++ tools/scenario-runner.js    2012-12-17 18:52:06 +0900 (e3192e6)
@@ -282,7 +282,7 @@ ScenarioRunner.prototype._process = function(scenario, callback) {
     }
   };
 
-  switch (request.type) {
+  switch (request.api) {
     case 'doc':
       var batches = request.body;
       if (typeof batches == 'string') {
@@ -290,11 +290,13 @@ ScenarioRunner.prototype._process = function(scenario, callback) {
         path = path.replace(/%ROOT%/gim, __dirname + '/../');
         batches = this.client.readSDFBatch(path);
       }
+      this.client.domainName = request.domain;
       return this.client.setupAPI('doc', function(documentsAPI) {
         documentsAPI.DocumentsBatch({ Docs: batches }, requestCallback);
       });
 
     case 'search':
+      this.client.domainName = request.domain;
       return this.client.setupAPI('search', function(searchAPI) {
         searchAPI.Search(request.params, requestCallback);
       });
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る