[Groonga-commit] droonga/fluent-plugin-droonga at c285fb6 [master] schema: Add readers for table options

Back to archive index

Yoji Shidara null+****@clear*****
Tue Feb 18 14:19:12 JST 2014


Yoji Shidara	2014-02-18 14:19:12 +0900 (Tue, 18 Feb 2014)

  New Revision: c285fb621d3ba41c862a33dfd8274aaaea60c9aa
  https://github.com/droonga/fluent-plugin-droonga/commit/c285fb621d3ba41c862a33dfd8274aaaea60c9aa

  Message:
    schema: Add readers for table options

  Modified files:
    lib/droonga/catalog/schema.rb
    test/unit/catalog/test_schema.rb

  Modified: lib/droonga/catalog/schema.rb (+16 -0)
===================================================================
--- lib/droonga/catalog/schema.rb    2014-02-18 14:17:45 +0900 (3e0a44a)
+++ lib/droonga/catalog/schema.rb    2014-02-18 14:19:12 +0900 (90a4eca)
@@ -47,6 +47,22 @@ module Droonga
             columns == other.columns
         end
 
+        def type
+          @data["type"]
+        end
+
+        def key_type
+          @data["keyType"]
+        end
+
+        def tokenizer
+          @data["tokenizer"]
+        end
+
+        def normalizer
+          @data["normalizer"]
+        end
+
         private
         def columns_data
           @data["columns"] || []

  Modified: test/unit/catalog/test_schema.rb (+44 -0)
===================================================================
--- test/unit/catalog/test_schema.rb    2014-02-18 14:17:45 +0900 (a4fce62)
+++ test/unit/catalog/test_schema.rb    2014-02-18 14:19:12 +0900 (76a49a6)
@@ -40,5 +40,49 @@ class CatalogSchemaTest < Test::Unit::TestCase
         }).tables
       )
     end
+
+    class TableTest < self
+      def create_table(name, data)
+        Droonga::Catalog::Schema::Table.new(name, data)
+      end
+
+      def test_name
+        assert_equal("table_name",
+                     create_table("table_name",
+                                  {}).name)
+      end
+
+      def test_type
+        assert_equal("Hash",
+                     create_table("table_name",
+                                  {
+                                    "type" => "Hash"
+                                  }).type)
+      end
+
+      def test_key_type
+        assert_equal("ShortText",
+                     create_table("table_name",
+                                  {
+                                    "keyType" => "ShortText"
+                                  }).key_type)
+      end
+
+      def test_tokenizer
+        assert_equal("TokenBigram",
+                     create_table("table_name",
+                                  {
+                                    "tokenizer" => "TokenBigram"
+                                  }).tokenizer)
+      end
+
+      def test_normalizer
+        assert_equal("NormalizerAuto",
+                     create_table("table_name",
+                                  {
+                                    "normalizer" => "NormalizerAuto"
+                                  }).normalizer)
+      end
+    end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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