Kouhei Sutou
null+****@clear*****
Fri Apr 11 18:38:55 JST 2014
Kouhei Sutou 2014-04-11 18:38:55 +0900 (Fri, 11 Apr 2014) New Revision: 1d206a5f78ddfdecb445d3e3114d35b1a2461a93 https://github.com/droonga/fluent-plugin-droonga/commit/1d206a5f78ddfdecb445d3e3114d35b1a2461a93 Message: Pass loop to handler Modified files: lib/droonga/handler.rb lib/droonga/handler_runner.rb test/unit/plugins/crud/test_add.rb test/unit/plugins/groonga/test_column_create.rb test/unit/plugins/groonga/test_table_create.rb test/unit/plugins/groonga/test_table_remove.rb test/unit/plugins/search/test_handler.rb test/unit/plugins/test_groonga.rb test/unit/plugins/test_watch.rb Modified: lib/droonga/handler.rb (+3 -2) =================================================================== --- lib/droonga/handler.rb 2014-04-11 17:57:05 +0900 (b98dbc3) +++ lib/droonga/handler.rb 2014-04-11 18:38:55 +0900 (90ae06a) @@ -35,11 +35,12 @@ module Droonga end end - attr_reader :messenger - def initialize(name, context, messenger) + attr_reader :messenger, :loop + def initialize(name, context, messenger, loop) @name = name @context = context @messenger = messenger + @loop = loop end def handle(message) Modified: lib/droonga/handler_runner.rb (+1 -1) =================================================================== --- lib/droonga/handler_runner.rb 2014-04-11 17:57:05 +0900 (741b703) +++ lib/droonga/handler_runner.rb 2014-04-11 18:38:55 +0900 (ac2439b) @@ -95,7 +95,7 @@ module Droonga handler_message.validate messenger = HandlerMessenger.new(@forwarder, handler_message, @options) - handler = handler_class.new(@name, @context, messenger) + handler = handler_class.new(@name, @context, messenger, @loop) begin result = handler.handle(handler_message) unless result.nil? Modified: test/unit/plugins/crud/test_add.rb (+3 -1) =================================================================== --- test/unit/plugins/crud/test_add.rb 2014-04-11 17:57:05 +0900 (aeb65e6) +++ test/unit/plugins/crud/test_add.rb 2014-04-11 18:38:55 +0900 (a9c176c) @@ -36,9 +36,11 @@ class CRUDAddHandlerTest < Test::Unit::TestCase def setup_handler @worker = StubWorker.new @messenger = Droonga::Test::StubHandlerMessenger.new + @loop = nil @handler = Droonga::Plugins::CRUD::Handler.new("name", @worker.context, - @messenger) + @messenger, + @loop) end def teardown_handler Modified: test/unit/plugins/groonga/test_column_create.rb (+2 -1) =================================================================== --- test/unit/plugins/groonga/test_column_create.rb 2014-04-11 17:57:05 +0900 (f7e8f3a) +++ test/unit/plugins/groonga/test_column_create.rb 2014-04-11 18:38:55 +0900 (c8e5831) @@ -17,7 +17,8 @@ class ColumnCreateTest < GroongaHandlerTest def create_handler Droonga::Plugins::Groonga::ColumnCreate::Handler.new("droonga", @handler.context, - @messages) + @messages, + @loop) end def test_success Modified: test/unit/plugins/groonga/test_table_create.rb (+2 -1) =================================================================== --- test/unit/plugins/groonga/test_table_create.rb 2014-04-11 17:57:05 +0900 (f3b66bc) +++ test/unit/plugins/groonga/test_table_create.rb 2014-04-11 18:38:55 +0900 (5bd1888) @@ -17,7 +17,8 @@ class TableCreateTest < GroongaHandlerTest def create_handler Droonga::Plugins::Groonga::TableCreate::Handler.new("droonga", @handler.context, - @messenger) + @messenger, + @loop) end def test_success Modified: test/unit/plugins/groonga/test_table_remove.rb (+2 -1) =================================================================== --- test/unit/plugins/groonga/test_table_remove.rb 2014-04-11 17:57:05 +0900 (71962f1) +++ test/unit/plugins/groonga/test_table_remove.rb 2014-04-11 18:38:55 +0900 (f5fd1b1) @@ -17,7 +17,8 @@ class TableRemoveTest < GroongaHandlerTest def create_handler Droonga::Plugins::Groonga::TableRemove::Handler.new("droonga", @handler.context, - @messenger) + @messenger, + @loop) end def setup Modified: test/unit/plugins/search/test_handler.rb (+3 -1) =================================================================== --- test/unit/plugins/search/test_handler.rb 2014-04-11 17:57:05 +0900 (d1faaad) +++ test/unit/plugins/search/test_handler.rb 2014-04-11 18:38:55 +0900 (3fdf3c4) @@ -30,9 +30,11 @@ class SearchHandlerTest < Test::Unit::TestCase def setup_plugin @handler = Droonga::Test::StubHandler.new @messenger = Droonga::Test::StubHandlerMessenger.new + @loop = nil @plugin = Droonga::Plugins::Search::Handler.new("droonga", @handler.context, - @messenger) + @messenger, + @loop) end def teardown_plugin Modified: test/unit/plugins/test_groonga.rb (+1 -0) =================================================================== --- test/unit/plugins/test_groonga.rb 2014-04-11 17:57:05 +0900 (0add108) +++ test/unit/plugins/test_groonga.rb 2014-04-11 18:38:55 +0900 (7d5cb10) @@ -32,6 +32,7 @@ class GroongaHandlerTest < Test::Unit::TestCase def setup_plugin @handler = Droonga::Test::StubHandler.new @messenger = Droonga::Test::StubHandlerMessenger.new + @loop = nil end def teardown_plugin Modified: test/unit/plugins/test_watch.rb (+9 -4) =================================================================== --- test/unit/plugins/test_watch.rb 2014-04-11 17:57:05 +0900 (0c066d8) +++ test/unit/plugins/test_watch.rb 2014-04-11 18:38:55 +0900 (b0732bd) @@ -37,6 +37,7 @@ class WatchHandlerTest < Test::Unit::TestCase def setup_plugin @handler = Droonga::Test::StubHandler.new @messenger = Droonga::Test::StubHandlerMessenger.new + @loop = nil end def teardown_plugin @@ -53,7 +54,8 @@ class WatchHandlerTest < Test::Unit::TestCase def create_plugin Droonga::Plugins::Watch::SubscribeHandler.new("droonga", @handler.context, - @messenger) + @messenger, + @loop) end def test_subscribe @@ -119,7 +121,8 @@ class WatchHandlerTest < Test::Unit::TestCase def create_plugin Droonga::Plugins::Watch::UnsubscribeHandler.new("droonga", @handler.context, - @messenger) + @messenger, + @loop) end def test_unsubscribe @@ -153,7 +156,8 @@ class WatchHandlerTest < Test::Unit::TestCase def create_plugin Droonga::Plugins::Watch::FeedHandler.new("droonga", @handler.context, - @messenger) + @messenger, + @loop) end def test_feed_match @@ -198,7 +202,8 @@ class WatchHandlerTest < Test::Unit::TestCase subscribe_handler = Droonga::Plugins::Watch::SubscribeHandler.new("droonga", @handler.context, - @messenger) + @messenger, + @loop) response = subscribe_handler.handle(message) assert_equal(SUCCESS_RESULT, response) end -------------- next part -------------- HTML����������������������������... Download