Kouhei Sutou
null+****@clear*****
Sun Mar 13 13:05:53 JST 2016
Kouhei Sutou 2016-03-13 13:05:53 +0900 (Sun, 13 Mar 2016) New Revision: 83d93d8726fd80772db09c1830f775347b40b461 https://github.com/groonga/groonga-command/commit/83d93d8726fd80772db09c1830f775347b40b461 Message: Support shutdown Added files: lib/groonga/command/shutdown.rb test/command/test-shutdown.rb Modified files: lib/groonga/command.rb Modified: lib/groonga/command.rb (+1 -0) =================================================================== --- lib/groonga/command.rb 2016-03-07 00:59:28 +0900 (98af192) +++ lib/groonga/command.rb 2016-03-13 13:05:53 +0900 (08f40c1) @@ -53,6 +53,7 @@ require "groonga/command/request-cancel" require "groonga/command/ruby-eval" require "groonga/command/ruby-load" require "groonga/command/select" +require "groonga/command/shutdown" require "groonga/command/status" require "groonga/command/suggest" require "groonga/command/table-create" Added: lib/groonga/command/shutdown.rb (+43 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/shutdown.rb 2016-03-13 13:05:53 +0900 (832702b) @@ -0,0 +1,43 @@ +# Copyright (C) 2016 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 `shutdown` command. + # + # @since 1.1.8 + class Shutdown < Base + Command.register("shutdown", self) + + class << self + def parameter_names + [ + :mode, + ] + end + end + + # @return [String] `mode` parameter value. + # + # @since 1.1.8 + def mode + self[:mode] + end + end + end +end Added: test/command/test-shutdown.rb (+46 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-shutdown.rb 2016-03-13 13:05:53 +0900 (d154e68) @@ -0,0 +1,46 @@ +# Copyright (C) 2016 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 ShutdownCommandTest < Test::Unit::TestCase + private + def shutdown_command(pair_arguments={}, ordered_arguments=[]) + Groonga::Command::Shutdown.new("shutdown", + pair_arguments, + ordered_arguments) + end + + class ConstructorTest < self + def test_ordered_arguments + mode = "immediate" + + command = shutdown_command({}, + [ + mode, + ]) + assert_equal({ + :mode => mode, + }, + command.arguments) + end + end + + class ModeTest < self + def test_reader + command = shutdown_command(:mode => "immediate") + assert_equal("immediate", command.mode) + end + end +end -------------- next part -------------- HTML����������������������������...Download