[Groonga-commit] groonga/gcs [master] Fix bugs around auto migration

Back to archive index

SHIMODA Hiroshi null+****@clear*****
Mon Aug 13 15:40:13 JST 2012


SHIMODA Hiroshi	2012-08-13 15:40:13 +0900 (Mon, 13 Aug 2012)

  New Revision: 67c79d0eca8baf728679a6ff51a9c96570f8c7fd
  https://github.com/groonga/gcs/commit/67c79d0eca8baf728679a6ff51a9c96570f8c7fd

  Log:
    Fix bugs around auto migration

  Modified files:
    lib/batch/processor.js
    test/batch-processor.test.js
    test/fixture/companies/add-multiple-values.sdf.json

  Modified: lib/batch/processor.js (+1 -1)
===================================================================
--- lib/batch/processor.js    2012-08-13 15:14:44 +0900 (48ed258)
+++ lib/batch/processor.js    2012-08-13 15:40:13 +0900 (0fe2a39)
@@ -104,7 +104,7 @@ Processor.prototype = {
             if (!field.multipleValues)
               field.upgradeToMultipleValuesSync();
           }
-        });
+        }, this);
         this.domain.addRecordSync(record);
         results.adds++;
         break;

  Modified: test/batch-processor.test.js (+11 -41)
===================================================================
--- test/batch-processor.test.js    2012-08-13 15:14:44 +0900 (0f1e313)
+++ test/batch-processor.test.js    2012-08-13 15:40:13 +0900 (2bf68aa)
@@ -80,66 +80,36 @@ suite('batch/processor/Processor (instance methods)', function() {
   });
 
   test('loadSync: auto migration to multiple values field', function() {
+    var field = processor.domain.getIndexField('product');
+    assert.isFalse(field.multipleValues);
+
     var batches = fs.readFileSync(__dirname + '/fixture/companies/add-multiple-values.sdf.json', 'UTF-8');
     batches = JSON.parse(batches);
     var result = processor.loadSync(batches);
-
-    var field = processor.domain.getIndexField('product');
     assert.isTrue(field.multipleValues);
 
     var dump = [
           { id: 'id1',
             name: 'Brazil',
+            description: '',
             address: 'Shibuya, Tokyo, Japan',
-            email_address: 'info �� razil.jp',
             age: 1,
+            email_address: 'info �� razil.jp',
             product: ['moritapo','groonga'] },
-          { id: 'id2',
-            name: 'Enishi Tech Inc.',
-            address: 'Sapporo, Hokkaido, Japan',
-            email_address: 'info �� enishi-tech.com',
-            age: 2,
-            product: ['nroonga','groonga'] },
-          { id: 'id3',
-            name: 'ClearCode Inc.',
-            address: 'Hongo, Tokyo, Japan',
-            email_address: 'info �� clear-code.com',
-            age: 3,
-            product: ['cutter','groonga'] },
-          { id: 'id4', 
-            name: 'Anaheim Electronics',
-            address: 'Granada, Moon',
-            age: 4,
-            product: ['hi-zack','gundam'] },
-          { id: 'id5',
-            name: 'Shinsei Industry',
-            address: 'Earth',
-            age: 5,
-            product: ['valkyrie'] },
-          { type: 'add',
+          { id: 'id6',
             name: 'Omni Consumer Products',
+            description: '',
+            description: '',
             address: 'Detroit and Delta City, Michigan, United States',
             age: 6,
+            email_address: '',
             product: ['robocop'] },
-          { id: 'id7',
-            name: 'Capsule Corporation',
-            address: ['West City'],
-            age: 7,
-            product: ['time machine'] },
-          { id: 'id8',
-            name: 'Stark Industries',
-            address: 'United States',
-            age: 8,
-            product: ['iron man'] },
-          { id: 'id9',
-            name: 'Umbrella Corporation',
-            address: 'Tokyo, Japan',
-            age: 9,
-            product: ['tyrant'] },
           { id: 'id10',
             name: 'U.S. Robots and Mechanical Men',
+            description: '',
             address: 'New York, United States',
             age: 10,
+            email_address: '',
             product: ['ndr114'] }
         ];
     assertSuccess(result, 10, 0, dump);

  Modified: test/fixture/companies/add-multiple-values.sdf.json (+0 -86)
===================================================================
--- test/fixture/companies/add-multiple-values.sdf.json    2012-08-13 15:14:44 +0900 (bb3e11b)
+++ test/fixture/companies/add-multiple-values.sdf.json    2012-08-13 15:40:13 +0900 (7fdf696)
@@ -14,56 +14,6 @@
   },
   {
     "type": "add",
-    "id": "id2",
-    "version": 1,
-    "lang": "en",
-    "fields": {
-      "name": "Enishi Tech Inc.",
-      "address": "Sapporo, Hokkaido, Japan",
-      "email_address": "info �� enishi-tech.com",
-      "age": 2,
-      "product": ["nroonga","groonga"]
-    }
-  },
-  {
-    "type": "add",
-    "id": "id3",
-    "version": 1,
-    "lang": "en",
-    "fields": {
-      "name": "ClearCode Inc.",
-      "address": "Hongo, Tokyo, Japan",
-      "email_address": "info �� clear-code.com",
-      "age": 3,
-      "product": ["cutter","groonga"]
-    }
-  },
-  {
-    "type": "add",
-    "id": "id4",
-    "version": 1,
-    "lang": "en",
-    "fields": {
-      "name": "Anaheim Electronics",
-      "address": "Granada, Moon",
-      "age": 4,
-      "product": ["hi-zack","gundam"]
-    }
-  },
-  {
-    "type": "add",
-    "id": "id5",
-    "version": 1,
-    "lang": "en",
-    "fields": {
-      "name": "Shinsei Industry",
-      "address": "Earth",
-      "age": 5,
-      "product": "valkyrie"
-    }
-  },
-  {
-    "type": "add",
     "id": "id6",
     "version": 1,
     "lang": "en",
@@ -76,42 +26,6 @@
   },
   {
     "type": "add",
-    "id": "id7",
-    "version": 1,
-    "lang": "en",
-    "fields": {
-      "name": "Capsule Corporation",
-      "address": "West City",
-      "age": 7,
-      "product": "time machine"
-    }
-  },
-  {
-    "type": "add",
-    "id": "id8",
-    "version": 1,
-    "lang": "en",
-    "fields": {
-      "name": "Stark Industries",
-      "address": "United States",
-      "age": 8,
-      "product": "iron man"
-    }
-  },
-  {
-    "type": "add",
-    "id": "id9",
-    "version": 1,
-    "lang": "en",
-    "fields": {
-      "name": "Umbrella Corporation",
-      "address": "Tokyo, Japan",
-      "age": 9,
-      "product": "tyrant"
-    }
-  },
-  {
-    "type": "add",
     "id": "id10",
     "version": 1,
     "lang": "en",
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index