[Groonga-commit] droonga/fluent-plugin-droonga at 2a4cb70 [master] Add test for sorting with hidden column

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Jan 31 16:56:18 JST 2014


YUKI Hiroshi	2014-01-31 16:56:18 +0900 (Fri, 31 Jan 2014)

  New Revision: 2a4cb70113f597b5ff565e34f28a55e605bb54a1
  https://github.com/droonga/fluent-plugin-droonga/commit/2a4cb70113f597b5ff565e34f28a55e605bb54a1

  Message:
    Add test for sorting with hidden column

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

  Modified: test/unit/plugin/distributor/test_search_planner.rb (+81 -0)
===================================================================
--- test/unit/plugin/distributor/test_search_planner.rb    2014-01-31 16:53:20 +0900 (285b1f6)
+++ test/unit/plugin/distributor/test_search_planner.rb    2014-01-31 16:56:18 +0900 (3867e99)
@@ -777,6 +777,87 @@ class DistributedSearchPlannerTest < Test::Unit::TestCase
                      gather_message["body"]["users_reduced"])
       end
     end
+
+    class ComplexSortByHiddenColumnTest < self
+      def setup
+        @output = {
+          "elements"   => ["records"],
+          "attributes" => ["_key"],
+          "limit"      => 1,
+        }
+        @sort_by = {
+          "keys" => ["name"],
+        }
+        @request = {
+          "type" => "search",
+          "dataset" => "Droonga",
+          "body" => {
+            "queries" => {
+              "users" => {
+                "source" => "User",
+                "sortBy" => @sort_by,
+                "output" => @output,
+              },
+            },
+          },
+        }
+      end
+
+      def test_dependencies
+        reduce_inputs = ["errors", "users"]
+        gather_inputs = ["errors_reduced", "users_reduced"]
+        assert_equal(expected_dependencies(reduce_inputs, gather_inputs),
+                     dependencies)
+      end
+
+      def test_broadcast_body
+        changed_sort_by_parameters = {
+          "offset" => 0,
+          "limit"  => 1,
+        }
+        changed_output_parameters = {
+          "attributes" => ["_key", "name"],
+        }
+        assert_equal({
+                       "queries" => {
+                         "users" => {
+                           "source" => "User",
+                           "sortBy" => @sort_by.merge(changed_sort_by_parameters),
+                           "output" => @output.merge(changed_output_parameters),
+                         },
+                       },
+                     },
+                     broadcast_message["body"])
+      end
+
+      def test_reduce_body
+        assert_equal({
+                       "users_reduced" => {
+                         "records" => {
+                           "type"      => "sort",
+                           "operators" => [
+                             { "column" => 1, "operator" => "<" },
+                           ],
+                           "limit"     => 1,
+                         },
+                       },
+                     },
+                     reduce_message["body"]["users"])
+      end
+
+      def test_gather_records
+        assert_equal({
+                       "elements" => {
+                         "records" => {
+                           "attributes" => ["_key"],
+                           "limit"      => 1,
+                         },
+                       },
+                       "output" => "users",
+                     },
+                     gather_message["body"]["users_reduced"])
+      end
+    end
   end
 
 
-------------- next part --------------
HTML����������������������������...
Download 



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