[Groonga-commit] droonga/droonga-engine at 042698d [master] Remove system.n_total_records command.

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Nov 21 17:01:06 JST 2014


YUKI Hiroshi	2014-11-21 17:01:06 +0900 (Fri, 21 Nov 2014)

  New Revision: 042698d131db936d4483b3d684cfed9cb6eabf4a
  https://github.com/droonga/droonga-engine/commit/042698d131db936d4483b3d684cfed9cb6eabf4a

  Message:
    Remove system.n_total_records command.
    
    It should be done by table_list and search.

  Removed files:
    test/command/suite/system/n_total_records.expected
    test/command/suite/system/n_total_records.test
    test/unit/plugins/system/test_n_total_records.rb
  Modified files:
    lib/droonga/plugins/system.rb

  Modified: lib/droonga/plugins/system.rb (+0 -16)
===================================================================
--- lib/droonga/plugins/system.rb    2014-11-21 16:54:00 +0900 (f816e47)
+++ lib/droonga/plugins/system.rb    2014-11-21 17:01:06 +0900 (16c6d4d)
@@ -45,22 +45,6 @@ module Droonga
         step.handler = StatusHandler
         step.collector = Collectors::Or
       end
-
-      class NTotalRecordsHandler < Droonga::Handler
-        def handle(message)
-          n_records = 0
-          @context.database.tables.collect do |table|
-            n_records += table.size
-          end
-          n_records
-        end
-      end
-
-      define_single_step do |step|
-        step.name = "system.n_total_records"
-        step.handler = NTotalRecordsHandler
-        step.collector = Collectors::Sum
-      end
     end
   end
 end

  Deleted: test/command/suite/system/n_total_records.expected (+0 -6) 100644
===================================================================
--- test/command/suite/system/n_total_records.expected    2014-11-21 16:54:00 +0900 (70c85b3)
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-  "inReplyTo": "request-id",
-  "statusCode": 200,
-  "type": "system.n_total_records.result",
-  "body": 12
-}

  Deleted: test/command/suite/system/n_total_records.test (+0 -7) 100644
===================================================================
--- test/command/suite/system/n_total_records.test    2014-11-21 16:54:00 +0900 (bde61a1)
+++ /dev/null
@@ -1,7 +0,0 @@
-#@include fixture/users.jsons
-#@include fixture/documents.jsons
-{
-  "type": "system.n_total_records",
-  "dataset": "Default",
-  "body": {}
-}

  Deleted: test/unit/plugins/system/test_n_total_records.rb (+0 -76) 100644
===================================================================
--- test/unit/plugins/system/test_n_total_records.rb    2014-11-21 16:54:00 +0900 (91fb8be)
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright (C) 2013-2014 Droonga Project
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License version 2.1 as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-require "droonga/plugins/system"
-
-class SystemNTotalRecordsHandlerTest < Test::Unit::TestCase
-  def setup
-    setup_database
-    setup_handler
-    setup_tables
-    setup_records
-  end
-
-  def teardown
-    teardown_database
-    teardown_handler
-  end
-
-  private
-  def setup_handler
-    @worker = StubWorker.new
-    @messenger = Droonga::Test::StubHandlerMessenger.new
-    @loop = nil
-    @handler = Droonga::Plugins::System::NTotalRecordsHandler.new("name",
-                                                                  @worker.context,
-                                                                  @messenger,
-                                                                  @loop)
-  end
-
-  def teardown_handler
-    @handler = nil
-  end
-
-  def process(request)
-    message = Droonga::Test::StubHandlerMessage.new(request)
-    @handler.handle(message)
-  end
-
-  def setup_tables
-    Groonga::Schema.define do |schema|
-      schema.create_table("Users",
-                          :type => :hash,
-                          :key_type => :short_text)
-      schema.create_table("Groups",
-                          :type => :hash,
-                          :key_type => :short_text)
-    end
-  end
-
-  def setup_records
-    @worker.context["Users"].add("Alice")
-    @worker.context["Users"].add("Bob")
-    @worker.context["Groups"].add("Users")
-    @worker.context["Groups"].add("Administrators")
-  end
-
-  public
-  def test_request
-    request = {}
-    response = process(request)
-    n_total_records = 4
-    assert_equal(n_total_records, response)
-  end
-end
-------------- next part --------------
HTML����������������������������...
Download 



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