[Groonga-commit] droonga/fluent-plugin-droonga at 02280ee [master] Rename helper for plugin tests

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Nov 27 20:25:17 JST 2013


YUKI Hiroshi	2013-11-27 20:25:17 +0900 (Wed, 27 Nov 2013)

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

  Message:
    Rename helper for plugin tests
    
    HandlerHelper =>
    PluginHelper

  Modified files:
    test/unit/helper.rb
    test/unit/plugin/handler/groonga/test_column_create.rb
    test/unit/plugin/handler/groonga/test_table_create.rb
    test/unit/plugin/handler/test_groonga.rb
    test/unit/plugin/handler/test_search.rb
  Renamed files:
    test/unit/helper/plugin_helper.rb
      (from test/unit/helper/handler_helper.rb)
    test/unit/plugin/collector/test_basic.rb
      (from test/unit/plugin/handler/test_collector.rb)

  Modified: test/unit/helper.rb (+1 -1)
===================================================================
--- test/unit/helper.rb    2013-11-27 20:19:05 +0900 (f3a09be)
+++ test/unit/helper.rb    2013-11-27 20:25:17 +0900 (691466f)
@@ -16,7 +16,7 @@
 require_relative "helper/sandbox"
 require_relative "helper/fixture"
 require_relative "helper/stub_worker"
-require_relative "helper/handler_helper"
+require_relative "helper/plugin_helper"
 require_relative "helper/watch_helper"
 
 class Test::Unit::TestCase

  Renamed: test/unit/helper/plugin_helper.rb (+6 -6) 82%
===================================================================
--- test/unit/helper/handler_helper.rb    2013-11-27 20:19:05 +0900 (8c6e6f1)
+++ test/unit/helper/plugin_helper.rb    2013-11-27 20:25:17 +0900 (2c2d9c0)
@@ -13,19 +13,19 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-module HandlerHelper
-  def setup_handler(handler_class)
+module PluginHelper
+  def setup_plugin(plugin_class)
     @worker = StubWorker.new
-    @handler = handler_class.new(@worker)
+    @plugin = plugin_class.new(@worker)
 
     @messages = []
-    stub(@handler).emit do |*message|
+    stub(@plugin).emit do |*message|
       @messages << message
     end
   end
 
-  def teardown_handler
-    @handler = nil
+  def teardown_plugin
+    @plugin = nil
     @worker = nil
     @messages = nil
   end

  Renamed: test/unit/plugin/collector/test_basic.rb (+9 -9) 96%
===================================================================
--- test/unit/plugin/handler/test_collector.rb    2013-11-27 20:19:05 +0900 (972b5ab)
+++ test/unit/plugin/collector/test_basic.rb    2013-11-27 20:25:17 +0900 (17bfb1b)
@@ -15,16 +15,16 @@
 
 require "droonga/plugin/collector/basic"
 
-class BasicCollectorHandlerTest < Test::Unit::TestCase
-  include HandlerHelper
+class BasicCollectorTest < Test::Unit::TestCase
+  include PluginHelper
 
   def setup
     setup_database
-    setup_handler(Droonga::BasicCollector)
+    setup_plugin(Droonga::BasicCollector)
   end
 
   def teardown
-    teardown_handler
+    teardown_plugin
     teardown_database
   end
 
@@ -45,7 +45,7 @@ class BasicCollectorHandlerTest < Test::Unit::TestCase
         "name" => input_name,
         "descendants" => nil,
       }
-      @handler.process("collector_gather", request)
+      @plugin.process("collector_gather", request)
       assert_equal([input_value, input_name], @messages.last)
     end
   end
@@ -98,7 +98,7 @@ class BasicCollectorHandlerTest < Test::Unit::TestCase
         "name" => input_name,
         "descendants" => nil,
       }
-      @handler.process("collector_reduce", request)
+      @plugin.process("collector_reduce", request)
       assert_equal([
                      {
                        "numeric_key_records" => [
@@ -178,7 +178,7 @@ class BasicCollectorHandlerTest < Test::Unit::TestCase
         "name" => input_name,
         "descendants" => nil,
       }
-      @handler.process("collector_reduce", request)
+      @plugin.process("collector_reduce", request)
       assert_equal([
                      {
                        "numeric_key_records" => [
@@ -249,7 +249,7 @@ class BasicCollectorHandlerTest < Test::Unit::TestCase
         "name" => input_name,
         "descendants" => nil,
       }
-      @handler.process("collector_reduce", request)
+      @plugin.process("collector_reduce", request)
       assert_equal([
                      {
                        "numeric_key_records" => [
@@ -331,7 +331,7 @@ class BasicCollectorHandlerTest < Test::Unit::TestCase
         "name" => input_name,
         "descendants" => nil,
       }
-      @handler.process("collector_reduce", request)
+      @plugin.process("collector_reduce", request)
       assert_equal([
                      {
                        "numeric_key_records" => [

  Modified: test/unit/plugin/handler/groonga/test_column_create.rb (+12 -12)
===================================================================
--- test/unit/plugin/handler/groonga/test_column_create.rb    2013-11-27 20:19:05 +0900 (c7ac641)
+++ test/unit/plugin/handler/groonga/test_column_create.rb    2013-11-27 20:25:17 +0900 (0068663)
@@ -15,8 +15,8 @@
 
 class ColumnCreateTest < GroongaHandlerTest
   def test_success
-    @handler.table_create({"name" => "Books"})
-    @handler.column_create({"table" => "Books", "name" => "title", "type" => "ShortText"})
+    @plugin.table_create({"name" => "Books"})
+    @plugin.column_create({"table" => "Books", "name" => "title", "type" => "ShortText"})
     response =****@messa*****
     assert_equal(
       [[Droonga::GroongaHandler::Status::SUCCESS, NORMALIZED_START_TIME, NORMALIZED_ELAPSED_TIME], true],
@@ -25,8 +25,8 @@ class ColumnCreateTest < GroongaHandlerTest
   end
 
   def test_name
-    @handler.table_create({"name" => "Books"})
-    @handler.column_create({"table" => "Books", "name" => "title", "type" => "ShortText"})
+    @plugin.table_create({"name" => "Books"})
+    @plugin.column_create({"table" => "Books", "name" => "title", "type" => "ShortText"})
     assert_equal(<<-SCHEMA, dump)
 table_create Books TABLE_HASH_KEY --key_type ShortText
 column_create Books title COLUMN_SCALAR ShortText
@@ -34,8 +34,8 @@ column_create Books title COLUMN_SCALAR ShortText
   end
 
   def test_type
-    @handler.table_create({"name" => "Books"})
-    @handler.column_create({"table" => "Books", "name" => "main_text", "type" => "LongText"})
+    @plugin.table_create({"name" => "Books"})
+    @plugin.column_create({"table" => "Books", "name" => "main_text", "type" => "LongText"})
     assert_equal(<<-SCHEMA, dump)
 table_create Books TABLE_HASH_KEY --key_type ShortText
 column_create Books main_text COLUMN_SCALAR LongText
@@ -59,8 +59,8 @@ column_create Books main_text COLUMN_SCALAR LongText
           "type"  => "ShortText",
           "flags" => data[:flags],
         }
-        @handler.table_create({"name" => "Books"})
-        @handler.column_create(request)
+        @plugin.table_create({"name" => "Books"})
+        @plugin.column_create(request)
         assert_equal(<<-EXPECTED, dump)
 table_create Books TABLE_HASH_KEY --key_type ShortText
 column_create Books title #{data[:flags]} ShortText
@@ -71,8 +71,8 @@ column_create Books title #{data[:flags]} ShortText
     class IndexTest < self
       def setup
         super
-        @handler.table_create({"name" => "Books"})
-        @handler.column_create({"table" => "Books", "name" => "title", "type" => "ShortText"})
+        @plugin.table_create({"name" => "Books"})
+        @plugin.column_create({"table" => "Books", "name" => "title", "type" => "ShortText"})
       end
 
       def test_index_column_type
@@ -86,7 +86,7 @@ column_create Books title #{data[:flags]} ShortText
           "source" => "title",
           "flags"  => data[:flags],
         }
-        @handler.column_create(request)
+        @plugin.column_create(request)
         assert_equal(<<-EXPECTED, dump)
 table_create Books TABLE_HASH_KEY --key_type ShortText
 column_create Books title COLUMN_SCALAR ShortText
@@ -118,7 +118,7 @@ column_create Books entry_title #{data[:flags]} Books title
           "source" => "title",
           "flags"  => flags,
         }
-        @handler.column_create(request)
+        @plugin.column_create(request)
         assert_equal(<<-EXPECTED, dump)
 table_create Books TABLE_HASH_KEY --key_type ShortText
 column_create Books title COLUMN_SCALAR ShortText

  Modified: test/unit/plugin/handler/groonga/test_table_create.rb (+8 -8)
===================================================================
--- test/unit/plugin/handler/groonga/test_table_create.rb    2013-11-27 20:19:05 +0900 (2afe354)
+++ test/unit/plugin/handler/groonga/test_table_create.rb    2013-11-27 20:25:17 +0900 (ca8afc8)
@@ -15,7 +15,7 @@
 
 class TableCreateTest < GroongaHandlerTest
   def test_success
-    @handler.table_create({"name" => "Books"})
+    @plugin.table_create({"name" => "Books"})
     response =****@messa*****
     assert_equal(
       [[Droonga::GroongaHandler::Status::SUCCESS, NORMALIZED_START_TIME, NORMALIZED_ELAPSED_TIME], true],
@@ -24,7 +24,7 @@ class TableCreateTest < GroongaHandlerTest
   end
 
   def test_failure
-    @handler.table_create({})
+    @plugin.table_create({})
     response =****@messa*****
     assert_equal(
       [[Droonga::GroongaHandler::Status::INVALID_ARGUMENT, NORMALIZED_START_TIME, NORMALIZED_ELAPSED_TIME], false],
@@ -33,7 +33,7 @@ class TableCreateTest < GroongaHandlerTest
   end
 
   def test_name
-    @handler.table_create({"name" => "Books"})
+    @plugin.table_create({"name" => "Books"})
     assert_equal(<<-SCHEMA, dump)
 table_create Books TABLE_HASH_KEY --key_type ShortText
     SCHEMA
@@ -83,7 +83,7 @@ table_create Books TABLE_NO_KEY
         "name" => "Books",
         "flags" => data[:flags],
       }
-      @handler.table_create(request)
+      @plugin.table_create(request)
       assert_equal(data[:schema], dump)
     end
   end
@@ -94,7 +94,7 @@ table_create Books TABLE_NO_KEY
         "name"  => "Books",
         "key_type" => "Int32",
       }
-      @handler.table_create(request)
+      @plugin.table_create(request)
       assert_equal(<<-SCHEMA, dump)
 table_create Books TABLE_HASH_KEY --key_type Int32
       SCHEMA
@@ -107,7 +107,7 @@ table_create Books TABLE_HASH_KEY --key_type Int32
         "name"  => "Books",
         "value_type" => "Int32",
       }
-      @handler.table_create(request)
+      @plugin.table_create(request)
       assert_equal(<<-SCHEMA, dump)
 table_create Books TABLE_HASH_KEY --key_type ShortText --value_type Int32
       SCHEMA
@@ -120,7 +120,7 @@ table_create Books TABLE_HASH_KEY --key_type ShortText --value_type Int32
         "name"  => "Books",
         "default_tokenizer" => "TokenBigram",
       }
-      @handler.table_create(request)
+      @plugin.table_create(request)
       assert_equal(<<-SCHEMA, dump)
 table_create Books TABLE_HASH_KEY --key_type ShortText --default_tokenizer TokenBigram
       SCHEMA
@@ -133,7 +133,7 @@ table_create Books TABLE_HASH_KEY --key_type ShortText --default_tokenizer Token
         "name"  => "Books",
         "normalizer" => "NormalizerAuto",
       }
-      @handler.table_create(request)
+      @plugin.table_create(request)
       assert_equal(<<-SCHEMA, dump)
 table_create Books TABLE_HASH_KEY|KEY_NORMALIZE --key_type ShortText
       SCHEMA

  Modified: test/unit/plugin/handler/test_groonga.rb (+3 -3)
===================================================================
--- test/unit/plugin/handler/test_groonga.rb    2013-11-27 20:19:05 +0900 (34d19fb)
+++ test/unit/plugin/handler/test_groonga.rb    2013-11-27 20:25:17 +0900 (41a27e6)
@@ -16,15 +16,15 @@
 require "droonga/plugin/handler/groonga"
 
 class GroongaHandlerTest < Test::Unit::TestCase
-  include HandlerHelper
+  include PluginHelper
 
   def setup
     setup_database
-    setup_handler(Droonga::GroongaHandler)
+    setup_plugin(Droonga::GroongaHandler)
   end
 
   def teardown
-    teardown_handler
+    teardown_plugin
     teardown_database
   end
 

  Modified: test/unit/plugin/handler/test_search.rb (+4 -4)
===================================================================
--- test/unit/plugin/handler/test_search.rb    2013-11-27 20:19:05 +0900 (c2a5e28)
+++ test/unit/plugin/handler/test_search.rb    2013-11-27 20:25:17 +0900 (a6c711c)
@@ -16,22 +16,22 @@
 require "droonga/plugin/handler/search"
 
 class SearchHandlerTest < Test::Unit::TestCase
-  include HandlerHelper
+  include PluginHelper
 
   def setup
     setup_database
     restore(fixture_data("document.grn"))
-    setup_handler(Droonga::SearchHandler)
+    setup_plugin(Droonga::SearchHandler)
   end
 
   def teardown
-    teardown_handler
+    teardown_plugin
     teardown_database
   end
 
   private
   def search(request)
-    @handler.search(request)
+    @plugin.search(request)
     results_to_result_set(@messages)
   end
 
-------------- next part --------------
HTML����������������������������...
Download 



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