groonga-client 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
data/doc/text/news.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# NEWS
|
2
2
|
|
3
|
+
## 0.0.4 - 2013-10-29
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* http: Supported timeout error.
|
8
|
+
* status: Added {Groonga::Client::Response::Status#alloc_count} and
|
9
|
+
{Groonga::Client::Response::Status#n_allocations}.
|
10
|
+
|
3
11
|
## 0.0.3 - 2013-09-18
|
4
12
|
|
5
13
|
### Improvements
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
+
# Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
|
3
4
|
# Copyright (C) 2013 Haruka Yoshihara <yoshihara@clear-code.com>
|
4
5
|
#
|
5
6
|
# This library is free software; you can redistribute it and/or
|
@@ -23,6 +24,13 @@ module Groonga
|
|
23
24
|
module Response
|
24
25
|
class Status < Base
|
25
26
|
Response.register("status", self)
|
27
|
+
|
28
|
+
# @return [Integer] The number of allocated memory blocks.
|
29
|
+
def alloc_count
|
30
|
+
@body["alloc_count"] || 0
|
31
|
+
end
|
32
|
+
|
33
|
+
alias_method :n_allocations, :alloc_count
|
26
34
|
end
|
27
35
|
end
|
28
36
|
end
|
@@ -1,5 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
1
19
|
module Groonga
|
2
20
|
class Client
|
3
|
-
VERSION = "0.0.
|
21
|
+
VERSION = "0.0.4"
|
4
22
|
end
|
5
23
|
end
|
data/test/response/helper.rb
CHANGED
@@ -1,11 +1,24 @@
|
|
1
|
+
# Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
# Copyright (C) 2013 Kosuke Asami
|
3
|
+
#
|
4
|
+
# This library is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU Lesser General Public
|
6
|
+
# License as published by the Free Software Foundation; either
|
7
|
+
# version 2.1 of the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
1
18
|
module TestResponseHelper
|
2
19
|
def parse_raw_response(command_name, raw_response)
|
3
|
-
make_command(command_name).send(:parse_raw_response, raw_response)
|
4
|
-
end
|
5
|
-
|
6
|
-
def make_command(command_name, parameters = {})
|
7
20
|
command_class = Groonga::Command.find(command_name)
|
8
|
-
command = command_class.new(command_name,
|
9
|
-
Groonga::Client::
|
21
|
+
command = command_class.new(command_name, {})
|
22
|
+
Groonga::Client::Response.parse(command, raw_response)
|
10
23
|
end
|
11
24
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "response/helper"
|
18
|
+
|
19
|
+
class TestResponseStatus < Test::Unit::TestCase
|
20
|
+
class TestParseRawResponse < self
|
21
|
+
include TestResponseHelper
|
22
|
+
|
23
|
+
def test_class
|
24
|
+
header = [0, 1372430096.70991, 0.000522851943969727]
|
25
|
+
body = {
|
26
|
+
"alloc_count" => 155,
|
27
|
+
"starttime" => 1380525914,
|
28
|
+
"uptime" => 54,
|
29
|
+
"version" => "3.0.8",
|
30
|
+
"n_queries" => 0,
|
31
|
+
"cache_hit_rate" => 0.0,
|
32
|
+
"command_version" => 1,
|
33
|
+
"default_command_version" => 1,
|
34
|
+
"max_command_version" => 2,
|
35
|
+
}
|
36
|
+
raw_response = [header, body].to_json
|
37
|
+
|
38
|
+
response = parse_raw_response("status", raw_response)
|
39
|
+
assert_equal(Groonga::Client::Response::Status, response.class)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class TestBody < self
|
44
|
+
def setup
|
45
|
+
@command = Groonga::Command::Status.new("status", {})
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
def create_response(body)
|
50
|
+
header = [0, 1372430096.70991, 0.000522851943969727]
|
51
|
+
Groonga::Client::Response::Status.new(@command, header, body)
|
52
|
+
end
|
53
|
+
|
54
|
+
class TestReader < self
|
55
|
+
def test_alloc_count
|
56
|
+
response = create_response({"alloc_count" => 29})
|
57
|
+
assert_equal(29, response.alloc_count)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_n_allocations
|
61
|
+
response = create_response({"alloc_count" => 29})
|
62
|
+
assert_equal(29, response.n_allocations)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groonga-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-
|
14
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: gqtp
|
@@ -212,6 +212,7 @@ files:
|
|
212
212
|
- test/run-test.rb
|
213
213
|
- test/test-client.rb
|
214
214
|
- test/response/helper.rb
|
215
|
+
- test/response/test-status.rb
|
215
216
|
- test/response/test-select.rb
|
216
217
|
- test/response/test-table-list.rb
|
217
218
|
- test/response/test-column-list.rb
|
@@ -250,6 +251,7 @@ test_files:
|
|
250
251
|
- test/run-test.rb
|
251
252
|
- test/test-client.rb
|
252
253
|
- test/response/helper.rb
|
254
|
+
- test/response/test-status.rb
|
253
255
|
- test/response/test-select.rb
|
254
256
|
- test/response/test-table-list.rb
|
255
257
|
- test/response/test-column-list.rb
|