Navigation Menu

Skip to content

Commit

Permalink
Support request_cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jan 26, 2015
1 parent 069d191 commit 6aa3edd
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/groonga/command.rb
Expand Up @@ -30,6 +30,7 @@
require "groonga/command/load"
require "groonga/command/normalize"
require "groonga/command/register"
require "groonga/command/request-cancel"
require "groonga/command/ruby-eval"
require "groonga/command/ruby-load"
require "groonga/command/select"
Expand Down
42 changes: 42 additions & 0 deletions lib/groonga/command/request-cancel.rb
@@ -0,0 +1,42 @@
# 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 `request_cancel` command.
#
# @since 1.1.0
class RequestCancel < Base
Command.register("request_cancel", self)

class << self
def parameter_names
[
:id,
]
end
end

# @return [String] `id` parameter value.
# @since 1.1.0
def id
self[:id]
end
end
end
end
46 changes: 46 additions & 0 deletions test/command/test-request-cancel.rb
@@ -0,0 +1,46 @@
# 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 RequestCancelCommandTest < Test::Unit::TestCase
private
def request_cancel_command(pair_arguments={}, ordered_arguments=[])
Groonga::Command::RequestCancel.new("request_cancel",
pair_arguments,
ordered_arguments)
end

class ConstructorTest < self
def test_ordered_arguments
id = "ID"

ordered_arguments = [
id,
]
command = request_cancel_command({}, ordered_arguments)
assert_equal({
:id => id,
},
command.arguments)
end
end

class IDTest < self
def test_reader
command = request_cancel_command(:id => "ID")
assert_equal("ID", command.id)
end
end
end

0 comments on commit 6aa3edd

Please sign in to comment.