YUKI Hiroshi
null+****@clear*****
Fri Dec 6 11:05:15 JST 2013
YUKI Hiroshi 2013-12-06 11:05:15 +0900 (Fri, 06 Dec 2013) New Revision: d213c3d3939358b9b33dfcc6dcf7f5ba7a33a31a https://github.com/droonga/fluent-plugin-droonga/commit/d213c3d3939358b9b33dfcc6dcf7f5ba7a33a31a Message: Reduce indent Modified files: test/unit/plugin/distributor/test_search.rb Modified: test/unit/plugin/distributor/test_search.rb (+168 -168) =================================================================== --- test/unit/plugin/distributor/test_search.rb 2013-12-06 11:04:29 +0900 (3847fd8) +++ test/unit/plugin/distributor/test_search.rb 2013-12-06 11:05:15 +0900 (8af521d) @@ -28,204 +28,204 @@ class SearchDistributorTest < Test::Unit::TestCase teardown_database end - def test_distribute - envelope = { - "type" => "search", - "dataset" => "Droonga", - "body" => { - "queries" => { - "query1" => { - "source" => "User", - "output" => { - "format" => "complex", - "elements" => ["count", "records"], - "attributes" => [], - "offset" => 0, - "limit" => 10, - }, + def test_distribute + envelope = { + "type" => "search", + "dataset" => "Droonga", + "body" => { + "queries" => { + "query1" => { + "source" => "User", + "output" => { + "format" => "complex", + "elements" => ["count", "records"], + "attributes" => [], + "offset" => 0, + "limit" => 10, }, - "query2" => { - "source" => "User", - "output" => { - "format" => "complex", - "elements" => ["count", "records"], - "attributes" => [], - "offset" => 0, - "limit" => 20, - }, + }, + "query2" => { + "source" => "User", + "output" => { + "format" => "complex", + "elements" => ["count", "records"], + "attributes" => [], + "offset" => 0, + "limit" => 20, }, - "query3" => { - "source" => "User", - "output" => { - "format" => "complex", - "elements" => ["count", "records"], - "attributes" => [], - "offset" => 0, - "limit" => 30, - }, + }, + "query3" => { + "source" => "User", + "output" => { + "format" => "complex", + "elements" => ["count", "records"], + "attributes" => [], + "offset" => 0, + "limit" => 30, }, }, }, - } + }, + } - @plugin.process("search", envelope) + @plugin.process("search", envelope) - message = [] + message = [] - message << { - "type" => "reduce", - "body" => { - "query1" => { - "query1_reduced" => { - "count" => { - "type" => "sum", - }, - "records" => { - "type" => "sort", - "operators" => [], - "limit" => 10, - }, + message << { + "type" => "reduce", + "body" => { + "query1" => { + "query1_reduced" => { + "count" => { + "type" => "sum", + }, + "records" => { + "type" => "sort", + "operators" => [], + "limit" => 10, }, }, }, - "inputs" => ["query1"], - "outputs" => ["query1_reduced"], - } - message << { - "type" => "reduce", - "body" => { - "query2" => { - "query2_reduced" => { - "count" => { - "type" => "sum", - }, - "records" => { - "type" => "sort", - "operators" => [], - "limit" => 20, - }, + }, + "inputs" => ["query1"], + "outputs" => ["query1_reduced"], + } + message << { + "type" => "reduce", + "body" => { + "query2" => { + "query2_reduced" => { + "count" => { + "type" => "sum", + }, + "records" => { + "type" => "sort", + "operators" => [], + "limit" => 20, }, }, }, - "inputs" => ["query2"], - "outputs" => ["query2_reduced"], - } - message << { - "type" => "reduce", - "body" => { - "query3" => { - "query3_reduced" => { - "count" => { - "type" => "sum", - }, - "records" => { - "type" => "sort", - "operators" => [], - "limit" => 30, - }, + }, + "inputs" => ["query2"], + "outputs" => ["query2_reduced"], + } + message << { + "type" => "reduce", + "body" => { + "query3" => { + "query3_reduced" => { + "count" => { + "type" => "sum", + }, + "records" => { + "type" => "sort", + "operators" => [], + "limit" => 30, }, }, }, - "inputs" => ["query3"], - "outputs" => ["query3_reduced"], - } + }, + "inputs" => ["query3"], + "outputs" => ["query3_reduced"], + } - gatherer = { - "type" => "gather", - "body" => { - "query1_reduced" => { - "output" => "query1", - "elements" => { - "records" => { - "type" => "sort", - "offset" => 0, - "limit" => 10, - "format" => "complex", - "attributes" => [], - }, + gatherer = { + "type" => "gather", + "body" => { + "query1_reduced" => { + "output" => "query1", + "elements" => { + "records" => { + "type" => "sort", + "offset" => 0, + "limit" => 10, + "format" => "complex", + "attributes" => [], }, }, - "query2_reduced" => { - "output" => "query2", - "elements" => { - "records" => { - "type" => "sort", - "offset" => 0, - "limit" => 20, - "format" => "complex", - "attributes" => [], - }, + }, + "query2_reduced" => { + "output" => "query2", + "elements" => { + "records" => { + "type" => "sort", + "offset" => 0, + "limit" => 20, + "format" => "complex", + "attributes" => [], }, }, - "query3_reduced" => { - "output" => "query3", - "elements" => { - "records" => { - "type" => "sort", - "offset" => 0, - "limit" => 30, - "format" => "complex", - "attributes" => [], - }, + }, + "query3_reduced" => { + "output" => "query3", + "elements" => { + "records" => { + "type" => "sort", + "offset" => 0, + "limit" => 30, + "format" => "complex", + "attributes" => [], }, }, }, - "inputs" => [ - "query1_reduced", - "query2_reduced", - "query3_reduced", - ], - "post" => true, - } - message << gatherer + }, + "inputs" => [ + "query1_reduced", + "query2_reduced", + "query3_reduced", + ], + "post" => true, + } + message << gatherer - searcher = { - "type" => "broadcast", - "command" => "search", - "dataset" => "Droonga", - "body" => { - "queries" => { - "query1" => { - "source" => "User", - "output" => { - "format" => "simple", - "elements" => ["count", "records"], - "attributes" => [], - "offset" => 0, - "limit" => 10, - }, + searcher = { + "type" => "broadcast", + "command" => "search", + "dataset" => "Droonga", + "body" => { + "queries" => { + "query1" => { + "source" => "User", + "output" => { + "format" => "simple", + "elements" => ["count", "records"], + "attributes" => [], + "offset" => 0, + "limit" => 10, }, - "query2" => { - "source" => "User", - "output" => { - "format" => "simple", - "elements" => ["count", "records"], - "attributes" => [], - "offset" => 0, - "limit" => 20, - }, + }, + "query2" => { + "source" => "User", + "output" => { + "format" => "simple", + "elements" => ["count", "records"], + "attributes" => [], + "offset" => 0, + "limit" => 20, }, - "query3" => { - "source" => "User", - "output" => { - "format" => "simple", - "elements" => ["count", "records"], - "attributes" => [], - "offset" => 0, - "limit" => 30, - }, + }, + "query3" => { + "source" => "User", + "output" => { + "format" => "simple", + "elements" => ["count", "records"], + "attributes" => [], + "offset" => 0, + "limit" => 30, }, }, }, - "outputs" => [ - "query1", - "query2", - "query3", - ], - "replica" => "random", - } - message << searcher + }, + "outputs" => [ + "query1", + "query2", + "query3", + ], + "replica" => "random", + } + message << searcher - assert_equal(message, @posted.last.last) - end + assert_equal(message, @posted.last.last) + end end -------------- next part -------------- HTML����������������������������... 下載