[Groonga-commit] droonga/fluent-plugin-droonga at bd88e11 [master] dataset: add plugins reader

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Mar 17 19:15:24 JST 2014


Kouhei Sutou	2014-03-17 19:15:24 +0900 (Mon, 17 Mar 2014)

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

  Message:
    dataset: add plugins reader

  Modified files:
    lib/droonga/catalog/dataset.rb
    lib/droonga/dispatcher.rb
    test/unit/catalog/test_dataset.rb

  Modified: lib/droonga/catalog/dataset.rb (+4 -0)
===================================================================
--- lib/droonga/catalog/dataset.rb    2014-03-17 19:13:52 +0900 (2648ad3)
+++ lib/droonga/catalog/dataset.rb    2014-03-17 19:15:24 +0900 (b14b835)
@@ -37,6 +37,10 @@ module Droonga
       def schema
         @schema ||= Droonga::Catalog::Schema.new(@name, @data["schema"])
       end
+
+      def plugins
+        @data["plugins"] || []
+      end
     end
   end
 end

  Modified: lib/droonga/dispatcher.rb (+3 -3)
===================================================================
--- lib/droonga/dispatcher.rb    2014-03-17 19:13:52 +0900 (17c82b0)
+++ lib/droonga/dispatcher.rb    2014-03-17 19:15:24 +0900 (dfa61e4)
@@ -260,19 +260,19 @@ module Droonga
 
     def create_adapter_runners
       create_runners do |dataset|
-        AdapterRunner.new(self, dataset["plugins"] || [])
+        AdapterRunner.new(self, dataset.plugins)
       end
     end
 
     def create_collector_runners
       create_runners do |dataset|
-        CollectorRunner.new(dataset["plugins"] || [])
+        CollectorRunner.new(dataset.plugins)
       end
     end
 
     def create_step_runners
       create_runners do |dataset|
-        StepRunner.new(dataset["plugins"] || [])
+        StepRunner.new(dataset.plugins)
       end
     end
 

  Modified: test/unit/catalog/test_dataset.rb (+17 -0)
===================================================================
--- test/unit/catalog/test_dataset.rb    2014-03-17 19:13:52 +0900 (50a6d6f)
+++ test/unit/catalog/test_dataset.rb    2014-03-17 19:15:24 +0900 (5d6ef74)
@@ -42,4 +42,21 @@ class CatalogDatasetTest < Test::Unit::TestCase
                    dataset.schema)
     end
   end
+
+  class PluginsTest < self
+    def test_nonexistent
+      data = {
+      }
+      dataset = create_dataset("dataset_name", data)
+      assert_equal([], dataset.plugins)
+    end
+
+    def test_multiple
+      data = {
+        "plugins" => ["groonga", "crud"],
+      }
+      dataset = create_dataset("dataset_name", data)
+      assert_equal(["groonga", "crud"], dataset.plugins)
+    end
+  end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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