[Groonga-commit] droonga/drntest at bb6635c [master] Normalize result of table_list and column_list commands

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Apr 24 12:36:28 JST 2014


YUKI Hiroshi	2014-04-24 12:36:28 +0900 (Thu, 24 Apr 2014)

  New Revision: bb6635cd1f5d0dc3a874f3be9cec9d4cbee05136
  https://github.com/droonga/drntest/commit/bb6635cd1f5d0dc3a874f3be9cec9d4cbee05136

  Message:
    Normalize result of table_list and column_list commands

  Modified files:
    lib/drntest/response-normalizer.rb

  Modified: lib/drntest/response-normalizer.rb (+32 -0)
===================================================================
--- lib/drntest/response-normalizer.rb    2014-04-24 12:21:53 +0900 (554253d)
+++ lib/drntest/response-normalizer.rb    2014-04-24 12:36:28 +0900 (faa3afe)
@@ -80,6 +80,7 @@ module Drntest
 
     def normalize_groonga_command_response!(response)
       normalize_groonga_command_header!(response[0])
+      normalize_groonga_command_body!(response[1..-1])
     end
 
     def normalized_start_time
@@ -96,6 +97,37 @@ module Drntest
       header[2] = normalized_elapsed if valid_elapsed?(header[2])
     end
 
+    def normalize_groonga_command_body!(body)
+      return unless body.is_a?(Array)
+
+      case @request["type"]
+      when "table_list"
+        normalize_groonga_table_list_command_body!(body[1..-1])
+      when "column_list"
+        normalize_groonga_column_list_command_body!(body[1..-1])
+      end
+    end
+
+    TABLE_PATH_COLUMN_INDEX = 2
+    def normalize_groonga_table_list_command_body!(tables)
+      return unless tables.is_a?(Array)
+      tables.each do |table|
+        if table[TABLE_PATH_COLUMN_INDEX].is_a?(String)
+          table[TABLE_PATH_COLUMN_INDEX] = "/path/to/table"
+        end
+      end
+    end
+
+    COLUMN_PATH_COLUMN_INDEX = 2
+    def normalize_groonga_column_list_command_body!(columns)
+      return unless columns.is_a?(Array)
+      columns.each do |column|
+        if column[COLUMN_PATH_COLUMN_INDEX].is_a?(String)
+          column[COLUMN_PATH_COLUMN_INDEX] = "/path/to/column"
+        end
+      end
+    end
+
     def normalize_search_command_response!(response)
       response.each do |query_name, result|
         if valid_elapsed?(result["elapsedTime"])
-------------- next part --------------
HTML����������������������������...
Download 



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