[Groonga-commit] droonga/fluent-plugin-droonga at 0e5869b [master] test: move output.format tests under OutputTest

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Jan 30 15:36:06 JST 2014


Kouhei Sutou	2014-01-30 15:36:06 +0900 (Thu, 30 Jan 2014)

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

  Message:
    test: move output.format tests under OutputTest

  Modified files:
    test/unit/plugin/distributor/test_search_planner.rb

  Modified: test/unit/plugin/distributor/test_search_planner.rb (+80 -80)
===================================================================
--- test/unit/plugin/distributor/test_search_planner.rb    2014-01-30 15:31:37 +0900 (8e20d72)
+++ test/unit/plugin/distributor/test_search_planner.rb    2014-01-30 15:36:06 +0900 (ed915a5)
@@ -191,6 +191,86 @@ class DistributedSearchPlannerTest < Test::Unit::TestCase
                      gather_message(messages)["body"])
       end
     end
+
+    class FormatTest < self
+      def setup
+        @output = {
+          "format"     => "complex",
+          "elements"   => ["records"],
+          "attributes" => ["_id"],
+          "offset"     => 0,
+          "limit"      => 10,
+        }
+        @request = {
+          "type" => "search",
+          "dataset" => "Droonga",
+          "body" => {
+            "queries" => {
+              "users" => {
+                "source" => "User",
+                "output" => @output,
+              },
+            },
+          },
+        }
+      end
+
+      def test_dependencies
+        search_reduce_inputs = [
+          "errors",
+          "users",
+        ]
+        search_gather_inputs = [
+          "errors_reduced",
+          "users_reduced",
+        ]
+        assert_equal([
+                       {
+                         "type"    => "search_reduce",
+                         "inputs"  => search_reduce_inputs,
+                         "outputs" => search_gather_inputs,
+                       },
+                       {
+                         "type"    => "search_gather",
+                         "inputs"  => search_gather_inputs,
+                         "outputs" => nil,
+                       },
+                       {
+                         "type"    => "broadcast",
+                         "inputs"  => nil,
+                         "outputs" => search_reduce_inputs,
+                       },
+                     ],
+                     dependencies(messages))
+      end
+
+      def test_broadcast_body
+        changed_output_parameters = {
+          "format" => "simple"
+        }
+        assert_equal({
+                       "queries" => {
+                         "users" => {
+                           "source" => "User",
+                           "output" => @output.merge(changed_output_parameters),
+                         },
+                       },
+                     },
+                     broadcast_message(messages)["body"])
+      end
+
+      def test_gather_records
+        records =****@outpu*****("type" => "sort")
+        records.delete("elements")
+        assert_equal({
+                       "elements" => {
+                         "records" => records,
+                       },
+                       "output" => "users",
+                     },
+                     gather_message(messages)["body"]["users_reduced"])
+      end
+    end
   end
 
   class SingleQueryTest < self
@@ -1045,84 +1125,4 @@ class DistributedSearchPlannerTest < Test::Unit::TestCase
       searcher
     end
   end
-
-  class FormatTest < self
-    def setup
-      @output = {
-        "format"     => "complex",
-        "elements"   => ["records"],
-        "attributes" => ["_id"],
-        "offset"     => 0,
-        "limit"      => 10,
-      }
-      @request = {
-        "type" => "search",
-        "dataset" => "Droonga",
-        "body" => {
-          "queries" => {
-            "users" => {
-              "source" => "User",
-              "output" => @output,
-            },
-          },
-        },
-      }
-    end
-
-    def test_dependencies
-      search_reduce_inputs = [
-        "errors",
-        "users",
-      ]
-      search_gather_inputs = [
-        "errors_reduced",
-        "users_reduced",
-      ]
-      assert_equal([
-                     {
-                       "type"    => "search_reduce",
-                       "inputs"  => search_reduce_inputs,
-                       "outputs" => search_gather_inputs,
-                     },
-                     {
-                       "type"    => "search_gather",
-                       "inputs"  => search_gather_inputs,
-                       "outputs" => nil,
-                     },
-                     {
-                       "type"    => "broadcast",
-                       "inputs"  => nil,
-                       "outputs" => search_reduce_inputs,
-                     },
-                   ],
-                   dependencies(messages))
-    end
-
-    def test_broadcast_body
-      changed_output_parameters = {
-        "format" => "simple"
-      }
-      assert_equal({
-                     "queries" => {
-                       "users" => {
-                         "source" => "User",
-                         "output" => @output.merge(changed_output_parameters),
-                       },
-                     },
-                   },
-                   broadcast_message(messages)["body"])
-    end
-
-    def test_gather_records
-      records =****@outpu*****("type" => "sort")
-      records.delete("elements")
-      assert_equal({
-                     "elements" => {
-                       "records" => records,
-                     },
-                     "output" => "users",
-                   },
-                   gather_message(messages)["body"]["users_reduced"])
-    end
-  end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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