Kouhei Sutou
null+****@clear*****
Sun Jun 25 20:39:23 JST 2017
Kouhei Sutou 2017-06-25 20:39:23 +0900 (Sun, 25 Jun 2017) New Revision: e97c062f1d7d682b56c2ffaf3f71582f40e8994e https://github.com/groonga/groonga-command/commit/e97c062f1d7d682b56c2ffaf3f71582f40e8994e Message: Support query_log_flags_{get,set,add,remove} Added files: lib/groonga/command/query-log-flags-add.rb lib/groonga/command/query-log-flags-get.rb lib/groonga/command/query-log-flags-remove.rb lib/groonga/command/query-log-flags-set.rb test/command/test-query-log-flags-add.rb test/command/test-query-log-flags-get.rb test/command/test-query-log-flags-remove.rb test/command/test-query-log-flags-set.rb Modified files: lib/groonga/command.rb Modified: lib/groonga/command.rb (+5 -3) =================================================================== --- lib/groonga/command.rb 2017-03-27 12:02:27 +0900 (08805b6) +++ lib/groonga/command.rb 2017-06-25 20:39:23 +0900 (3234e7e) @@ -1,6 +1,4 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2012-2016 Kouhei Sutou <kou �� clear-code.com> +# Copyright (C) 2012-2017 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 @@ -47,6 +45,10 @@ require "groonga/command/object-remove" require "groonga/command/plugin-register" require "groonga/command/plugin-unregister" require "groonga/command/query-expand" +require "groonga/command/query-log-flags-add" +require "groonga/command/query-log-flags-get" +require "groonga/command/query-log-flags-remove" +require "groonga/command/query-log-flags-set" require "groonga/command/range-filter" require "groonga/command/register" require "groonga/command/reindex" Added: lib/groonga/command/query-log-flags-add.rb (+50 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/query-log-flags-add.rb 2017-06-25 20:39:23 +0900 (c683511) @@ -0,0 +1,50 @@ +# Copyright (C) 2017 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 `query_log_flags_add` command. + # + # @since 1.3.3 + class QueryLogFlagsAdd < Base + class << self + def command_name + "query_log_flags_add" + end + + def parameter_names + [ + :flags + ] + end + end + + Command.register(command_name, self) + + # @return [Array<String>] An array of flags specified in `flags` + # parameter value. This array is extracted by parsing `flags` + # parameter value. If `flags` parameter value is nil or empty, + # an empty array is returned. + # + # @since 1.3.3 + def flags + @flags ||= flags_value(:flags) + end + end + end +end Added: lib/groonga/command/query-log-flags-get.rb (+39 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/query-log-flags-get.rb 2017-06-25 20:39:23 +0900 (b4558cd) @@ -0,0 +1,39 @@ +# Copyright (C) 2017 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 `query_log_flags_get` command. + # + # @since 1.3.3 + class QueryLogFlagsGet < Base + class << self + def command_name + "query_log_flags_get" + end + + def parameter_names + [ + ] + end + end + + Command.register(command_name, self) + end + end +end Added: lib/groonga/command/query-log-flags-remove.rb (+50 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/query-log-flags-remove.rb 2017-06-25 20:39:23 +0900 (3e05749) @@ -0,0 +1,50 @@ +# Copyright (C) 2017 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 `query_log_flags_remove` command. + # + # @since 1.3.3 + class QueryLogFlagsRemove < Base + class << self + def command_name + "query_log_flags_remove" + end + + def parameter_names + [ + :flags + ] + end + end + + Command.register(command_name, self) + + # @return [Array<String>] An array of flags specified in `flags` + # parameter value. This array is extracted by parsing `flags` + # parameter value. If `flags` parameter value is nil or empty, + # an empty array is returned. + # + # @since 1.3.3 + def flags + @flags ||= flags_value(:flags) + end + end + end +end Added: lib/groonga/command/query-log-flags-set.rb (+50 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/query-log-flags-set.rb 2017-06-25 20:39:23 +0900 (3c0ae24) @@ -0,0 +1,50 @@ +# Copyright (C) 2017 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 `query_log_flags_set` command. + # + # @since 1.3.3 + class QueryLogFlagsSet < Base + class << self + def command_name + "query_log_flags_set" + end + + def parameter_names + [ + :flags + ] + end + end + + Command.register(command_name, self) + + # @return [Array<String>] An array of flags specified in `flags` + # parameter value. This array is extracted by parsing `flags` + # parameter value. If `flags` parameter value is nil or empty, + # an empty array is returned. + # + # @since 1.3.3 + def flags + @flags ||= flags_value(:flags) + end + end + end +end Added: test/command/test-query-log-flags-add.rb (+45 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-query-log-flags-add.rb 2017-06-25 20:39:23 +0900 (9e3ed05) @@ -0,0 +1,45 @@ +# Copyright (C) 2017 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 QueryLogFlagsAddCommandTest < Test::Unit::TestCase + private + def query_log_flags_add_command(pair_arguments={}, ordered_arguments=[]) + Groonga::Command::QueryLogFlagsAdd.new(pair_arguments, + ordered_arguments) + end + + class ConstructorTest < self + def test_ordered_arguments + flags = "COMMAND|RESULT_CODE" + + command = query_log_flags_add_command({}, + [ + flags, + ]) + assert_equal({ + :flags => flags, + }, + command.arguments) + end + end + + class FlagsTest < self + def test_reader + command = query_log_flags_add_command(:flags => "COMMAND|RESULT_CODE") + assert_equal(["COMMAND", "RESULT_CODE"], command.flags) + end + end +end Added: test/command/test-query-log-flags-get.rb (+31 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-query-log-flags-get.rb 2017-06-25 20:39:23 +0900 (a877af0) @@ -0,0 +1,31 @@ +# Copyright (C) 2017 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 QueryLogFlagsGetCommandTest < Test::Unit::TestCase + private + def query_log_flags_get_command(pair_arguments={}, ordered_arguments=[]) + Groonga::Command::QueryLogFlagsGet.new(pair_arguments, + ordered_arguments) + end + + class ConstructorTest < self + def test_ordered_arguments + command = query_log_flags_get_command({}, []) + assert_equal({}, + command.arguments) + end + end +end Added: test/command/test-query-log-flags-remove.rb (+45 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-query-log-flags-remove.rb 2017-06-25 20:39:23 +0900 (d6f39b0) @@ -0,0 +1,45 @@ +# Copyright (C) 2017 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 QueryLogFlagsRemoveCommandTest < Test::Unit::TestCase + private + def query_log_flags_remove_command(pair_arguments={}, ordered_arguments=[]) + Groonga::Command::QueryLogFlagsRemove.new(pair_arguments, + ordered_arguments) + end + + class ConstructorTest < self + def test_ordered_arguments + flags = "COMMAND|RESULT_CODE" + + command = query_log_flags_remove_command({}, + [ + flags, + ]) + assert_equal({ + :flags => flags, + }, + command.arguments) + end + end + + class FlagsTest < self + def test_reader + command = query_log_flags_remove_command(:flags => "COMMAND|RESULT_CODE") + assert_equal(["COMMAND", "RESULT_CODE"], command.flags) + end + end +end Added: test/command/test-query-log-flags-set.rb (+45 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-query-log-flags-set.rb 2017-06-25 20:39:23 +0900 (d25a251) @@ -0,0 +1,45 @@ +# Copyright (C) 2017 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 QueryLogFlagsSetCommandTest < Test::Unit::TestCase + private + def query_log_flags_set_command(pair_arguments={}, ordered_arguments=[]) + Groonga::Command::QueryLogFlagsSet.new(pair_arguments, + ordered_arguments) + end + + class ConstructorTest < self + def test_ordered_arguments + flags = "COMMAND|RESULT_CODE" + + command = query_log_flags_set_command({}, + [ + flags, + ]) + assert_equal({ + :flags => flags, + }, + command.arguments) + end + end + + class FlagsTest < self + def test_reader + command = query_log_flags_set_command(:flags => "COMMAND|RESULT_CODE") + assert_equal(["COMMAND", "RESULT_CODE"], command.flags) + end + end +end -------------- next part -------------- HTML����������������������������...下載