[Groonga-commit] groonga/groonga-command at f0f7f3b [fix-travis-ci-error] Support reindex

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jan 13 17:33:43 JST 2016


Kouhei Sutou	2015-11-24 16:42:47 +0900 (Tue, 24 Nov 2015)

  New Revision: f0f7f3bf7236e392b104a8d67508a94001018c2b
  https://github.com/groonga/groonga-command/commit/f0f7f3bf7236e392b104a8d67508a94001018c2b

  Message:
    Support reindex

  Added files:
    lib/groonga/command/reindex.rb
    test/command/test-reindex.rb
  Modified files:
    lib/groonga/command.rb

  Modified: lib/groonga/command.rb (+1 -0)
===================================================================
--- lib/groonga/command.rb    2015-08-19 18:27:40 +0900 (a853d60)
+++ lib/groonga/command.rb    2015-11-24 16:42:47 +0900 (b890973)
@@ -43,6 +43,7 @@ require "groonga/command/plugin-register"
 require "groonga/command/plugin-unregister"
 require "groonga/command/range-filter"
 require "groonga/command/register"
+require "groonga/command/reindex"
 require "groonga/command/request-cancel"
 require "groonga/command/ruby-eval"
 require "groonga/command/ruby-load"

  Added: lib/groonga/command/reindex.rb (+43 -0) 100644
===================================================================
--- /dev/null
+++ lib/groonga/command/reindex.rb    2015-11-24 16:42:47 +0900 (ca105eb)
@@ -0,0 +1,43 @@
+# Copyright (C) 2015  Kouhei Sutou <kou �� clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# 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 "groonga/command/base"
+
+module Groonga
+  module Command
+    # A command class that represents `reindex` command.
+    #
+    # @since 1.1.4
+    class Reindex < Base
+      Command.register("reindex", self)
+
+      class << self
+        def parameter_names
+          [
+            :target_name,
+          ]
+        end
+      end
+
+      # @return [String] `target_name` parameter value.
+      #
+      # @since 1.1.4
+      def target_name
+        self[:target_name]
+      end
+    end
+  end
+end

  Added: test/command/test-reindex.rb (+43 -0) 100644
===================================================================
--- /dev/null
+++ test/command/test-reindex.rb    2015-11-24 16:42:47 +0900 (fd415e9)
@@ -0,0 +1,43 @@
+# Copyright (C) 2015  Kouhei Sutou <kou �� clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# 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
+
+class ReindexCommandTest < Test::Unit::TestCase
+  private
+  def reindex_command(pair_arguments={}, ordered_arguments=[])
+    Groonga::Command::Reindex.new("reindex",
+                                  pair_arguments,
+                                  ordered_arguments)
+  end
+
+  class ConstructorTest < self
+    def test_ordered_arguments
+      target_name = "Lexicon.index"
+
+      command = reindex_command({}, [target_name])
+      assert_equal({
+                     :target_name => target_name,
+                   },
+                   command.arguments)
+    end
+  end
+
+  class TargetNameTest < self
+    def test_reader
+      command = reindex_command(:target_name => "Lexicon.index")
+      assert_equal("Lexicon.index", command.target_name)
+    end
+  end
+end
-------------- next part --------------
HTML����������������������������...
Download 



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