YUKI Hiroshi
null+****@clear*****
Wed Apr 29 21:50:10 JST 2015
YUKI Hiroshi 2015-04-29 21:50:10 +0900 (Wed, 29 Apr 2015) New Revision: d122443c6e6dd087850fc6ddceed4a37a14cb4dc https://github.com/droonga/droonga-engine/commit/d122443c6e6dd087850fc6ddceed4a37a14cb4dc Message: Export label of worker to handler Modified files: lib/droonga/handler.rb lib/droonga/handler_runner.rb test/unit/catalog/test_version2.rb test/unit/plugins/catalog/test_fetch.rb test/unit/plugins/crud/test_add.rb test/unit/plugins/groonga/test_column_create.rb test/unit/plugins/groonga/test_column_list.rb test/unit/plugins/groonga/test_column_remove.rb test/unit/plugins/groonga/test_column_rename.rb test/unit/plugins/groonga/test_delete.rb test/unit/plugins/groonga/test_table_create.rb test/unit/plugins/groonga/test_table_list.rb test/unit/plugins/groonga/test_table_remove.rb test/unit/plugins/search/test_handler.rb test/unit/plugins/system/test_status.rb test/unit/plugins/test_watch.rb Modified: lib/droonga/handler.rb (+6 -6) =================================================================== --- lib/droonga/handler.rb 2015-04-29 21:37:17 +0900 (e2ffa1b) +++ lib/droonga/handler.rb 2015-04-29 21:50:10 +0900 (5f8e65a) @@ -36,12 +36,12 @@ module Droonga end attr_reader :label, :messenger, :loop - def initialize(name, label, context, messenger, loop) - @name = name - @label = label - @context = context - @messenger = messenger - @loop = loop + def initialize(params) + @name = params[:name] + @label = params[:label] + @context = params[:context] + @messenger = params[:messenger] + @loop = params[:loop] end def handle(message) Modified: lib/droonga/handler_runner.rb (+5 -1) =================================================================== --- lib/droonga/handler_runner.rb 2015-04-29 21:37:17 +0900 (399b444) +++ lib/droonga/handler_runner.rb 2015-04-29 21:50:10 +0900 (903c05b) @@ -113,7 +113,11 @@ module Droonga handler_message.validate messenger = HandlerMessenger.new(@forwarder, handler_message, @options) - handler = handler_class.new(@name, @label, @context, messenger, @loop) + handler = handler_class.new(:name => @name, + :label => @label, + :context => @context, + :messenger => messenger, + :loop => @loop) begin result = handler.handle(handler_message) unless result.nil? Modified: test/unit/catalog/test_version2.rb (+3 -0) =================================================================== --- test/unit/catalog/test_version2.rb 2015-04-29 21:37:17 +0900 (17bc966) +++ test/unit/catalog/test_version2.rb 2015-04-29 21:50:10 +0900 (a229430) @@ -47,18 +47,21 @@ class CatalogVersion2Test < Test::Unit::TestCase "localhost:23003/test.000" => { :database => "#{base_path}/databases/000/db", :dataset => "Test", + :label => "localhost:23003/test.000", :plugins => ["plugin1", "plugin2", "plugin3"], :n_workers => 4, }, "localhost:23003/test.001" => { :database => "#{base_path}/databases/001/db", :dataset => "Test", + :label => "localhost:23003/test.001", :plugins => ["plugin1", "plugin2", "plugin3"], :n_workers => 4, }, "localhost:23003/test.002" => { :database => "#{base_path}/databases/002/db", :dataset => "Test", + :label => "localhost:23003/test.002", :plugins => ["plugin1", "plugin2", "plugin3"], :n_workers => 4, }, Modified: test/unit/plugins/catalog/test_fetch.rb (+4 -4) =================================================================== --- test/unit/plugins/catalog/test_fetch.rb 2015-04-29 21:37:17 +0900 (89c4ed9) +++ test/unit/plugins/catalog/test_fetch.rb 2015-04-29 21:50:10 +0900 (531f257) @@ -34,10 +34,10 @@ class CatalogFetchHandlerTest < Test::Unit::TestCase @worker = StubWorker.new @messenger = Droonga::Test::StubHandlerMessenger.new @loop = nil - @handler = Droonga::Plugins::Catalog::FetchHandler.new("name", - @worker.context, - @messenger, - @loop) + @handler = Droonga::Plugins::Catalog::FetchHandler.new(:name => "name", + :context => @worker.context, + :messenger => @messenger, + :loop => @loop) end def teardown_handler Modified: test/unit/plugins/crud/test_add.rb (+4 -4) =================================================================== --- test/unit/plugins/crud/test_add.rb 2015-04-29 21:37:17 +0900 (4e80cf4) +++ test/unit/plugins/crud/test_add.rb 2015-04-29 21:50:10 +0900 (5a68c87) @@ -37,10 +37,10 @@ class CRUDAddHandlerTest < Test::Unit::TestCase @worker = StubWorker.new @messenger = Droonga::Test::StubHandlerMessenger.new @loop = nil - @handler = Droonga::Plugins::CRUD::Handler.new("name", - @worker.context, - @messenger, - @loop) + @handler = Droonga::Plugins::CRUD::Handler.new(:name => "name", + :context => @worker.context, + :messenger => @messenger, + :loop => @loop) end def teardown_handler Modified: test/unit/plugins/groonga/test_column_create.rb (+4 -4) =================================================================== --- test/unit/plugins/groonga/test_column_create.rb 2015-04-29 21:37:17 +0900 (92224e9) +++ test/unit/plugins/groonga/test_column_create.rb 2015-04-29 21:50:10 +0900 (2f0500e) @@ -15,10 +15,10 @@ class ColumnCreateTest < GroongaHandlerTest def create_handler - Droonga::Plugins::Groonga::ColumnCreate::Handler.new("droonga", - @handler.context, - @messenger, - @loop) + Droonga::Plugins::Groonga::ColumnCreate::Handler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) end def test_success Modified: test/unit/plugins/groonga/test_column_list.rb (+4 -4) =================================================================== --- test/unit/plugins/groonga/test_column_list.rb 2015-04-29 21:37:17 +0900 (f6535c5) +++ test/unit/plugins/groonga/test_column_list.rb 2015-04-29 21:50:10 +0900 (201b408) @@ -26,10 +26,10 @@ class ColumnListTest < GroongaHandlerTest ] def create_handler - Droonga::Plugins::Groonga::ColumnList::Handler.new("droonga", - @handler.context, - @messenger, - @loop) + Droonga::Plugins::Groonga::ColumnList::Handler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) end def virtual_key_column(id, table_name) Modified: test/unit/plugins/groonga/test_column_remove.rb (+4 -4) =================================================================== --- test/unit/plugins/groonga/test_column_remove.rb 2015-04-29 21:37:17 +0900 (f4cf807) +++ test/unit/plugins/groonga/test_column_remove.rb 2015-04-29 21:50:10 +0900 (be4340d) @@ -15,10 +15,10 @@ class ColumnRemoveTest < GroongaHandlerTest def create_handler - Droonga::Plugins::Groonga::ColumnRemove::Handler.new("droonga", - @handler.context, - @messenger, - @loop) + Droonga::Plugins::Groonga::ColumnRemove::Handler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) end def test_success Modified: test/unit/plugins/groonga/test_column_rename.rb (+4 -4) =================================================================== --- test/unit/plugins/groonga/test_column_rename.rb 2015-04-29 21:37:17 +0900 (dc242c5) +++ test/unit/plugins/groonga/test_column_rename.rb 2015-04-29 21:50:10 +0900 (eb7cb49) @@ -15,10 +15,10 @@ class ColumnRenameTest < GroongaHandlerTest def create_handler - Droonga::Plugins::Groonga::ColumnRename::Handler.new("droonga", - @handler.context, - @messenger, - @loop) + Droonga::Plugins::Groonga::ColumnRename::Handler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) end def test_success Modified: test/unit/plugins/groonga/test_delete.rb (+4 -4) =================================================================== --- test/unit/plugins/groonga/test_delete.rb 2015-04-29 21:37:17 +0900 (89dc703) +++ test/unit/plugins/groonga/test_delete.rb 2015-04-29 21:50:10 +0900 (6dfde28) @@ -15,10 +15,10 @@ class DeleteTest < GroongaHandlerTest def create_handler - Droonga::Plugins::Groonga::Delete::Handler.new("droonga", - @handler.context, - @messenger, - @loop) + Droonga::Plugins::Groonga::Delete::Handler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) end def test_success Modified: test/unit/plugins/groonga/test_table_create.rb (+4 -4) =================================================================== --- test/unit/plugins/groonga/test_table_create.rb 2015-04-29 21:37:17 +0900 (471a542) +++ test/unit/plugins/groonga/test_table_create.rb 2015-04-29 21:50:10 +0900 (8b1844c) @@ -15,10 +15,10 @@ class TableCreateTest < GroongaHandlerTest def create_handler - Droonga::Plugins::Groonga::TableCreate::Handler.new("droonga", - @handler.context, - @messenger, - @loop) + Droonga::Plugins::Groonga::TableCreate::Handler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) end def test_success Modified: test/unit/plugins/groonga/test_table_list.rb (+4 -4) =================================================================== --- test/unit/plugins/groonga/test_table_list.rb 2015-04-29 21:37:17 +0900 (e0bd27f) +++ test/unit/plugins/groonga/test_table_list.rb 2015-04-29 21:50:10 +0900 (442fc9a) @@ -26,10 +26,10 @@ class TableListTest < GroongaHandlerTest ] def create_handler - Droonga::Plugins::Groonga::TableList::Handler.new("droonga", - @handler.context, - @messenger, - @loop) + Droonga::Plugins::Groonga::TableList::Handler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) end def test_success Modified: test/unit/plugins/groonga/test_table_remove.rb (+4 -4) =================================================================== --- test/unit/plugins/groonga/test_table_remove.rb 2015-04-29 21:37:17 +0900 (7ee6961) +++ test/unit/plugins/groonga/test_table_remove.rb 2015-04-29 21:50:10 +0900 (9b3b260) @@ -15,10 +15,10 @@ class TableRemoveTest < GroongaHandlerTest def create_handler - Droonga::Plugins::Groonga::TableRemove::Handler.new("droonga", - @handler.context, - @messenger, - @loop) + Droonga::Plugins::Groonga::TableRemove::Handler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) end def setup Modified: test/unit/plugins/search/test_handler.rb (+4 -4) =================================================================== --- test/unit/plugins/search/test_handler.rb 2015-04-29 21:37:17 +0900 (269df56) +++ test/unit/plugins/search/test_handler.rb 2015-04-29 21:50:10 +0900 (53fa6c2) @@ -31,10 +31,10 @@ class SearchHandlerTest < Test::Unit::TestCase @handler = Droonga::Test::StubHandler.new @messenger = Droonga::Test::StubHandlerMessenger.new @loop = nil - @plugin = Droonga::Plugins::Search::Handler.new("droonga", - @handler.context, - @messenger, - @loop) + @plugin = Droonga::Plugins::Search::Handler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) end def teardown_plugin Modified: test/unit/plugins/system/test_status.rb (+4 -4) =================================================================== --- test/unit/plugins/system/test_status.rb 2015-04-29 21:37:17 +0900 (c983530) +++ test/unit/plugins/system/test_status.rb 2015-04-29 21:50:10 +0900 (a3d6f60) @@ -31,10 +31,10 @@ class SystemStatusHandlerTest < Test::Unit::TestCase @messenger.cluster = StubCluster.new @messenger.engine_state = StubEngineState.new @loop = nil - @handler = Droonga::Plugins::System::StatusHandler.new("name", - @worker.context, - @messenger, - @loop) + @handler = Droonga::Plugins::System::StatusHandler.new(:name => "name", + :context => @worker.context, + :messenger => @messenger, + :loop => @loop) end def teardown_handler Modified: test/unit/plugins/test_watch.rb (+16 -16) =================================================================== --- test/unit/plugins/test_watch.rb 2015-04-29 21:37:17 +0900 (bfd6c6a) +++ test/unit/plugins/test_watch.rb 2015-04-29 21:50:10 +0900 (ca9019b) @@ -52,10 +52,10 @@ class WatchHandlerTest < Test::Unit::TestCase public class SubscribeTest < self def create_plugin - Droonga::Plugins::Watch::SubscribeHandler.new("droonga", - @handler.context, - @messenger, - @loop) + Droonga::Plugins::Watch::SubscribeHandler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) end def test_subscribe @@ -119,10 +119,10 @@ class WatchHandlerTest < Test::Unit::TestCase end def create_plugin - Droonga::Plugins::Watch::UnsubscribeHandler.new("droonga", - @handler.context, - @messenger, - @loop) + Droonga::Plugins::Watch::UnsubscribeHandler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) end def test_unsubscribe @@ -154,10 +154,10 @@ class WatchHandlerTest < Test::Unit::TestCase end def create_plugin - Droonga::Plugins::Watch::FeedHandler.new("droonga", - @handler.context, - @messenger, - @loop) + Droonga::Plugins::Watch::FeedHandler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) end def test_feed_match @@ -200,10 +200,10 @@ class WatchHandlerTest < Test::Unit::TestCase } message = Droonga::Test::StubHandlerMessage.new(request, {}) subscribe_handler = - Droonga::Plugins::Watch::SubscribeHandler.new("droonga", - @handler.context, - @messenger, - @loop) + Droonga::Plugins::Watch::SubscribeHandler.new(:name => "droonga", + :context => @handler.context, + :messenger => @messenger, + :loop => @loop) response = subscribe_handler.handle(message) assert_equal(SUCCESS_RESULT, response) end -------------- next part -------------- HTML����������������������������... Download